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


PHP perform函数代码示例

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


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

示例1: perform

    function perform()
    {
        if ($_REQUEST['report_id'] == 1) {
            // make my report table header...
            echo '<table id= "questionTable">
			<tr>
				<th>Hour Begin TO End</th>
				<th>Question Count</th>
				<th>Percentage</th>
			</tr>';
            // get my report table data...
            $i = 0;
            $count = array();
            $percentage = array();
            echo '<tbody';
            foreach ($reports as $report) {
                $nextHour = $report["hour_begin"] + 1;
                if ($nextHour == 13) {
                    $nextHour = 1;
                }
                echo '<tr>' . '<td>' . $report["hour_begin"] . ' TO ' . $nextHour . '</td>' . '<td>' . ($report["question_count"] + 0) . '</td>' . '<td>' . round(($report["question_count"] + 0) / $numberReportQuestionCount * 100, 1) . '%' . '</td>' . '</tr>';
                $i++;
                $arrayCount = $i;
                $count[$arrayCount] = $report["question_count"];
                $percentage[$arrayCount] = round(($report["question_count"] + 0) / $numberReportQuestionCount * 100, 1);
            }
            echo '</tbody>';
            // total report summary
            $questionSum = array_sum($count);
            $questionPercentage = array_sum($percentage);
            echo '<tr>' . '<td><strong>Totals</strong>' . '<td><strong>' . $questionSum . '</strong></td>' . '<td><strong>' . $questionPercentage . '%' . '</strong></td>' . '</tr></table></div></div>';
        }
        return perform();
    }
开发者ID:ncpltechnology,项目名称:libstats,代码行数:34,代码来源:ReportQuestionByDate.php

示例2: iScrollToTheTop

 /**
  * @Given /^I scroll to the top$/
  */
 public function iScrollToTheTop()
 {
     $driver = $this->getSession()->getDriver();
     // Wait two seconds for admin menu if using js.
     if ($driver instanceof Selenium2Driver) {
         $element = $driver . findElement(By . id("header"));
         $actions = new Actions($driver);
         $actions . moveToElement($element);
         // actions.click();
         $actions . perform();
     }
 }
开发者ID:Code4SA,项目名称:dkan-drops-7,代码行数:15,代码来源:FeatureContext.php

示例3: startServer

function startServer($data)
{
    // if the content-type is json, start loading
    if ($_SERVER['CONTENT_TYPE'] == "application/json" || $_SERVER['CONTENT_TYPE'] == "application/json; charset=UTF-8") {
        // open connection to database
        $con = establishConnection();
        $jsonObject = json_decode($data);
        // create JSON-String and return it to the client
        echo json_encode(perform($jsonObject));
        // close connection to database
        closeConnection($con);
        // else send a warning
    } else {
        $error = new Statusmessage();
        $error->addFailure("Wrong content-type. Content-Type: application/json expected!");
        echo json_encode($error);
    }
}
开发者ID:nuzil,项目名称:101repo,代码行数:18,代码来源:connection.php

示例4: execute

function execute()
{
    if ($GLOBALS["VERBOSE"]) {
        echo "Loading...\n";
    }
    $unix = new unix();
    if ($GLOBALS["VERBOSE"]) {
        "echo Loading done...\n";
    }
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pid = @file_get_contents($pidfile);
    if (!$GLOBALS["FORCE"]) {
        if ($pid < 100) {
            $pid = null;
        }
        $unix = new unix();
        if ($unix->process_exists($pid, basename(__FILE__))) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Already executed pid {$pid}\n";
            }
            return;
        }
        $timeexec = $unix->file_time_min($timefile);
        if ($timeexec < 1440) {
            if ($GLOBALS["VERBOSE"]) {
                echo "{$timeexec} <>1440...\n";
            }
            return;
        }
        $mypid = getmypid();
        @file_put_contents($pidfile, $mypid);
    }
    @file_put_contents($timefile, time());
    $q = new mysql_squid_builder();
    $sql = "SELECT DATE_FORMAT(zDate,'%Y%m%d') AS `suffix`, DATE_FORMAT(zDate,'%Y-%m-%d') AS `zDay`,`tablename`\n\t\tFROM tables_day WHERE zDate<DATE_SUB(NOW(),INTERVAL 2 DAY)\n\t\tORDER BY zDate DESC";
    $q = new mysql_squid_builder();
    if (!CheckTable()) {
        if ($GLOBALS['VERBOSE']) {
            echo "Fatal generic_categories, no such table\n";
        }
        @unlink($timefile);
        ufdbguard_admin_events("Fatal generic_categories, no such table", __FUNCTION__, __FILE__, __LINE__, "stats");
        return;
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "{$sql}\n";
    }
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        @unlink($timefile);
        ufdbguard_admin_events("Fatal {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "stats");
        die;
    }
    if (mysql_num_rows($results) == 0) {
        @unlink($timefile);
        return;
    }
    $q->QUERY_SQL("TRUNCATE TABLE `generic_categories`");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $table_source = "{$ligne["suffix"]}_hour";
        if (!$q->TABLE_EXISTS($table_source)) {
            if ($GLOBALS['VERBOSE']) {
                echo "{$table_source}, no such table\n";
            }
            continue;
        }
        perform($table_source, $ligne["zDay"]);
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:70,代码来源:exec.squid.stats.global.categories.php

