|
66 | 66 | $app->log("Set Lock: ".$conf["temppath"].$conf["fs_div"].".ispconfig_lock", LOGLEVEL_DEBUG); |
67 | 67 | */ |
68 | 68 |
|
69 | | -// get the dalaog_id of the last performed record |
70 | | -$tmp_rec = $app->dbmaster->queryOneRecord("SELECT updated FROM server WHERE server_id = ".$conf["server_id"]); |
71 | | -$conf['last_datalog_id'] = (int)$tmp_rec['updated']; |
72 | | -unset($tmp_rec); |
73 | | - |
74 | | -// Check if there is anything to update |
75 | | -$tmp_rec = $app->dbmaster->queryOneRecord("SELECT count(server_id) as number from sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf["server_id"]." OR server_id = 0)"); |
76 | | -$tmp_num_records = $tmp_rec["number"]; |
77 | | -unset($tmp_rec); |
78 | | - |
79 | | -if($tmp_num_records > 0) { |
80 | | - /* |
81 | | - There is something to do, triggert by the database -> do it! |
82 | | - */ |
83 | | - // Write the Log |
84 | | - $app->log("Found $tmp_num_records changes, starting update process.", LOGLEVEL_DEBUG); |
85 | | - // Load required base-classes |
86 | | - $app->uses('ini_parser,modules,plugins,file,services'); |
87 | | - // Get server configuration |
88 | | - $conf["serverconfig"] = $app->ini_parser->parse_ini_string(stripslashes($server_db_record["config"])); |
89 | | - // Load the modules that are im the mods-enabled folder |
90 | | - $app->modules->loadModules('all'); |
91 | | - // Load the plugins that are in the plugins-enabled folder |
92 | | - $app->plugins->loadPlugins('all'); |
93 | | - // Go trough the sys_datalog table and call the processing functions |
94 | | - // in the modules that are hooked on to the table actions |
95 | | - $app->modules->processDatalog(); |
96 | | - // Restart services that need to be restarted after configuration |
97 | | - $app->services->processDelayedActions(); |
| 69 | +if($app->dbmaster->connect()) { |
| 70 | + |
| 71 | + // get the dalaog_id of the last performed record |
| 72 | + $tmp_rec = $app->dbmaster->queryOneRecord("SELECT updated FROM server WHERE server_id = ".$conf["server_id"]); |
| 73 | + $conf['last_datalog_id'] = (int)$tmp_rec['updated']; |
| 74 | + unset($tmp_rec); |
| 75 | + |
| 76 | + // Check if there is anything to update |
| 77 | + $tmp_rec = $app->dbmaster->queryOneRecord("SELECT count(server_id) as number from sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf["server_id"]." OR server_id = 0)"); |
| 78 | + $tmp_num_records = $tmp_rec["number"]; |
| 79 | + unset($tmp_rec); |
| 80 | + |
| 81 | + if($tmp_num_records > 0) { |
| 82 | + /* |
| 83 | + There is something to do, triggert by the database -> do it! |
| 84 | + */ |
| 85 | + // Write the Log |
| 86 | + $app->log("Found $tmp_num_records changes, starting update process.", LOGLEVEL_DEBUG); |
| 87 | + // Load required base-classes |
| 88 | + $app->uses('ini_parser,modules,plugins,file,services'); |
| 89 | + // Get server configuration |
| 90 | + $conf["serverconfig"] = $app->ini_parser->parse_ini_string(stripslashes($server_db_record["config"])); |
| 91 | + // Load the modules that are im the mods-enabled folder |
| 92 | + $app->modules->loadModules('all'); |
| 93 | + // Load the plugins that are in the plugins-enabled folder |
| 94 | + $app->plugins->loadPlugins('all'); |
| 95 | + // Go trough the sys_datalog table and call the processing functions |
| 96 | + // in the modules that are hooked on to the table actions |
| 97 | + $app->modules->processDatalog(); |
| 98 | + // Restart services that need to be restarted after configuration |
| 99 | + $app->services->processDelayedActions(); |
| 100 | + } else { |
| 101 | + /* |
| 102 | + There is no trigger inside the database -> load only the core, maybe they have to do something |
| 103 | + */ |
| 104 | + // Write the log |
| 105 | + $app->log('No Updated records found, starting only the core.', LOGLEVEL_DEBUG); |
| 106 | + // Load required base-classes |
| 107 | + $app->uses('ini_parser,modules,plugins,file,services'); |
| 108 | + // Get server configuration |
| 109 | + $conf["serverconfig"] = $app->ini_parser->parse_ini_string(stripslashes($server_db_record["config"])); |
| 110 | + // Load the modules that are im the mods-core folder |
| 111 | + $app->modules->loadModules('core'); |
| 112 | + // Load the plugins that are in the plugins-core folder |
| 113 | + $app->plugins->loadPlugins('core'); |
| 114 | + } |
98 | 115 | } else { |
99 | | - /* |
100 | | - There is no trigger inside the database -> load only the core, maybe they have to do something |
101 | | - */ |
102 | | - // Write the log |
103 | | - $app->log('No Updated records found, starting only the core.', LOGLEVEL_DEBUG); |
104 | | - // Load required base-classes |
105 | | - $app->uses('ini_parser,modules,plugins,file,services'); |
106 | | - // Get server configuration |
107 | | - $conf["serverconfig"] = $app->ini_parser->parse_ini_string(stripslashes($server_db_record["config"])); |
108 | | - // Load the modules that are im the mods-core folder |
109 | | - $app->modules->loadModules('core'); |
110 | | - // Load the plugins that are in the plugins-core folder |
111 | | - $app->plugins->loadPlugins('core'); |
| 116 | + $app->log("Unable to connect to master server.",LOGLEVEL_ERROR); |
112 | 117 | } |
113 | 118 |
|
114 | 119 | /* |
|
0 commit comments