| | |
| | | <?php |
| | | |
| | | /* |
| | | Copyright (c) 2007-2011, Till Brehm, projektfarm Gmbh |
| | | All rights reserved. |
| | |
| | | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| | | */ |
| | | |
| | | require('lib/config.inc.php'); |
| | | require('lib/app.inc.php'); |
| | | define('SCRIPT_PATH', dirname($_SERVER["SCRIPT_FILENAME"])); |
| | | require(SCRIPT_PATH."/lib/config.inc.php"); |
| | | require(SCRIPT_PATH."/lib/app.inc.php"); |
| | | |
| | | set_time_limit(0); |
| | | ini_set('error_reporting', E_ALL & ~E_NOTICE); |
| | |
| | | $conf['server_id'] = intval($conf['server_id']); |
| | | |
| | | /* |
| | | // Get server record, if updates where available for this server |
| | | $server_db_record = $app->db->queryOneRecord("SELECT * FROM server WHERE update = 1 AND server_id = ".$conf['server_id']); |
| | | if($server_db_record == false) { |
| | | $app->log('Nothing to update for server_id '.$conf['server_id']); |
| | | die(); |
| | | } else { |
| | | // Set update status to 0, so we dont start the update process twice |
| | | $app->db->query("UPDATE server SET update = 0 WHERE server_id = ".$conf['server_id']); |
| | | $app->log('Begin update.'); |
| | | } |
| | | */ |
| | | |
| | | /* |
| | | * Try to Load the server configuration from the master-db |
| | | */ |
| | | if ($app->dbmaster->connect()) { |
| | | if ($app->dbmaster->connect_error == NULL) { |
| | | $server_db_record = $app->dbmaster->queryOneRecord("SELECT * FROM server WHERE server_id = " . $conf['server_id']); |
| | | |
| | | $conf['last_datalog_id'] = (int) $server_db_record['updated']; |
| | |
| | | /* |
| | | * Next we try to process the datalog |
| | | */ |
| | | if ($app->db->connect() && $app->dbmaster->connect()) { |
| | | if ($app->db->connect_error == NULL && $app->dbmaster->connect_error == NULL) { |
| | | |
| | | // Check if there is anything to update |
| | | if ($conf['mirror_server_id'] > 0) { |
| | |
| | | $needStartCore = false; |
| | | } |
| | | } else { |
| | | if (!$app->db->connect()) { |
| | | if ($app->db->connect->connect_error == NULL) { |
| | | $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); |