示例5: usersMenus

<?php
	include_once('ressources/class.templates.inc');
	include_once('ressources/class.ldap.inc');
	include_once('ressources/class.users.menus.inc');
	include_once("ressources/class.os.system.inc");
	include_once("ressources/class.lvm.org.inc");
	
	$user=new usersMenus();
	if(!$user->AsSystemAdministrator){echo "alert('no privileges');";die();}
	if(isset($_GET["popup"])){popup();exit;}
	if(isset($_POST["dev"])){perform();exit;}
	if(isset($_GET["GetLogs"])){GetLogs();exit;}
js();


function js(){
	$page=CurrentPageName();
	header("content-type: application/x-javascript");
	$dev=$_GET["dev"];
	$devenc=urlencode($dev);
	echo "YahooWinBrowse('700','$page?popup=yes&dev=$devenc','$dev',true)";
}


function popup(){
	$page=CurrentPageName();
	$tpl=new templates();	
	$sock=new sockets();
	$fsarray=unserialize(base64_decode($sock->getFrameWork("system.php?fsarray=yes")));
	$macro_build_bigpart_warning=$tpl->javascript_parse_text('{macro_build_bigpart_warning}');
	$devenc=urlencode($_GET["dev"]);
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:31,代码来源:system.internal.disks.BuildBigPartition.php

示例6: reboot_js

    exit;
}
if (isset($_GET["restart-js"])) {
    reboot_js();
    exit;
}
if (isset($_GET["defrag-js"])) {
    defrag_js();
    exit;
}
if (isset($_GET["menus"])) {
    echo menus();
    exit;
}
if (isset($_GET["perform"])) {
    perform();
    exit;
}
function defrag()
{
    include_once dirname(__FILE__) . "/class.sockets.inc";
    include_once 'ressources/class.templates.inc';
    $user = new usersMenus();
    if (!$user->AsSystemAdministrator) {
        die;
    }
    $sock = new sockets();
    $DisableRebootOrShutDown = $sock->GET_INFO('DisableRebootOrShutDown');
    if ($DisableRebootOrShutDown == 1) {
        return;
    }
开发者ID:articatech,项目名称:artica,代码行数:31,代码来源:logoff.php

示例7: start

function start($xtime = 0)
{
    $unix = new unix();
    if ($GLOBALS["VERBOSE"]) {
        "echo Loading done...\n";
    }
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "Timefile = {$timefile}\n";
    }
    $pid = @file_get_contents($pidfile);
    if (!$GLOBALS["FORCE"]) {
        if ($pid < 100) {
            $pid = null;
        }
        $unix = new unix();
        if ($unix->process_exists($pid, basename(__FILE__))) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Already executed pid {$pid}\n";
            }
            return;
        }
        $timeexec = $unix->file_time_min($timefile);
        if (!$GLOBALS["SCHEDULED"]) {
            if ($timeexec < 2880) {
                return;
            }
        }
        $mypid = getmypid();
        @file_put_contents($pidfile, $mypid);
    }
    @unlink($timefile);
    @file_put_contents($timefile, time());
    build_progress("Starting refreshing...", 10);
    $sql = "SELECT tablename, familyday,DATE_FORMAT(zDate,'%Y%m%d') AS `suffix` FROM tables_day \n\t\t\tWHERE familyday=0 AND DAY(zDate)<DAY(NOW()) AND YEAR(zDate) = YEAR(NOW()) AND MONTH(zDate) = MONTH(NOW())";
    $q = new mysql_squid_builder();
    $q->CheckTables();
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
    if ($GLOBALS["VERBOSE"]) {
        echo mysql_num_rows($results) . " rows\n";
    }
    $c = 0;
    $Max = mysql_num_rows($results);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $worktable = "{$ligne["suffix"]}_visited";
        $SourceTable = "{$ligne["suffix"]}_hour";
        $desttable = "{$ligne["suffix"]}_family";
        $c++;
        $prc = $c / $Max * 100;
        $prc = round($prc);
        if ($prc > 80) {
            $prc = 80;
        }
        build_progress("Checking ...{$worktable} {$desttable}", $prc);
        if (!$q->TABLE_EXISTS($worktable)) {
            if (!$q->TABLE_EXISTS($SourceTable)) {
                $q->QUERY_SQL("UPDATE tables_day SET familyday=1 WHERE tablename='{$ligne["tablename"]}'");
                continue;
            }
            if (!repair_visited_from_sources_table($SourceTable, $worktable)) {
                continue;
            }
        }
        if (!perform($worktable, $desttable)) {
            continue;
        }
        $q->QUERY_SQL("UPDATE tables_day SET familyday=1 WHERE tablename='{$ligne["tablename"]}'");
    }
    build_progress("Calculating master table", 80);
    CONDENSED();
    build_progress("Done", 100);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:77,代码来源:exec.squid.stats.familyday.php

