本文整理汇总了PHP中mysql_squid_builder::check_youtube_hour方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql_squid_builder::check_youtube_hour方法的具体用法?PHP mysql_squid_builder::check_youtube_hour怎么用?PHP mysql_squid_builder::check_youtube_hour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql_squid_builder
的用法示例。
在下文中一共展示了mysql_squid_builder::check_youtube_hour方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_realtime_events
function parse_realtime_events($nopid = false)
{
events("parse_realtime_events():: nopid => {$nopid}");
$unix = new unix();
$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);
events("parse_realtime_events():: Already process exists {$pid} since {$timePid}Mn");
if ($timePid > 10) {
$kill = $unix->find_program("kill");
events("parse_realtime_events():: Killing {$pid} running since {$timePid}Mn");
unix_system_kill_force($pid);
} else {
if ($GLOBALS["VERBOSE"]) {
echo "Already running PID {$pid} since {$timePid}mn";
}
die;
}
}
@file_put_contents($TimePID, getmypid());
}
events("parse_realtime_events():: Time File: {$TimeExec}");
@unlink($TimeExec);
@file_put_contents($TimeExec, time());
events("Wakup...");
Wakeup();
events("parse_realtime_events():: -> parse_realtime_hash()");
$GLOBALS["PARSE_SECOND_TIME"] = false;
parse_realtime_hash();
if (!$GLOBALS["PARSE_SECOND_TIME"]) {
return;
}
@mkdir("/var/log/squid/mysql-queue", 0755, true);
if (!($handle = opendir("/var/log/squid/mysql-queue"))) {
return;
}
$q = new mysql_squid_builder();
$q->check_youtube_hour(date("YmdH"));
$countDeFiles = 0;
while (false !== ($filename = readdir($handle))) {
if ($filename == ".") {
continue;
}
if ($filename == "..") {
continue;
}
$filepath = "/var/log/squid/mysql-queue/{$filename}";
if (preg_match("#^UserAutDB#", $filename)) {
$content = unserialize(@file_get_contents($filepath));
$contentSize = filesize($filepath) / 1024;
$ArraySize = count($content);
$sql = "INSERT IGNORE INTO UserAutDB (zmd5,MAC,ipaddr,uid,hostname,UserAgent) VALUES " . @implode(",", $content);
$q->QUERY_SQL($sql);
if (!$q->ok) {
echo $q->mysql_error . "\n";
} else {
if ($GLOBALS["VERBOSE"]) {
echo $filepath . " ({$contentSize} KB) done with {$ArraySize} elements...\n";
}
@unlink($filepath);
}
continue;
}
if (preg_match("#^macscan#", $filename)) {
$content = unserialize(@file_get_contents($filepath));
$contentSize = filesize($filepath) / 1024;
$ArraySize = count($content);
$sql = "INSERT IGNORE INTO `macscan` (`MAC`,`ipaddr`) VALUES " . @implode(",", $content);
$q->QUERY_SQL($sql);
if (!$q->ok) {
echo $q->mysql_error . "\n";
} else {
if ($GLOBALS["VERBOSE"]) {
echo $filepath . " ({$contentSize} KB) done with {$ArraySize} elements...\n";
}
@unlink($filepath);
}
continue;
}
if (preg_match("#^YoutubeRTT#", $filename)) {
$sql = trim(@file_get_contents($filepath));
$contentSize = strlen($sql) / 1024;
if (preg_match("#INSERT IGNORE INTO `(.+?)`#", $sql, $re)) {
$tablename = $re[1];
if (!preg_match("#youtubehours_([0-9]+)#", $tablename)) {
echo "***** replace {$tablename} to youtubehours_date(YmdH) ****\n";
$sql = str_replace($tablename, "youtubehours_" . date("YmdH"), $sql);
}
}
$q->QUERY_SQL($sql);
if (!$q->ok) {
ToSyslog("{$q->mysql_error} in line [" . __LINE__ . "]");
if (preg_match("#Table\\s+'.+?\\.youtubehours_(.+?)'\\s+doesn't exist#", $q->mysql_error, $re)) {
ToSyslog("Building youtubehours_{$re[1]} table");
$q->check_youtube_hour($re[1]);
$q->QUERY_SQL($sql);
}
//.........这里部分代码省略.........
示例2: youtube_inject
function youtube_inject($array)
{
$q = new mysql_squid_builder();
if (!is_array($array)) {
return;
}
if (count($array) == 0) {
return;
}
youtube_events("youtube_inject() array of " . count($array) . " elements...", __LINE__);
while (list($timeKey, $rows) = each($array)) {
if (count($rows) == 0) {
continue;
}
$q->check_youtube_hour($timeKey);
youtube_events("youtubehours_{$timeKey} = " . count($rows) . " elements...", __LINE__);
if (count($rows) == 1) {
youtube_events("youtubehours_{$timeKey} = '" . $rows[0] . "'", __LINE__);
}
$suffix = trim(@implode(",", $rows));
if ($suffix == null) {
youtube_events("youtubehours_{$timeKey} = suffix = null, abort", __LINE__);
continue;
}
$sql = "INSERT INTO youtubehours_{$timeKey} (zDate,ipaddr,hostname,uid,MAC,account,youtubeid) VALUES {$suffix}";
youtube_events($sql, __LINE__);
$q->QUERY_SQL($sql);
if (!$q->ok) {
youtube_events("youtubehours_{$timeKey} = {$q->mysql_error} ", __LINE__);
if ($GLOBALS["VERBOSE"]) {
echo "**** {$q->mysql_error} **** \n";
}
ufdbguard_admin_events("{$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, 'youtube');
@file_put_contents("/var/log/artica-postfix/youtube-errors/" . md5($sql), $sql);
return;
}
}
}
示例3: tests
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);
$xre = $re[1];