当前位置: 首页>>代码示例>>PHP>>正文


PHP squid_admin_mysql函数代码示例

本文整理汇总了PHP中squid_admin_mysql函数的典型用法代码示例。如果您正苦于以下问题:PHP squid_admin_mysql函数的具体用法?PHP squid_admin_mysql怎么用?PHP squid_admin_mysql使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了squid_admin_mysql函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build_rules

function build_rules()
{
    $q = new mysql_squid_builder();
    $unix = new unix();
    $SQUID_BIN = $unix->LOCATE_SQUID_BIN();
    build_progress("{IT_charter}", 25);
    $sql = "SELECT ID,title FROM itcharters WHERE enabled=1";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        build_progress("{IT_charter} {mysql_error}", 110);
        echo $q->mysql_error;
        return;
    }
    if (mysql_num_rows($results) == 0) {
        @unlink("/etc/squid3/itCharts.enabled.db");
        squid_admin_mysql(1, "Reloading Proxy service (itCharts)", null, __FILE__, __LINE__);
        build_progress("{IT_charter} {reload_proxy_service}", 90);
        system("{$SQUID_BIN} -f /etc/squid3/squid.conf -k reconfigure");
        build_progress("{IT_charter} {done} 0 {item}", 100);
        return;
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        build_progress("{$ligne["title"]}", 50);
        echo "{$ligne["ID"]}: {$ligne["title"]}\n";
        $MAIN[$ligne["ID"]] = $ligne["title"];
    }
    @file_put_contents("/etc/squid3/itCharts.enabled.db", serialize($MAIN));
    squid_admin_mysql(1, "Reloading Proxy service (itCharts)", null, __FILE__, __LINE__);
    build_progress("{IT_charter} {reload_proxy_service}", 90);
    system("{$SQUID_BIN} -f /etc/squid3/squid.conf -k reconfigure");
    build_progress("{IT_charter} {done} " . count($MAIN) . " {items}", 100);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:32,代码来源:exec.itchart.php

示例2: ReloadMacHelpers