示例8: ord

            break;
        case 2:
            for ($y = 0, $n = 0; $y < $h; $y++) {
                for ($x = 0; $x < $w; $x += $bp, $n++) {
                    @($c = ord($d[$n]));
                    if ($r) {
                        $c = ($c & 0xf) << 4 | $c >> 4 & 0xf;
                    }
                    for ($m = 0; $m < $bp; $m++) {
                        //imagesetpixel($i, $x + ($m & ~1) + !($m % 2), $y, $c & $mask);
                        imagesetpixel($i, $x + $m, $y, $c & $mask);
                        $c >>= $bpp;
                    }
                }
            }
            break;
        default:
            $error = true;
            fprintf(STDERR, "\nERROR: MODO {$image_mode} no soportado ");
            break;
    }
    if (isset($p['transparent'])) {
        imagecolortransparent($i, $p['transparent']);
    }
    imagepng($i, $image_out, 9);
    //if (!file_exists($image_out2)) copy($image_out, $image_out2);
    echo $error ? "Error\n" : "Ok\n";
    return !$error;
}
perform('do_extract');
开发者ID:AdmiralCurtiss,项目名称:talestra,代码行数:30,代码来源:extract_image.php

示例9: mysql_squid_builder

$q = new mysql_squid_builder();
$q->CheckTables();
$results = $q->QUERY_SQL($sql);
if (!$q->ok) {
    ufdbguard_admin_events("Fatal {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "stats");
    die;
}
$COUNT = mysql_num_rows($results);
events("checking {$COUNT} items");
$c = 0;
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
    $c++;
    $table_source = "{$ligne["suffix"]}_hour";
    $prc = round($c / $COUNT * 100, 2);
    events("{$table_source} {$ligne["zDay"]} {$prc}%");
    if (perform($table_source, $ligne["zDay"])) {
        $q->QUERY_SQL("UPDATE tables_day SET wwwvisited=1 WHERE `tablename`='{$ligne["tablename"]}'");
        continue;
    }
}
familysites();
function events($text)
{
    $common = "/var/log/artica-squid-statistics.log";
    $size = @filesize($common);
    if ($size > 100000) {
        @unlink($common);
    }
    $pid = getmypid();
    $date = date("Y-m-d H:i:s");
    $h = @fopen($common, 'a');
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:31,代码来源:exec.squid.stats.days.websites.php

示例10: mysql_die

if ($perm->have_perm("user_pending")) {
    $be->box_full($t->translate("Error"), $t->translate("Access denied"));
    $auth->logout();
} else {
    if (isset($id)) {
        // Look if contact is already in table
        $columns = "*";
        $tables = "contact";
        $where = "conid='{$id}'";
        if (!$db->query("SELECT {$columns} FROM {$tables} WHERE {$where}")) {
            mysql_die($db);
        } else {
            // If contact in table ask for person
            if ($db->next_record()) {
                if ($db->f("user") == $auth->auth["uname"] || $perm->have_perm("admin")) {
                    perform($db);
                } else {
                    $be->box_full($t->translate("Error"), $t->translate("Access denied"));
                }
                // If contact is not in table
            } else {
                $be->box_full($t->translate("Error"), $t->translate("Contact") . " (ID: {$id}) " . $t->translate("does not exist") . ".");
            }
        }
    } else {
        $be->box_full($t->translate("Error"), $t->translate("No Contact ID specified"));
    }
}
?>
<!-- end content -->
开发者ID:BackupTheBerlios,项目名称:sourcecontact,代码行数:30,代码来源:peradd.php

示例11: tables_year

function tables_year()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "timefile={$timefile}\n";
    }
    $pid = @file_get_contents($pidfile);
    if (!$GLOBALS["FORCE"]) {
        if ($pid < 100) {
            $pid = null;
        }
        $unix = new unix();
        if ($unix->process_exists($pid, basename(__FILE__))) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Already executed pid {$pid}\n";
            }
            return;
        }
        $timeexec = $unix->file_time_min($timefile);
        if ($timeexec < 2880) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Only each 2880mn - current {$timeexec}mn, use --force to bypass\n";
            }
            return;
        }
        $mypid = getmypid();
        @file_put_contents($pidfile, $mypid);
    }
    @unlink($timefile);
    if ($GLOBALS["VERBOSE"]) {
        echo "Time File: {$timefile}\n";
    }
    @file_put_contents($timefile, time());
    $sql = "SELECT tablename,DATE_FORMAT(zDate,'%Y%m') AS `suffix`,\n\t\t\tDATE_FORMAT(zDate,'%Y') AS `prefix`,\n\t\t\tMONTH(`zDate`) as MONTH FROM tables_day\n\t\t\tWHERE yeardone=0 AND `zDate`< DATE_SUB(NOW(),INTERVAL 1 MONTH) ORDER BY zDate";
    $results = $GLOBALS["Q"]->QUERY_SQL($sql);
    if (mysql_num_rows($results) == 0) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Return no row...\n";
        }
        return;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $tablename = $ligne["tablename"];
        $suffix = $ligne["suffix"];
        $prefix = $ligne["prefix"];
        $MONTH = $ligne["MONTH"];
        $tablesource = "{$suffix}_month";
        $nexttable = "{$prefix}_year";
        $array[$tablesource]["NEXT"] = $nexttable;
        $array[$tablesource]["SUFFIX"] = $suffix;
        $array[$tablesource]["MONTH"] = $MONTH;
    }
    while (list($tablesource, $ligne) = each($array)) {
        $nexttable = $ligne["NEXT"];
        $suffix = $ligne["SUFFIX"];
        $MONTH = $ligne["MONTH"];
        if ($GLOBALS["VERBOSE"]) {
            echo "{$MONTH} {$tablesource} -> {$nexttable}\n";
        }
        if (!perform($tablesource, $nexttable, $MONTH)) {
            continue;
        }
        $GLOBALS["Q"]->QUERY_SQL("UPDATE tables_day SET yeardone=1 WHERE DATE_FORMAT(zDate,'%Y%m') ='{$suffix}'");
        if (system_is_overloaded()) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Overloaded\n";
            }
            @unlink($timefile);
            $php = $unix->LOCATE_PHP5_BIN();
            $unix->THREAD_COMMAND_SET($php . " " . __FILE__);
            die;
        }
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:76,代码来源:exec.squid.stats.year.php

