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


PHP mysql_squid_builder::TablePrimaireHour方法代码示例

本文整理汇总了PHP中mysql_squid_builder::TablePrimaireHour方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql_squid_builder::TablePrimaireHour方法的具体用法?PHP mysql_squid_builder::TablePrimaireHour怎么用?PHP mysql_squid_builder::TablePrimaireHour使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mysql_squid_builder的用法示例。


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

示例1: STATS_LINE

function STATS_LINE()
{
    $sock = new sockets();
    $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance");
    if (!is_numeric($EnableWebProxyStatsAppliance)) {
        $EnableWebProxyStatsAppliance = 0;
    }
    if ($EnableWebProxyStatsAppliance == 0) {
        die;
    }
    $q = new mysql_squid_builder();
    $q->CheckTables();
    if (isset($_POST["MYSSLPORT"])) {
        writelogs($_SERVER["REMOTE_ADDR"] . ":{$_POST["MYSSLPORT"]} production server....", __FUNCTION__, __FILE__, __LINE__);
        $hostname = gethostbyaddr($_SERVER["REMOTE_ADDR"]);
        $time = date('Y-m-d H:i:s');
        $sql = "INSERT IGNORE INTO `squidservers`\n\t\t (ipaddr,hostname,port,created,udpated) \n\t\t VALUES ('{$_SERVER["REMOTE_ADDR"]}','{$hostname}','{$_POST["MYSSLPORT"]}','{$time}','{$time}')";
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT ipaddr FROM squidservers WHERE ipaddr='{$_SERVER["REMOTE_ADDR"]}'"));
        if ($ligne["ipaddr"] == null) {
            $q->QUERY_SQL($sql);
        } else {
            $q->QUERY_SQL("UPDATE `squidservers` SET udpated='{$time}' WHERE ipaddr='{$ligne["ipaddr"]}'");
        }
    } else {
        writelogs("MYSSLPORT is not set....", __FUNCTION__, __FILE__, __LINE__);
    }
    $array = unserialize(base64_decode($_POST["STATS_LINE"]));
    while (list($table, $contentArray) = each($array)) {
        if (preg_match("#squidhour_([0-9]+)#", $table, $re)) {
            $q->TablePrimaireHour($re[1]);
        }
        if (!$q->TABLE_EXISTS($table)) {
            writelogs("{$table} no such table, aborting ", __FUNCTION__, __FILE__, __LINE__);
            echo "<ANSWER>{$table} no such table</ANSWER>\n";
            die;
        }
        $prefixsql = "INSERT IGNORE INTO {$table} (`sitename`,`uri`,`TYPE`,`REASON`,`CLIENT`,`zDate`,`zMD5`,`remote_ip`,`country`,`QuerySize`,`uid`,`cached`,`MAC`,`hostname`) VALUES ";
        if (count($contentArray) > 0) {
            $sql = "{$prefixsql}" . @implode(",", $contentArray);
            $q->QUERY_SQL($sql);
            if (!$q->ok) {
                writelogs($q->mysql_error, __FUNCTION__, __FILE__, __LINE__);
                if (preg_match("#Column count doesn.+?t match#", $q->mysql_error)) {
                    continue;
                }
                echo "ERROR: {$q->mysql_error}\n";
                return;
            }
        }
    }
    writelogs("Received " . strlen($_POST["STATS_LINE"]) . " bytes " . count($array) . " lines from " . $_SERVER["REMOTE_ADDR"] . ":{$_POST["MYSSLPORT"]} (success)", __FUNCTION__, __FILE__, __LINE__);
    echo "<ANSWER>OK</ANSWER>\n";
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:53,代码来源:squid.stats.listener.php

示例2: inject_array

function inject_array($array)
{
    if ($GLOBALS["EnableRemoteStatisticsAppliance"] == 1) {
        events("Injecting -> inject_array_remote() Load:{$GLOBALS["SYSTEM_INTERNAL_LOAD"]}: on Line: " . __LINE__);
        inject_array_remote($array);
        return;
    }
    $q = new mysql_squid_builder();
    $q->CheckTables();
    if ($q->MysqlFailed) {
        events_tail("squid-injector:: Mysql connection failed, aborting.... Line: " . __LINE__);
        inject_failed($array);
    }
    while (list($table, $contentArray) = each($array)) {
        if (preg_match("#squidhour_([0-9]+)#", $table, $re)) {
            $q->TablePrimaireHour($re[1]);
        }
        $prefixsql = "INSERT IGNORE INTO {$table} (`sitename`,`uri`,`TYPE`,`REASON`,`CLIENT`,`zDate`,`zMD5`,`remote_ip`,`country`,`QuerySize`,`uid`,`cached`,`MAC`,`hostname`) VALUES ";
        $sql = "{$prefixsql}" . @implode(",", $contentArray);
        if ($GLOBALS["VERBOSE"]) {
            echo $sql . "\n";
        }
        events("inject_array::Injecting -> table `{$table}` " . count($contentArray) . " rows in line:" . __LINE__);
        $q->QUERY_SQL($sql);
        if (!$q->ok) {
            events("Fatal !!! inject_array::Injecting -> ERROR: {$q->mysql_error} : in line:" . __LINE__);
            inject_failed($array);
            return;
        }
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:31,代码来源:exec.squid-tail-injector.php

示例3: parse_tables_primaires

function parse_tables_primaires($nopid = false)
{
    $unix = new unix();
    $unix->chown_func("squid", "squid", "/var/log/squid/mysql-rttime");
    $TimePID = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
    $TimeExec = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
    if (!$nopid) {
        $pid = @file_get_contents($TimePID);
        if ($unix->process_exists($pid)) {
            $timePid = $unix->PROCCESS_TIME_MIN($pid);
            if ($timePid > 5) {
                $kill = $unix->find_program("kill");
                unix_system_kill_force($pid);
            } else {
                if ($GLOBALS["VERBOSE"]) {
                    echo "Already running PID {$pid} since {$timePid}mn";
                }
                die;
            }
        }
        @file_put_contents($TimePID, getmypid());
    }
    if (!($handle = opendir("/var/log/squid/mysql-rttime"))) {
        return;
    }
    $q = new mysql_squid_builder();
    $q->TablePrimaireHour(date("YmdH"));
    $countDeFiles = 0;
    while (false !== ($filename = readdir($handle))) {
        if ($filename == ".") {
            continue;
        }
        if ($filename == "..") {
            continue;
        }
        $filepath = "/var/log/squid/mysql-rttime/{$filename}";
        events("parse_tables_primaires():: Scanning {$filepath}");
        if (!preg_match("#^squidhour_([0-9]+)\\.#", $filename, $re)) {
            events("parse_tables_primaires():: Failed {$filepath} -> not match #^squidhour_([0-9]+)\\.");
            @unlink($filepath);
            continue;
        }
        $xtime = $re[1];
        $q->TablePrimaireHour($xtime);
        $content = unserialize(@file_get_contents($filepath));
        $contentSize = filesize($filepath) / 1024;
        $ArraySize = count($content);
        events("parse_tables_primaires():: squidhour_{$xtime} Inserting " . count($content) . " element(s)");
        if (count($content) == 0) {
            ToSyslog("parse_tables_primaires():: squidhour_{$xtime}: {$filepath} no row has been written");
            @unlink($filepath);
            continue;
        }
        $sql = "INSERT IGNORE INTO `squidhour_{$xtime}`  (`sitename`,`uri`,`TYPE`,`REASON`,`CLIENT`,`hostname`,`zDate`,`zMD5`,`uid`,`QuerySize`,`cached`,`MAC`,`category`) \n\t\tVALUES " . @implode(",", $content);
        $q->QUERY_SQL($sql);
        if (!$q->ok) {
            if ($GLOBALS["VERBOSE"]) {
                echo "\n\n ********************************************************************* \n\n{$q->mysql_error}\n*********************************************************************\n\n";
            }
            events("parse_tables_primaires(): Fatal: MySQL error:");
            if (preg_match("#Table 'squidlogs\\.(.+?)' doesn't exist#", $q->mysql_error, $re)) {
                if ($GLOBALS["VERBOSE"]) {
                    echo "Creating table: {$re[1]}\n";
                    $q->TablePrimaireHour(null, false, $re[1]);
                    $q->QUERY_SQL($sql);
                }
            }
        }
        if (!$q->ok) {
            events("parse_tables_primaires(): Fatal: MySQL error:");
            events("{$sql}");
            continue;
        }
        if ($GLOBALS["VERBOSE"]) {
            echo $filepath . " ({$contentSize} KB) done with {$ArraySize} elements...\n";
        }
        @unlink($filepath);
        $countDeFiles++;
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "{$countDeFiles} Files parsed done\n";
    }
    parse_tables_cache_primaires();
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:84,代码来源:exec.logfile_daemon-parse.php

示例4: tests

    if ($unix->file_time_min($pidTime) < 15) {
        die;
    }
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid)) {
        die;
    }
}
@unlink($pidTime);
@file_put_contents($pidTime, time());
@file_put_contents($pidfile, getmypid());
access_db();
$php5 = $unix->LOCATE_PHP5_BIN();
$xtime = time();
$q = new mysql_squid_builder();
$q->TablePrimaireHour(date("YmdH", $xtime));
$q->check_youtube_hour(date("YmdH", $xtime));
$q->check_SearchWords_hour(date("YmdH", $xtime));
$q->check_quota_hour(date("YmdH", $xtime));
$f[] = "#!/bin/sh";
$f[] = "export LC_ALL=C";
$f[] = "{$php5} " . __FILE__ . " >/dev/null 2>&1";
$f[] = "";
@file_put_contents("/etc/cron.hourly/SquidHourlyTables.sh", @implode("\n", $f));
@chmod("/etc/cron.hourly/SquidHourlyTables.sh", 0755);
unset($f);
function tests($fullpath)
{
    $berekley = new parse_berekley_dbs();
    $filename = basename($fullpath);
    preg_match("#([0-9]+)_#", $filename, $re);
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:31,代码来源:exec.squid.hourly.tables.php

示例5: inject_array

function inject_array($array)
{
    $q = new mysql_squid_builder();
    while (list($table, $contentArray) = each($array)) {
        if (preg_match("#squidhour_([0-9]+)#", $table, $re)) {
            $q->TablePrimaireHour($re[1], true);
        }
        $prefixsql = "INSERT IGNORE INTO {$table} (`sitename`,`uri`,`TYPE`,`REASON`,`CLIENT`,`zDate`,`zMD5`,`remote_ip`,`country`,`QuerySize`,`uid`,`cached`,`MAC`,`hostname`) VALUES ";
        $sql = "{$prefixsql}" . @implode(",", $contentArray);
        //if($GLOBALS["VERBOSE"]){echo $sql."\n";}
        $q->QUERY_SQL($sql);
        events("inject_array::Injecting -> table `{$table}` " . count($contentArray) . " rows affected: {$q->mysql_affected_rows} in line:" . __LINE__);
        if (!$q->ok) {
            if ($GLOBALS["FORCE"]) {
                echo "\n\n**************\n\n" . $sql . "\n**************\n";
            }
            if ($GLOBALS["VERBOSE"]) {
                echo "\n\n**************\n\n" . $sql . "\n**************\n";
            }
            events("Fatal !!! inject_array::Injecting -> ERROR: {$q->mysql_error} : in line:" . __LINE__);
            inject_failed($array);
            return;
        }
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:25,代码来源:exec.squid.logs.import.php


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