public function get($name = false, $type = BackendLock::LOCK_CUSTOM, $expire = null, $password = null)
 {
     if (empty($password)) {
         if (Component::isActive('BackendError')) {
             BackendError::add('Missing BackendSystemLock Password', 'No password was supplied for the system lock named ' . $name);
         }
         return null;
     }
     $result = parent::get($name, $type, $expire);
     if ($result) {
         ConfigValue::set('LockPassword_' . $this->array['name'], $password);
     }
 }
예제 #2
0
function reseed()
{
    //Get and generate new seed
    $seed = ConfigValue::get('Seed', mt_rand());
    srand($seed);
    //$new_seed = floor($seed / 4) . floor(mt_rand() / 4);
    $new_seed = mt_rand();
    ConfigValue::set('Seed', $new_seed);
}
예제 #3
0
 private static function installComponents($with_db = false)
 {
     $components = Component::getCoreComponents($with_db);
     if (!$components) {
         Backend::addError('Could not get components to pre install');
         return false;
     }
     //Save original LogToFile setting
     $original = ConfigValue::get('LogToFile', false);
     $install_log_file = 'install_log_' . date('Ymd_His') . '.txt';
     ConfigValue::set('LogToFile', $install_log_file);
     //Pre Install components
     Backend::addNotice(PHP_EOL . PHP_EOL . 'Installation started at ' . date('Y-m-d H:i:s'));
     $components = array_flatten($components, null, 'name');
     foreach ($components as $component) {
         if (class_exists($component, true) && method_exists($component, 'pre_install')) {
             Backend::addNotice('Pre Installing ' . $component);
             if (!call_user_func_array(array($component, 'pre_install'), array())) {
                 Backend::addError('Error on pre install for ' . $component);
                 return false;
             }
         }
     }
     //Install Components
     foreach ($components as $component) {
         if (class_exists($component, true) && method_exists($component, 'install')) {
             Backend::addNotice('Installing ' . $component);
             if (!call_user_func_array(array($component, 'install'), array())) {
                 Backend::addError('Error on installing ' . $component);
                 return false;
             }
         }
     }
     //Install Application Components
     if (is_callable(array('Application', 'getComponents'))) {
         $app_components = Application::getComponents();
         if (is_array($app_components)) {
             foreach ($components as $component) {
                 if (class_exists($component, true) && method_exists($component, 'install')) {
                     Backend::addNotice('Installing ' . $component);
                     if (!call_user_func_array(array($component, 'install'), array())) {
                         Backend::addError('Error on installing ' . $component);
                         return false;
                     }
                 }
             }
         }
     }
     //Restore Original
     ConfigValue::set('LogToFile', $original);
     return true;
 }