示例12: table_year

function table_year()
{
    $q = new mysql_squid_builder();
    if (!$q->FIELD_EXISTS("tables_day", "year2")) {
        $q->QUERY_SQL("ALTER TABLE `tables_day` ADD `year2` TINYINT( 1 ) NOT NULL DEFAULT '0', ADD INDEX ( `year1` )");
    }
    $sql = "CREATE TABLE IF NOT EXISTS `alluid` (\n\t`zmd5` VARCHAR(90) NOT NULL,\n\t`zDate` DATE NOT NULL,\n\t`size` BIGINT UNSIGNED NOT NULL,\n\t`websites` BIGINT UNSIGNED NOT NULL,\n\t`uid` VARCHAR(250) NOT NULL,\n\tPRIMARY KEY (`zmd5`),\n\tKEY `zDate` (`zDate`),\n\tKEY `size` (`size`),\n\tKEY `uid` (`uid`)\n\t\n\t) ENGINE = MYISAM;";
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        return;
    }
    $sql = "SELECT tablename,DATE_FORMAT(zDate,'%Y-%m-%d') AS `zDate`,DATE_FORMAT(zDate,'%Y%m%d') \n\t\t\tAS `prefix` FROM tables_day WHERE year2=0 AND `zDate`< DATE_SUB(NOW(),INTERVAL 2 DAY) ORDER BY zDate";
    $results = $GLOBALS["Q"]->QUERY_SQL($sql);
    if (mysql_num_rows($results) == 0) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Return no row...\n";
        }
        return;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $tableKEY = $ligne["tablename"];
        $zDate = $ligne["zDate"];
        $prefix = $ligne["prefix"];
        $tablesource = "quotaday_{$prefix}";
        if ($GLOBALS["VERBOSE"]) {
            echo "{$tablesource}\n";
        }
        if (!perform($tablesource, $zDate)) {
            continue;
        }
        $q->QUERY_SQL("UPDATE tables_day set year2=1 WHERE tablename='{$tableKEY}'");
        if (system_is_overloaded(__FILE__)) {
            return;
        }
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:36,代码来源:exec.squid.stats.uid-month.php

