$matchresult = preg_match($find, $vhostrecord, $matches); if (!empty($matchresult)) { $replacement = "#Include " . GetSystemOption('mod_bw') . "mod_bw/mod_bw_" . $rowvhosts['pk_name_vc'] . ".conf"; } } $newvhostrecord = preg_replace($find, $replacement, $vhostrecord); $vhostfile = substr_replace($vhostfile, $newvhostrecord, $startpos, $endpos - $startpos + $endposlength); $edited = 1; } } # Update the quota table and set mofified flag to 0 for all packages $sqlqtmodified = "UPDATE zpanel_core.z_quotas SET qt_modified_in = 0"; $resultqtmodified = mysql_query($sqlqtmodified) or die('SQL error from daemon.php mod_bw section around line 743 - ' . mysql_error()); # Changes and Restart if (setVhost($vhostfile, true, $vhost)) { if (restartApache()) { TriggerLog(1, $b = "> Apache web server has been restarted by the bw_mod"); } else { TriggerLog(1, $b = "> Apache web server reboot failed due to the bm_mod restart"); } } ##################################################################################################################################### # Generates Webalizer stats for the domain! # ##################################################################################################################################### $sql = "SELECT * FROM z_vhosts LEFT JOIN z_accounts ON z_vhosts.vh_acc_fk=z_accounts.ac_id_pk WHERE vh_deleted_ts IS NULL"; $domains = DataExchange("r", $z_db_name, $sql); $row_domains = mysql_fetch_assoc($domains); $totalRows_domains = DataExchange("t", $z_db_name, $sql); if ($totalRows_domains > 0) { do { # Check to ensure folders exists ready for the webalizer reports etc....
$id = $_GET['id']; foreach ($vhosts as $host) { if ($host['serverName'] == $serverName) { $old_root = $host['root']; break; } } if (!$old_root) { exit('error'); } $new_root = $db[$serverName][$id]; recordHistory($old_root, $new_root, $serverName); //记录历史 modifiyConf($old_root, $new_root, $serverName); //修改apache的conf restartApache(); //重启apache echo '<script type="text/javascript">alert(\'switch success\');location.href=\'' . $root_url . '\';</script>'; exit; } function recordHistory($old_root, $new_root, $serverName) { global $vhosts, $db, $db_file; if ($old_root == $new_root) { return false; } if (empty($db[$serverName])) { $db[$serverName] = array(); } if ($index = array_search($new_root, $db[$serverName])) { $db[$serverName] = array_splice($db[$serverName], $index - 1, 1);
function checkApacheCronService() { global $conf_dtc_system_groupname; global $conf_generated_file_path; $cronjob_table_content = getCronFlags(); if ($cronjob_table_content["gen_vhosts"] == "yes") { echo "Generating Apache vhosts\n"; pro_vhost_generate(); system("chgrp {$conf_dtc_system_groupname} \"{$conf_generated_file_path}/vhosts.conf\""); system("chmod 660 \"{$conf_generated_file_path}/vhosts.conf\""); markCronflagOk("gen_vhosts='no'"); } if ($cronjob_table_content["restart_apache"] == "yes") { restartApache(); markCronflagOk("restart_apache='no'"); } }