function ReloadMacHelpers($output = false)
{
    @mkdir("/var/log/squid/reload", 0755, true);
    $unix = new unix();
    $pgrep = $unix->find_program("pgrep");
    $rm = $unix->find_program("rm");
    shell_exec("{$rm} /var/log/squid/reload/*.ufdbgclient.php");
    if (is_file("/var/log/squid/UfdbguardCache.db")) {
        @unlink("/var/log/squid/UfdbguardCache.db");
    }
    exec("{$pgrep} -l -f \"ufdbgclient.php\" 2>&1", $results);
    while (list($index, $ligne) = each($results)) {
        if (preg_match("#pgrep#", $ligne)) {
            continue;
        }
        if (!preg_match("#^([0-9]+)\\s+#", $ligne, $re)) {
            continue;
        }
        $PIDS[] = $re[1];
        echo "Starting......: " . date("H:i:s") . " [INIT]: Webfilter client reloading PID {$re[1]}\n";
        @touch("/var/log/squid/reload/{$re[1]}.ufdbgclient.php");
        @chown("/var/log/squid/reload/{$re[1]}.ufdbgclient.php", "squid");
        @chgrp("/var/log/squid/reload/{$re[1]}.ufdbgclient.php", "squid");
    }
    squid_admin_mysql(2, count($PIDS) . " Artica helper(s) was reloaded", null, __FILE__, __LINE__);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:26,代码来源:exec.ufdbclient.reload.php

示例3: start

function start()
{
    $unix = new unix();
    $unix->ToSyslog("[START_STOP]: Server is started...");
    squid_admin_mysql(0, "Server is is started!", "This a notification that notice a system start procedure on the server", __FILE__, __LINE__);
    $sock = new sockets();
    system_admin_mysql(0, "Server is started!", "This a notification that notice a system start procedure on the server", __FILE__, __LINE__);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:8,代码来源:exec.notify-start-stop.php

示例4: start

function start()
{
    $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $unix = new unix();
    $pid = $unix->get_pid_from_file($pidFile);
    if ($unix->process_exists($pid)) {
        return;
    }
    @file_put_contents($pidFile, getmypid());
    $time = $unix->file_time_min($pidtime);
    if ($time < 5) {
        return;
    }
    @file_put_contents($pidtime, time());
    $free = $unix->find_program("free");
    $echo = $unix->find_program("echo");
    $sync = $unix->find_program("sync");
    $swapoff = $unix->find_program("swapoff");
    $swapon = $unix->find_program("swapon");
    exec("{$free} 2>&1", $results);
    $used = 0;
    $total = 0;
    while (list($num, $ligne) = each($results)) {
        if (preg_match("#Swap:\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)#", $ligne, $re)) {
            $total = $re[1];
            $used = $re[2];
        }
    }
    if (!is_numeric($total)) {
        return;
    }
    if ($total == 0) {
        return;
    }
    if ($used == 0) {
        return;
    }
    if ($total == $used) {
        return;
    }
    $tot1 = $used / $total;
    $tot1 = $tot1 * 100;
    if ($GLOBALS["VERBOSE"]) {
        echo "Swap:{$used}/{$total} - {$tot1}\n";
    }
    $perc = round($tot1);
    if ($GLOBALS["VERBOSE"]) {
        echo "Swap:{$used}/{$total} {$perc}%\n";
    }
    $t = time();
    $GLOBALS["ALL_SCORES"]++;
    shell_exec("{$swapoff} -a && {$swapon} -a");
    $usedTXT = FormatBytes($used);
    $report = $unix->ps_mem_report();
    $distance = $unix->distanceOfTimeInWords($t, time(), true);
    squid_admin_mysql(0, "System swap exceed rule: {$perc}%", "Used {$usedTXT}\nSystem cache was flushed took {$distance}\nThis means you did have enough memory for this computer.\n{$report}", __FILE__, __LINE__);
}
开发者ID:articatech,项目名称:artica,代码行数:58,代码来源:exec.squid.swapoff.php

示例5: restart

function restart()
{
    $unix = new unix();
    $nohup = $unix->find_program("nohup");
    $php5 = $unix->LOCATE_PHP5_BIN();
    shell_exec("{$php5} /usr/share/artica-postfix/exec.initslapd.php --haarp");
    squid_admin_mysql(0, "Framework order to restart Haarp", "");
    shell_exec("{$nohup} /etc/init.d/haarp restart >/dev/null 2>&1 &");
    shell_exec("{$nohup} /etc/init.d/artica-status reload >/dev/null 2>&1 &");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:10,代码来源:haarp.php

示例6: Parseline

function Parseline($buffer)
{
    $buffer = trim($buffer);
    if ($buffer == null) {
        return null;
    }
    if (strpos($buffer, "init urllist") > 0) {
        return;
    }
    if (strpos($buffer, "init expressionlist") > 0) {
        return;
    }
    if (strpos($buffer, "init domainlist") > 0) {
        return;
    }
    if (preg_match('#INFO: loading dbfile (.+)#', $buffer, $re)) {
        events("LOADING {$re['1']}");
        $GLOBALS[__FILE__]["DBFILE"] = trim($re[1]);
        return null;
    }
    if (preg_match("#FATAL: Error db_open: Unknown error#", $buffer, $re)) {
        events("ERROR ON {$GLOBALS[__FILE__]["DBFILE"]} : {$buffer}");
        if (basename($GLOBALS[__FILE__]["DBFILE"]) == "urls.db") {
            events("urls.db -> create " . dirname($GLOBALS[__FILE__]["DBFILE"]) . "/urls it and recompile it");
            @file_put_contents(dirname($GLOBALS[__FILE__]["DBFILE"]) . "/urls", "www." . md5(time()) . ".bv");
        }
        $file = "/etc/artica-postfix/croned.1/squidguard." . md5($GLOBALS[__FILE__]["DBFILE"]) . ".error";
        if (IfFileTime($file)) {
            $cmd = LOCATE_PHP5_BIN2() . " /usr/share/artica-postfix/exec.squidguard.php --compile-single \"{$GLOBALS[__FILE__]["DBFILE"]}\" &";
            events("{$cmd}");
            shell_exec($cmd);
            WriteFileCache($file);
        }
        return null;
    }
    if (preg_match("#\\]\\s+(.+?):\\s+Cannot allocate memory#", $buffer, $re)) {
        events("ERROR ON {$re[1]} : Cannot allocate memory -> create it");
        @file_put_contents($re[1], "www." . md5(time()) . ".bv");
        squid_admin_mysql(1, "Web filtering: Cannot allocate memory", "{$buffer}");
        return null;
    }
    if (preg_match("#\\]\\s+(.+?):\\s+No such file or directory#", $buffer, $re)) {
        events("ERROR ON {$re[1]} : No such file or directory -> create it");
        @file_put_contents($re[1], "www.nodomain.bv");
        return null;
    }
    if (strpos($buffer, "ERROR: Going into emergency mode") > 0) {
        events("ERROR: Going into emergency mode");
        squid_admin_mysql(1, "Web filtering: turn to emergency mode", "{$buffer}\nPlease contact your support to fix this problem\ncurrently, no filtering urls will be enabled");
        send_email_events("squidguard: squidguard turn to emergency mode", "SquidGuard claim\n{$buffer}\nPlease contact your support to fix this problem\ncurrently, no filtering urls will be enabled", "proxy");
        return;
    }
    events("Not filtered: {$buffer}");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:54,代码来源:exec.squidguard-tail.php

示例7: build

function build($uri)
{
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $unix = new unix();
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        die;
    }
    @file_put_contents($pidfile, getmypid());
    $echo = $unix->find_program("echo");
    $curl = $unix->find_program("curl");
    $squidbin = $unix->LOCATE_SQUID_BIN();
    $curl = $unix->find_program("curl");
    @unlink("/var/log/squid/request.debug");
    $DirFinal = "/usr/share/artica-postfix/ressources/support/" . time();
    @mkdir($DirFinal, 0755, true);
    $SquidMgrListenPort = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidMgrListenPort"));
    shell_exec("{$echo} \"Proxy address 127.0.0.1:{$SquidMgrListenPort}\" > /var/log/squid/request.debug 2>&1");
    shell_exec("{$echo} \"Url to test: {$uri} \" >> /var/log/squid/request.debug 2>&1");
    progress("{rotate_logs_files}", 30);
    shell_exec("{$echo} \"Rotate & turn to debug... \" >> /var/log/squid/request.debug 2>&1");
    @copy("/var/log/squid/access.log", "/var/log/squid/access.log." . time());
    shell_exec("{$squidbin} -k rotate >> /var/log/squid/request.debug 2>&1");
    progress("{turn_to_debug}", 35);
    shell_exec("{$squidbin} -k debug >/dev/null 2>&1");
    sleep(4);
    progress("{send_query}", 40);
    $cmd = "{$curl} --head --verbose --trace-time --proxy http://127.0.0.1:{$SquidMgrListenPort} --url {$uri} >> /var/log/squid/request.debug 2>&1";
    shell_exec("{$echo} \"{$cmd}\" >> /var/log/squid/request.debug 2>&1");
    shell_exec($cmd);
    sleep(4);
    progress("{return_back_to_normal}", 40);
    LogsThisDebug("************************************************************");
    squid_admin_mysql(1, "Reconfiguring proxy service", null, __FILE__, __LINE__);
    shell_exec("/etc/init.d/squid reload --script=" . basename(__FILE__) . "  >> /var/log/squid/request.debug 2>&1");
    LogsThisDebug("************************************************************");
    sleep(1);
    @copy("/var/log/squid/cache.log", "{$DirFinal}/cache.log");
    progress("{compressing_package}", 90);
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    $filename = "request.tar.gz";
    @unlink("/usr/share/artica-postfix/ressources/support/{$filename}");
    @copy("/var/log/squid/request.debug", "{$DirFinal}/request.debug");
    @unlink("/var/log/squid/request.debug");
    chdir($DirFinal);
    $cmd = "{$tar} -cvzf /usr/share/artica-postfix/ressources/support/{$filename} * 2>&1";
    exec($cmd, $results);
    @chmod("/usr/share/artica-postfix/ressources/support/{$filename}", 0755);
    shell_exec("{$rm} -rf {$DirFinal}");
    LogsThisDebug("*********************************************************");
    $c = 0;
    progress("{success}", 100);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:54,代码来源:exec.request.package.php

示例8: init

function init()
{
    $unix = new unix();
    $rm = $unix->find_program("rm");
    shell_exec("{$rm} -rf /var/lib/squid/session/ssl >/dev/null 2>&1");
    @mkdir("/var/lib/squid/session/ssl", 0755, true);
    @chown("/var/lib/squid/session/ssl", "squid");
    @chgrp("/var/lib/squid/session/ssl", "squid");
    $sslcrtd_program = $unix->squid_locate_generic_bin("ssl_crtd");
    $chown = $unix->find_program("chown");
    exec("{$sslcrtd_program} -c -s /var/lib/squid/session/ssl/ssl_db 2>&1", $results);
    shell_exec("{$chown} -R squid:squid /var/lib/squid/session");
    squid_admin_mysql(1, "SSL database initialized", @implode("\n", $results), __FILE__, __LINE__);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:14,代码来源:exec.sslcrtd.flush.php

示例9: build_whitelist

function build_whitelist()
{
    build_progress_wb("{compiling}", 30);
    urlrewriteaccessdeny();
    build_progress_wb("{compiling}", 35);
    urlrewriteaccessdeny_squid();
    build_progress_wb("{compiling}", 40);
    build_blacklists();
    $unix = new unix();
    $php5 = $unix->LOCATE_PHP5_BIN();
    $squidbin = $unix->LOCATE_SQUID_BIN();
    squid_admin_mysql(2, "Reloading proxy service for whitelist domains", null, __FILE__, __LINE__);
    build_progress_wb("{reloading}", 90);
    system("{$squidbin} -k reconfigure");
    build_progress_wb("{done}", 100);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:16,代码来源:exec.ufdbgclient.whitelists.php

示例10: xfiledesc

function xfiledesc()
{
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $unix = new unix();
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        squid_admin_mysql(0, "Cannot change file descriptors (PID {$pid} already executed)", null, __FILE__, __LINE__);
        die;
    }
    @file_put_contents($pidfile, getmypid());
    $TimePid = $unix->file_time_min($pidTime);
    if ($TimePid < 5) {
        squid_admin_mysql(0, "Cannot change file descriptors ( require 5mn, current {$TimePid}mn)", null, __FILE__, __LINE__);
        die;
    }
    @unlink($pidTime);
    @file_put_contents($pidTime, time());
    $squid = new squidbee();
    $sock = new sockets();
    $sysctl = $unix->find_program("sysctl");
    $t = time();
    if (!is_numeric($squid->max_filedesc)) {
        $squid->max_filedesc = 8192;
    }
    exec("{$sysctl} -n fs.file-max", $results);
    $file_max = intval(trim(@implode("", $results)));
    $file_max_org = $file_max;
    $max_filedesc = intval($squid->max_filedesc);
    if ($max_filedesc == 0) {
        $max_filedesc = 8192;
    }
    $new_max_filedesc = $max_filedesc + 1000;
    echo "Current System: {$file_max}, Proxy {$max_filedesc}\n";
    if ($new_max_filedesc > $file_max - 100) {
        $file_max = $file_max + 1000;
        shell_exec("{$sysctl} -w fs.file-max={$file_max}");
        $unix->sysctl("fs.file-max", $file_max);
    }
    $squid->max_filedesc = $new_max_filedesc;
    $squid->SaveToLdap(true);
    $php = $unix->LOCATE_PHP5_BIN();
    shell_exec("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
    squid_admin_mysql(0, "Restarting Proxy service to increase file descriptors from {$max_filedesc}/{$file_max_org} to {$new_max_filedesc}/{$file_max}", null, __FILE__, __LINE__);
    shell_exec("/etc/init.d/squid restart --force");
}
开发者ID:articatech,项目名称:artica,代码行数:46,代码来源:exec.squid.filedescriptors.php

示例11: pgsql

function pgsql()
{
    if (extension_loaded('pgsql')) {
        return;
    }
    $unix = new unix();
    $FileTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
    if ($unix->file_time_min($FileTime) < 15) {
        return;
    }
    @unlink($FileTime);
    @file_put_contents($FileTime, time());
    squid_admin_mysql(1, "Installing missing package php5-pgsql", null, __FILE__, __LINE__);
    $unix->DEBIAN_INSTALL_PACKAGE("php5-pgsql");
    system("/usr/share/artica-postfix/exec.php.ini.php");
    system("/etc/init.d/artica-webconsole restart");
    system("/etc/init.d/artica-status restart");
}
开发者ID:articatech,项目名称:artica,代码行数:18,代码来源:exec.snmp.install.php

示例12: build_whitelist

function build_whitelist()
{
    $sock = new sockets();
    $EnableTransparent27 = intval($sock->GET_INFO("EnableTransparent27"));
    $PrivoxyEnabled = intval($sock->GET_INFO("PrivoxyEnabled"));
    build_progress_wb("{compiling}", 30);
    urlrewriteaccessdeny();
    build_progress_wb("{compiling}", 35);
    urlrewriteaccessdeny_squid();
    build_progress_wb("{compiling}", 40);
    @unlink("/var/log/squid/ufdbgclient.black.db");
    @file_put_contents("/etc/squid3/ip-blacklists.db", "#");
    @file_put_contents("/etc/squid3/www-blacklists.db", "#");
    build_blacklists(true);
    build_progress_wb("{compiling}", 50);
    $unix = new unix();
    if ($PrivoxyEnabled == 1) {
        build_progress_wb("{compiling} {APP_PRIVOXY}", 55);
        shell_exec("/etc/init.d/privoxy restart");
        build_progress_wb("{compiling} {APP_PRIVOXY} {done}", 60);
    }
    build_progress_wb("{reloading}", 65);
    system("/etc/init.d/squid reload --script=" . basename(__FILE__));
    $sock = new sockets();
    $EnableTransparent27 = intval($sock->GET_INFO("EnableTransparent27"));
    $PrivoxyEnabled = intval($sock->GET_INFO("PrivoxyEnabled"));
    if ($EnableTransparent27 == 1) {
        build_progress_wb("{reloading} NAT", 70);
        system("/etc/init.d/squid-nat reload --script=" . basename(__FILE__));
    }
    $php5 = $unix->LOCATE_PHP5_BIN();
    $squidbin = $unix->LOCATE_SQUID_BIN();
    squid_admin_mysql(2, "Reloading proxy service for whitelist domains", null, __FILE__, __LINE__);
    build_progress_wb("{reloading}", 90);
    system("{$squidbin} -k reconfigure");
    build_progress_wb("{done}", 100);
}
开发者ID:articatech,项目名称:artica,代码行数:37,代码来源:exec.ufdbgclient.whitelists.php

示例13: RestartDedicatedServices

function RestartDedicatedServices($aspid = false)
{
    $unix = new unix();
    if ($aspid) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $pid = @file_get_contents($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            echo "Starting......: " . date("H:i:s") . " RestartDedicatedServices already executed PID: {$pid} since {$time}Mn\n";
            if ($time < 120) {
                if (!$GLOBALS["FORCE"]) {
                    die;
                }
            }
            unix_system_kill_force($pid);
        }
        @file_put_contents($pidfile, getmypid());
    }
    $nohup = $unix->find_program("nohup");
    $php = $unix->LOCATE_PHP5_BIN();
    $squidbin = $unix->LOCATE_SQUID_BIN();
    $unix->THREAD_COMMAND_SET("{$php} /usr/share/artica-postfix/exec.web-community-filter.php --register");
    events("Starting artica");
    echo "Starting......: " . date("H:i:s") . " nightly builds starting artica...\n";
    @file_put_contents("/usr/share/artica-postfix/download_progress", 45);
    system("/etc/init.d/artica-postfix start");
    echo "Starting......: " . date("H:i:s") . " nightly builds building init scripts\n";
    @file_put_contents("/usr/share/artica-postfix/download_progress", 50);
    system("{$php} /usr/share/artica-postfix/exec.initslapd.php --force >/dev/null 2>&1");
    echo "Starting......: " . date("H:i:s") . " nightly builds updating network\n";
    @file_put_contents("/usr/share/artica-postfix/download_progress", 55);
    system("{$php} /usr/share/artica-postfix/exec.virtuals-ip.php >/dev/null 2>&1");
    system("{$php} /usr/share/artica-postfix/exec.monit.php --build >/dev/null 2>&1");
    echo "Starting......: " . date("H:i:s") . " nightly builds purge and clean....\n";
    @file_put_contents("/usr/share/artica-postfix/download_progress", 60);
    shell_exec("{$nohup} /etc/init.d/slapd start >/dev/null 2>&1 &");
    shell_exec("{$nohup} /etc/init.d/artica-webconsole start >/dev/null 2>&1 &");
    if (is_file("/etc/init.d/nginx")) {
        shell_exec("{$nohup} /etc/init.d/nginx reload >/dev/null 2>&1 &");
    }
    shell_exec("{$nohup} /etc/init.d/auth-tail restart >/dev/null 2>&1 &");
    shell_exec("{$nohup} /etc/init.d/artica-framework restart >/dev/null 2>&1 &");
    shell_exec("{$nohup} /usr/share/artica-postfix/bin/process1 -perm >/dev/null 2>&1 &");
    shell_exec("{$nohup} /usr/share/artica-postfix/bin/artica-make --empty-cache >/dev/null 2>&1 &");
    shell_exec("{$nohup} /etc/init.d/monit restart >/dev/null 2>&1 &");
    shell_exec("{$nohup} /etc/init.d/artica-status restart --force >/dev/null 2>&1 &");
    shell_exec("{$nohup} {$php} /usr/share/artica-postfix/exec.squid.php --build-schedules >/dev/null 2>&1 &");
    shell_exec("{$nohup} {$php} /usr/share/artica-postfix/exec.schedules.php --defaults >/dev/null 2>&1 &");
    if (is_file($squidbin)) {
        squid_admin_mysql(1, "Reconfiguring proxy service", null, __FILE__, __LINE__);
        $cmd = "/etc/init.d/squid reload --script=" . basename(__FILE__) . " >/dev/null 2>&1 &";
        shell_exec($cmd);
    }
    events("done");
    @file_put_contents("/usr/share/artica-postfix/download_progress", 100);
    echo "Starting......: " . date("H:i:s") . " Done you can close the screen....\n";
    _artica_update_event(2, "RestartDedicatedServices(): finish", null, __FILE__, __LINE__);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:58,代码来源:exec.nightly.php

示例14: CheckDefaultSchedules

 public function CheckDefaultSchedules()
 {
     $allminutes = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59";
     if (!$this->TABLE_EXISTS('webfilters_schedules', $this->database)) {
         $sql = "CREATE TABLE `squidlogs`.`webfilters_schedules` (\n\t\t\t`ID` INT UNSIGNED AUTO_INCREMENT PRIMARY KEY ,\n\t\t\t`TimeText` VARCHAR( 128 ) NOT NULL ,\n\t\t\t`TimeDescription` VARCHAR( 128 ) NOT NULL ,\n\t\t\t`TaskType` SMALLINT( 1 ) NOT NULL ,\n\t\t\t`enabled` SMALLINT( 1 ) NOT NULL ,\n\t\t\tINDEX ( `TaskType` , `TimeDescription`,`enabled`)\n\t\t\t) ENGINE=MYISAM;";
         $this->QUERY_SQL($sql, $this->database);
         if (!$this->ok) {
             writelogs("Fatal!!! {$this->mysql_error}", __CLASS__ . "/" . __FUNCTION__, __FILE__, __LINE__);
             return;
         }
     }
     $update = false;
     $array[1] = array("TimeText" => "0 0,3,5,7,9,11,13,15,17,19,23 * * *", "TimeDescription" => "Check update each 3H");
     $array[6] = array("TimeText" => "20,40,59 * * * *", "TimeDescription" => "each 20mn");
     $array[8] = array("TimeText" => "30 5,10,15,20 * * *", "TimeDescription" => "each 5 hours");
     $array[9] = array("TimeText" => "0 3 * * *", "TimeDescription" => "each day at 03:00");
     $array[10] = array("TimeText" => "0 5 * * *", "TimeDescription" => "each day at 05:00");
     $array[11] = array("TimeText" => "0 1 * * *", "TimeDescription" => "each day at 01:00");
     $array[25] = array("TimeText" => "30 2 * * *", "TimeDescription" => "each day at 02:30");
     $array[2] = array("TimeText" => "0 * * * *", "TimeDescription" => "Each hour");
     $array[3] = array("TimeText" => "0 3 * * *", "TimeDescription" => "each day at 03:00");
     $array[15] = array("TimeText" => "0 * * * *", "TimeDescription" => "Calculate cache performance each hour");
     $array[16] = array("TimeText" => "30 5,10,15,20 * * *", "TimeDescription" => "each 5 hours");
     $array[17] = array("TimeText" => "30 * * * *", "TimeDescription" => "each 1h30");
     $array[21] = array("TimeText" => "0 2,4,6,8,10,12,14,16,18,20,22 * * *", "TimeDescription" => "Check AD server each 2H");
     $array[28] = array("TimeText" => "10,20,30,40,50 * * * *", "TimeDescription" => "check thumbnails queue each 10mn");
     $array[29] = array("TimeText" => "30 6 * * *", "TimeDescription" => "Update infected uris Each day at 06h30");
     $array[30] = array("TimeText" => "30 4 * * *", "TimeDescription" => "Update precompiled databases Each day at 04h30");
     $array[31] = array("TimeText" => "0,5,10,15,20,25,30,35,40,45,50,55 * * * *", "TimeDescription" => "Check queue requests each 5mn");
     $array[32] = array("TimeText" => "0,10,20,30,40,50 * * * *", "TimeDescription" => "Check framework requests each 10mn");
     $array[37] = array("TimeText" => "* * * * *", "TimeDescription" => "Inject into Mysql each minute");
     $array[38] = array("TimeText" => "* * * * *", "TimeDescription" => "Inject into Mysql each minute");
     $array[40] = array("TimeText" => "10 * * * *", "TimeDescription" => "Each hour +10mn");
     $array[42] = array("TimeText" => "30 4 * * *", "TimeDescription" => "Compile Toulouse databases tables Each day at 04h30");
     $array[43] = array("TimeText" => "30 3 * * *", "TimeDescription" => "Lost tables Each day at 03h30");
     $array[46] = array("TimeText" => "7,22,37,52 * * * *", "TimeDescription" => "each 15mn");
     $array[47] = array("TimeText" => "30 2 * * *", "TimeDescription" => "Daily Purge Statistics at 2h30");
     $array[51] = array("TimeText" => "30 5 * * *", "TimeDescription" => "Restart Web Filtering service each day at 05h30");
     $array[52] = array("TimeText" => "0,5,10,15,20,25,30,35,40,45,50,55 * * * *", "TimeDescription" => "Generate Proxy status each 5mn");
     $array[53] = array("TimeText" => "0 1 * * *", "TimeDescription" => "Generate Statistics, each day at 01h00");
     $array[56] = array("TimeText" => "59 23 * * *", "TimeDescription" => "each day at 23:59");
     $array[57] = array("TimeText" => "30 3 * * *", "TimeDescription" => "each day at 03:30");
     $array[60] = array("TimeText" => "0,6,11,16,21,26,31,36,41,46,51,56 * * * *", "TimeDescription" => "each 5 minutes");
     $this->tasks_disabled[6] = true;
     $this->tasks_disabled[2] = true;
     $this->tasks_disabled[9] = true;
     $this->tasks_disabled[10] = true;
     $this->tasks_disabled[11] = true;
     $this->tasks_disabled[15] = true;
     $this->tasks_disabled[16] = true;
     $this->tasks_disabled[23] = true;
     $this->tasks_disabled[25] = true;
     $this->tasks_disabled[28] = true;
     $this->tasks_disabled[34] = true;
     $this->tasks_disabled[36] = true;
     $this->tasks_disabled[40] = true;
     $this->tasks_disabled[43] = true;
     $this->tasks_disabled[44] = true;
     $this->tasks_disabled[49] = true;
     $this->tasks_disabled[50] = true;
     $this->tasks_disabled[55] = true;
     while (list($TaskType, $content) = each($array)) {
         if ($GLOBALS["VERBOSE"]) {
             echo "<strong style='color:blue'>{$TaskType}</strong>\n";
         }
         if (isset($this->tasks_disabled[$TaskType])) {
             if ($this->tasks_disabled[$TaskType]) {
                 if ($GLOBALS["VERBOSE"]) {
                     echo "<strong style='color:#d32d2d'>{$TaskType} tasks_disabled</strong>\n";
                 }
                 continue;
             }
         }
         $ligne = mysql_fetch_array($this->QUERY_SQL("SELECT ID FROM webfilters_schedules WHERE TaskType={$TaskType}"));
         if ($ligne["ID"] > 0) {
             if ($GLOBALS["VERBOSE"]) {
                 echo "<strong style='color:#d32d2d'>{$TaskType} Already saved as {$ligne["ID"]}</strong>\n";
             }
             continue;
         }
         $sql = "INSERT IGNORE INTO webfilters_schedules (TimeDescription,TimeText,TaskType,enabled) \n\t\t\t\t\tVALUES('{$content["TimeDescription"]}','{$content["TimeText"]}','{$TaskType}',1)";
         if (function_exists("squid_admin_mysql")) {
             squid_admin_mysql(1, "Task type {$TaskType} is not added into scheduler or removed [add it]", "{$content["TimeDescription"]}", __FILE__, __LINE__);
         }
         $this->QUERY_SQL($sql);
         if (!$this->ok) {
             squid_admin_mysql(1, "Task type {$TaskType} MySQL error", "{$sql}\n{$q->mysql_error}\n", __FILE__, __LINE__);
             continue;
         }
         $update = true;
     }
     if ($update) {
         $sock = new sockets();
         $sock->getFrameWork("squid.php?build-schedules=yes");
     }
 }
开发者ID:articatech,项目名称:artica,代码行数:96,代码来源:class.mysql.squid.builder.php

示例15: ucarp_down

function ucarp_down()
{
    $unix = new unix();
    $interface = $_GET["ucarp-down"];
    $master = $_GET["master"];
    $NETWORK_ALL_INTERFACES = $unix->NETWORK_ALL_INTERFACES(true);
    if (!isset($NETWORK_ALL_INTERFACES[$interface])) {
        writelogs_framework("Interface {$interface} not up [OK]", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    $nohup = $unix->find_program("nohup");
    $MN = unserialize(@file_get_contents("/usr/share/ucarp/ETH_LIST"));
    while (list($eth, $line) = each($MN)) {
        writelogs_framework("Interface {$eth} down [OK]", __FUNCTION__, __FILE__, __LINE__);
        $cmd = "{$nohup} /usr/share/ucarp/vip-eth0-down.sh >/dev/null 2>&1";
        writelogs_framework($cmd, __FUNCTION__, __FILE__, __LINE__);
        shell_exec($cmd);
        squid_admin_mysql(0, "Master [{$master}]: Ordered to shutdown {$interface} [OK]", null, __FILE__, __LINE__);
        echo "<articadatascgi>DOWN_OK</articadatascgi>";
    }
}
开发者ID:articatech,项目名称:artica,代码行数:21,代码来源:network.php


注:本文中的squid_admin_mysql函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。