示例13: tables_months

function tables_months()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "timefile={$timefile}\n";
    }
    $pid = @file_get_contents($pidfile);
    if (!$GLOBALS["FORCE"]) {
        if ($pid < 100) {
            $pid = null;
        }
        $unix = new unix();
        if ($unix->process_exists($pid, basename(__FILE__))) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Already executed pid {$pid}\n";
            }
            return;
        }
        $timeexec = $unix->file_time_min($timefile);
        if ($timeexec < 2880) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Only each 2880mn - current {$timeexec}mn, use --force to bypass\n";
            }
            return;
        }
        $mypid = getmypid();
        @file_put_contents($pidfile, $mypid);
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "Time File: {$timefile}\n";
    }
    @file_put_contents($timefile, time());
    if ($GLOBALS["VERBOSE"]) {
        echo "index_tables_day()\n";
    }
    index_tables_day();
    if (!$GLOBALS["Q"]->ifStatisticsMustBeExecuted()) {
        if ($GLOBALS["VERBOSE"]) {
            echo "This is not intended to build statistics - ifStatisticsMustBeExecuted -\n";
        }
        return;
    }
    $sql = "SELECT tablename,DATE_FORMAT(zDate,'%Y%m%d') AS `suffix`,DATE_FORMAT(zDate,'%Y%m') AS `prefix`,\n\t\t\tMONTH(`zDate`) as MONTH, DAY(`zDate`) AS DAY, YEAR(`zDate`) AS YEAR FROM tables_day\n\t\t\tWHERE monthdone=0 AND `zDate`< DATE_SUB(NOW(),INTERVAL 3 DAY) ORDER BY zDate";
    if ($GLOBALS["VERBOSE"]) {
        echo $sql . "\n";
    }
    $results = $GLOBALS["Q"]->QUERY_SQL($sql);
    if (mysql_num_rows($results) == 0) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Return no row...\n";
        }
        table_year();
        return;
    }
    if ($GLOBALS["VERBOSE"]) {
        echo mysql_num_rows($result) . " items -> start loop\n";
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $tableKEY = $ligne["tablename"];
        $suffix = $ligne["suffix"];
        $prefix = $ligne["prefix"];
        $tablesource = "{$suffix}_hour";
        $nexttable = "{$prefix}_month";
        $dayNum = $ligne["DAY"];
        if ($GLOBALS["VERBOSE"]) {
            echo "{$dayNum} {$tablesource} -> Next table: {$nexttable}\n";
        }
        if (!perform($tablesource, $nexttable, $dayNum)) {
            continue;
        }
        $GLOBALS["Q"]->QUERY_SQL("UPDATE tables_day SET monthdone=1 WHERE `tablename`='{$tableKEY}'");
    }
    table_year();
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:76,代码来源:exec.squid.stats.month.php

