|
28 | 28 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | 29 | */ |
30 | 30 |
|
31 | | -require("lib/config.inc.php"); |
32 | | -require("lib/app.inc.php"); |
| 31 | +require('lib/config.inc.php'); |
| 32 | +require('lib/app.inc.php'); |
33 | 33 |
|
34 | 34 | set_time_limit(0); |
35 | 35 | ini_set('error_reporting','E_ALL & ~E_NOTICE'); |
|
53 | 53 | //* Load the server configuration |
54 | 54 | if($app->dbmaster->connect()) { |
55 | 55 | // get the dalaog_id of the last performed record |
56 | | - $server_db_record = $app->dbmaster->queryOneRecord("SELECT * FROM server WHERE server_id = ".$conf["server_id"]); |
| 56 | + $server_db_record = $app->dbmaster->queryOneRecord("SELECT * FROM server WHERE server_id = ".$conf['server_id']); |
57 | 57 | $conf['last_datalog_id'] = (int)$server_db_record['updated']; |
58 | | - $conf["mirror_server_id"] = (int)$server_db_record['mirror_server_id']; |
| 58 | + $conf['mirror_server_id'] = (int)$server_db_record['mirror_server_id']; |
59 | 59 | // Load the ini_parser |
60 | 60 | $app->uses('ini_parser'); |
61 | 61 | // Get server configuration |
62 | | - $conf["serverconfig"] = $app->ini_parser->parse_ini_string(stripslashes($server_db_record["config"])); |
| 62 | + $conf['serverconfig'] = $app->ini_parser->parse_ini_string(stripslashes($server_db_record['config'])); |
63 | 63 | // Set the loglevel |
64 | | - $conf["log_priority"] = intval($conf["serverconfig"]["server"]["loglevel"]); |
| 64 | + $conf['log_priority'] = intval($conf['serverconfig']['server']['loglevel']); |
65 | 65 |
|
66 | 66 | unset($server_db_record); |
67 | 67 | } |
68 | 68 |
|
69 | 69 |
|
70 | 70 | // Check whether another instance of this script is already running |
71 | | -if(is_file($conf["temppath"].$conf["fs_div"].".ispconfig_lock")){ |
| 71 | +if(is_file($conf['temppath'].$conf['fs_div'].'.ispconfig_lock')){ |
72 | 72 | clearstatcache(); |
73 | 73 | for($i=0;$i<120;$i++){ // Wait max. 1200 sec, then retry |
74 | | - if(is_file($conf["temppath"].$conf["fs_div"].".ispconfig_lock")){ |
| 74 | + if(is_file($conf['temppath'].$conf['fs_div'].'.ispconfig_lock')){ |
75 | 75 | exec("ps aux | grep '/usr/local/ispconfig/server/[s]erver.php' | wc -l", $check); |
76 | 76 | if(intval($check[0]) > 1) { // 1 because this is 2nd instance! |
77 | | - $app->log("There is already an instance of server.php running. Exiting.", LOGLEVEL_DEBUG); |
| 77 | + $app->log('There is already an instance of server.php running. Exiting.', LOGLEVEL_DEBUG); |
78 | 78 | exit; |
79 | 79 | } |
80 | | - $app->log("There is already a lockfile set. Waiting another 10 seconds...", LOGLEVEL_DEBUG); |
| 80 | + $app->log('There is already a lockfile set. Waiting another 10 seconds...', LOGLEVEL_DEBUG); |
81 | 81 | sleep(10); |
82 | 82 | clearstatcache(); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | } |
86 | 86 |
|
87 | 87 | // Set Lockfile |
88 | | -@touch($conf["temppath"].$conf["fs_div"].".ispconfig_lock"); |
89 | | -$app->log("Set Lock: ".$conf["temppath"].$conf["fs_div"].".ispconfig_lock", LOGLEVEL_DEBUG); |
| 88 | +@touch($conf['temppath'].$conf['fs_div'].'.ispconfig_lock'); |
| 89 | +$app->log('Set Lock: '.$conf['temppath'].$conf['fs_div'].'.ispconfig_lock', LOGLEVEL_DEBUG); |
90 | 90 |
|
91 | 91 |
|
92 | 92 | if($app->db->connect() && $app->dbmaster->connect()) { |
93 | 93 |
|
94 | 94 | // Check if there is anything to update |
95 | | - if($conf["mirror_server_id"] > 0) { |
96 | | - $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 = ".$conf["mirror_server_id"]." OR server_id = 0)"); |
| 95 | + if($conf['mirror_server_id'] > 0) { |
| 96 | + $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 = ".$conf['mirror_server_id']." OR server_id = 0)"); |
97 | 97 | } else { |
98 | | - $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)"); |
| 98 | + $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)"); |
99 | 99 | } |
100 | 100 |
|
101 | | - $tmp_num_records = $tmp_rec["number"]; |
| 101 | + $tmp_num_records = $tmp_rec['number']; |
102 | 102 | unset($tmp_rec); |
103 | 103 |
|
104 | 104 | if($tmp_num_records > 0) { |
|
109 | 109 | $app->log("Found $tmp_num_records changes, starting update process.", LOGLEVEL_DEBUG); |
110 | 110 | // Load required base-classes |
111 | 111 | $app->uses('modules,plugins,file,services'); |
112 | | - // Load the modules that are im the mods-enabled folder |
| 112 | + // Load the modules that are in the mods-enabled folder |
113 | 113 | $app->modules->loadModules('all'); |
114 | 114 | // Load the plugins that are in the plugins-enabled folder |
115 | 115 | $app->plugins->loadPlugins('all'); |
116 | | - // Go trough the sys_datalog table and call the processing functions |
117 | | - // in the modules that are hooked on to the table actions |
| 116 | + // Go through the sys_datalog table and call the processing functions |
| 117 | + // from the modules that are hooked on to the table actions |
118 | 118 | $app->modules->processDatalog(); |
119 | | - // Restart services that need to be restarted after configuration |
| 119 | + // Restart services that need to after configuration |
120 | 120 | $app->services->processDelayedActions(); |
121 | 121 | } else { |
122 | 122 | /* |
|
133 | 133 | } |
134 | 134 | } else { |
135 | 135 | if(!$app->db->connect()) { |
136 | | - $app->log("Unable to connect to local server.".$app->db->errorMessage,LOGLEVEL_WARN); |
| 136 | + $app->log('Unable to connect to local server.'.$app->db->errorMessage,LOGLEVEL_WARN); |
137 | 137 | } else { |
138 | | - $app->log("Unable to connect to master server.".$app->dbmaster->errorMessage,LOGLEVEL_WARN); |
| 138 | + $app->log('Unable to connect to master server.'.$app->dbmaster->errorMessage,LOGLEVEL_WARN); |
139 | 139 | } |
140 | 140 | } |
141 | 141 |
|
142 | 142 | // Remove lock |
143 | | -@unlink($conf["temppath"].$conf["fs_div"].".ispconfig_lock"); |
144 | | -$app->log("Remove Lock: ".$conf["temppath"].$conf["fs_div"].".ispconfig_lock",LOGLEVEL_DEBUG); |
| 143 | +@unlink($conf['temppath'].$conf['fs_div'].'.ispconfig_lock'); |
| 144 | +$app->log('Remove Lock: '.$conf['temppath'].$conf['fs_div'].'.ispconfig_lock',LOGLEVEL_DEBUG); |
145 | 145 |
|
146 | 146 |
|
147 | 147 | die("finished.\n"); |
|
0 commit comments