| | |
| | | } |
| | | */ |
| | | |
| | | //* Load the server configuration |
| | | /* |
| | | * Try to Load the server configuration from the master-db |
| | | */ |
| | | if($app->dbmaster->connect()) { |
| | | // get the dalaog_id of the last performed record |
| | | $server_db_record = $app->dbmaster->queryOneRecord("SELECT * FROM server WHERE server_id = ".$conf['server_id']); |
| | |
| | | $conf['log_priority'] = intval($conf['serverconfig']['server']['loglevel']); |
| | | |
| | | unset($server_db_record); |
| | | } else { |
| | | /* |
| | | * The master-db is not available. |
| | | * Problem: because we need to start the rescue-module (to rescue the DB if this IS the |
| | | * server, the master-db is running at) we have to initialize some config... |
| | | */ |
| | | $conf['last_datalog_id'] = intval('9223372036854775807'); // maxint at 32 and 64 bit systems |
| | | $conf['mirror_server_id'] = 0; // no mirror |
| | | // Set the loglevel to warning |
| | | $conf['log_priority'] = LOGLEVEL_WARN; |
| | | /* |
| | | * Set the configuration to rescue the database |
| | | */ |
| | | $conf['serverconfig']['rescue']['try_rescue'] = 'y'; |
| | | $conf['serverconfig']['rescue']['do_not_try_rescue_mysql'] = 'n'; |
| | | } |
| | | |
| | | |
| | |
| | | @touch($conf['temppath'].$conf['fs_div'].'.ispconfig_lock'); |
| | | $app->log('Set Lock: '.$conf['temppath'].$conf['fs_div'].'.ispconfig_lock', LOGLEVEL_DEBUG); |
| | | |
| | | /** Do we need to start the core-modules */ |
| | | $needStartCore = true; |
| | | |
| | | /* |
| | | * Next we try to process the datalog |
| | | */ |
| | | if($app->db->connect() && $app->dbmaster->connect()) { |
| | | |
| | | // Check if there is anything to update |
| | |
| | | $app->modules->processDatalog(); |
| | | // Restart services that need to after configuration |
| | | $app->services->processDelayedActions(); |
| | | // All modules are already loaded and processed, so there is NO NEED to load the core once again... |
| | | $needStartCore = false; |
| | | } |
| | | } else { |
| | | if (!$app->db->connect()) { |
| | | $app->log('Unable to connect to local server.' . $app->db->errorMessage, LOGLEVEL_WARN); |
| | | } else { |
| | | $app->log('Unable to connect to master server.' . $app->dbmaster->errorMessage, LOGLEVEL_WARN); |
| | | } |
| | | } |
| | | |
| | | /* |
| | | There is no trigger inside the database -> load only the core, maybe they have to do something |
| | | * Under normal circumstances the system was loaded and all updates are done. |
| | | * but if we do not have to update anything or if the database is not accessible, then we |
| | | * have to start the core-system (if the database is accessible, we need the core because of the |
| | | * monitoring. If the databse is NOT accessible, we need the core because of rescue the db... |
| | | */ |
| | | if ($needStartCore) { |
| | | // Write the log |
| | | $app->log('No Updated records found, starting only the core.', LOGLEVEL_DEBUG); |
| | | // Load required base-classes |
| | |
| | | // Load the plugins that are in the plugins-core folder |
| | | $app->plugins->loadPlugins('core'); |
| | | } |
| | | } else { |
| | | if(!$app->db->connect()) { |
| | | $app->log('Unable to connect to local server.'.$app->db->errorMessage,LOGLEVEL_WARN); |
| | | } else { |
| | | $app->log('Unable to connect to master server.'.$app->dbmaster->errorMessage,LOGLEVEL_WARN); |
| | | } |
| | | } |
| | | |
| | | |
| | | // Remove lock |
| | | @unlink($conf['temppath'].$conf['fs_div'].'.ispconfig_lock'); |