示例14: start

function start($xtime = 0)
{
    build_progress("Loading...", 10);
    $unix = new unix();
    if ($GLOBALS["VERBOSE"]) {
        "echo Loading done...\n";
    }
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "Timefile = {$timefile}\n";
    }
    $pid = @file_get_contents($pidfile);
    if (!$GLOBALS["FORCE"]) {
        if ($pid < 100) {
            $pid = null;
        }
        $unix = new unix();
        if ($unix->process_exists($pid, basename(__FILE__))) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Already executed pid {$pid}\n";
            }
            return;
        }
        $timeexec = $unix->file_time_min($timefile);
        if (!$GLOBALS["SCHEDULED"]) {
            if ($timeexec < 2880) {
                return;
            }
        }
        $mypid = getmypid();
        @file_put_contents($pidfile, $mypid);
    }
    if ($GLOBALS["RESTART"]) {
        REBUILD_FULL_MEMBERS();
        exit;
    }
    @unlink($timefile);
    @file_put_contents($timefile, time());
    $php = $unix->LOCATE_PHP5_BIN();
    if (!$GLOBALS["VERBOSE"]) {
        build_progress("Execute exec.squid.stats.members.hours.php {please_wait}", 20);
        $repaircmd = "{$php} /usr/share/artica-postfix/exec.squid.stats.members.hours.php --repair --verbose --force 2>&1";
        system($repaircmd);
    }
    $q = new mysql_squid_builder();
    if (!$q->FIELD_EXISTS("tables_day", "usersday")) {
        $q->QUERY_SQL("ALTER TABLE `tables_day` ADD `usersday` TINYINT( 1 ) NOT NULL DEFAULT '0', ADD INDEX ( `usersday` )");
    }
    $sql = "SELECT tablename, usersday,DATE_FORMAT(zDate,'%Y%m%d') AS `suffix` FROM tables_day \n\t\t\tWHERE usersday=0 AND DAY(zDate)<DAY(NOW()) AND YEAR(zDate) = YEAR(NOW()) AND MONTH(zDate) = MONTH(NOW())";
    $q->CheckTables();
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error;
        build_progress("MySQL error", 110);
        return;
    }
    build_progress("tables_day =  " . mysql_num_rows($results) . " rows {please_wait}", 30);
    if ($GLOBALS["VERBOSE"]) {
        echo mysql_num_rows($results) . " rows\n";
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $worktable = "{$ligne["suffix"]}_members";
        $SourceTable = "{$ligne["suffix"]}_hour";
        if (!$q->TABLE_EXISTS($worktable)) {
            continue;
        }
        $desttable = "{$ligne["suffix"]}_users";
        build_progress("{$desttable} {please_wait}", 30);
        if (!perform($worktable, $desttable)) {
            continue;
        }
        $q->QUERY_SQL("UPDATE tables_day SET usersday=1 WHERE tablename='{$ligne["tablename"]}'");
    }
    $currentdestable = date("Ymd") . "_users";
    if (!$q->CreateUsersTempTable()) {
        build_progress("CreateUsersTempTable failed", 110);
        return false;
    }
    if (!$q->CreateUsersFullTable()) {
        build_progress("CreateUsersFullTable failed", 110);
        return false;
    }
    build_progress("Empty working tables", 40);
    $q->QUERY_SQL("TRUNCATE TABLE UsersTMP");
    $q->QUERY_SQL("TRUNCATE TABLE UsersToTal");
    $LIST_TABLES_MEMBERS = $q->LIST_TABLES_MEMBERS();
    while (list($tablename, $ligne) = each($LIST_TABLES_MEMBERS)) {
        $xtime = $q->TIME_FROM_DAY_TABLE($tablename);
        $desttable = date("Ymd", $xtime) . "_users";
        build_progress("Scanning {$tablename} -> {$desttable}", 50);
        if ($desttable == $currentdestable) {
            continue;
        }
        if (!$q->TABLE_EXISTS($desttable)) {
            if (!perform($tablename, $desttable)) {
                continue;
            }
        }
        MONTH_TABLE_FROM_MEMBER_DAY($tablename);
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:exec.squid.stats.usersday.php


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