Ejemplo n.º 1
0
if (isset($_GET['serverName']) && isset($_GET['id'])) {
    $serverName = $_GET['serverName'];
    $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();
    }
Ejemplo n.º 2
0
if (isset($_GET['serverName']) && isset($_GET['id'])) {
    $serverName = $_GET['serverName'];
    $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);
    //修改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();
    }