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


PHP mysql_squid_builder::TLSE_CONVERTION方法代码示例

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


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

示例1: ArticaUfdb

function ArticaUfdb()
{
    $DB = array();
    $unix = new unix();
    $FILEDBS = array();
    $prc = 0;
    $GLOBALS["MAIN_ARRAY"]["TLSE_PRC"] = 0;
    if ($GLOBALS["CLASS_SOCKETS"]->EnableUfdbGuard() == 0) {
        if ($GLOBALS["VERBOSE"]) {
            echo "EnableUfdbGuard report false\n";
        }
        $GLOBALS["MAIN_ARRAY"]["TLSE_ENABLED"] = 0;
    }
    if (is_file("/etc/artica-postfix/univtoulouse-global_usage")) {
        $contentF = explode("\n", @file_get_contents("/etc/artica-postfix/univtoulouse-global_usage"));
        while (list($index, $line) = each($contentF)) {
            if (preg_match("#NAME:\\s+(.+)#", $line, $re)) {
                $DB[trim($re[1])] = trim($re[1]);
            }
        }
    }
    $Dirs = $unix->dirdir("/var/lib/ftpunivtlse1fr");
    while (list($Dir, $line) = each($Dirs)) {
        if (!is_file("{$Dir}/domains.ufdb")) {
            continue;
        }
        $DB[basename($Dir)] = true;
    }
    if (count($DB) > 0) {
        $q = new mysql_squid_builder();
        $TLSE_CONVERTION = $q->TLSE_CONVERTION();
        while (list($TLSE, $line) = each($DB)) {
            $catzname = $TLSE_CONVERTION[$TLSE];
            if ($catzname == null) {
                if ($GLOBALS["VERBOSE"]) {
                    echo "Unable to understand {$TLSE}\n";
                }
                continue;
            }
            $catzname = str_replace("/", "_", $catzname);
            $FILEDBS[$catzname] = "/var/lib/ftpunivtlse1fr/{$catzname}/domains.ufdb";
            $FILEDBSC[] = "/var/lib/ftpunivtlse1fr/{$catzname}/domains";
        }
    }
    if (count($FILEDBS) > 0) {
        $c = 0;
        $MAX = count($FILEDBS);
        while (list($table, $path) = each($FILEDBS)) {
            if (!is_file($path)) {
                echo "{$path} such file\n";
                continue;
            }
            $size = @filesize($path);
            if ($size < 10) {
                continue;
            }
            $c++;
            $prc = intval($c) / intval($MAX);
            $prc = round($prc * 100);
            $GLOBALS["MAIN_ARRAY"]["TLSE_COUNT"] = $c;
            $TLSE_COUNTZ[$table]["SIZE"] = $size;
            if ($GLOBALS["VERBOSE"]) {
                echo "COUNT OF {$path}\n";
            }
            $path_db1 = dirname($path) . "/" . "domains";
            $TLSE_COUNTZ[$table]["ITEMS"] = $unix->COUNT_LINES_OF_FILE($path_db1);
            $TLSE_COUNTZ[$table]["TIME"] = filemtime($path);
        }
    }
    if ($GLOBALS["CLASS_UNIX"]->file_time_min("/etc/artica-postfix/UNIVTLSE_STAT_DB_SIZE") > 60) {
        $UNIVTLSE_STAT_DB_SIZE = $GLOBALS["CLASS_UNIX"]->DIRSIZE_KO("/var/lib/ftpunivtlse1fr");
        @unlink("/etc/artica-postfix/UNIVTLSE_STAT_DB_SIZE");
        @file_put_contents("/etc/artica-postfix/UNIVTLSE_STAT_DB_SIZE", $UNIVTLSE_STAT_DB_SIZE);
    }
    $C = 0;
    if ($GLOBALS["CLASS_UNIX"]->file_time_min("/etc/artica-postfix/UNIVTLSE_STAT_DB_ITEMS") > 60) {
        while (list($table, $path) = each($FILEDBSC)) {
            $unix = new unix();
            $C = $C + intval($unix->COUNT_LINES_OF_FILE($path));
        }
        @unlink("/etc/artica-postfix/UNIVTLSE_STAT_DB_ITEMS");
        @file_put_contents("/etc/artica-postfix/UNIVTLSE_STAT_DB_ITEMS", $C);
    }
    $STATUS = unserialize(@file_get_contents("/etc/artica-postfix/TLSE_LAST_DOWNLOAD"));
    if (!isset($STATUS["LAST_DOWNLOAD"])) {
        $STATUS["LAST_DOWNLOAD"] = array();
    }
    $GLOBALS["MAIN_ARRAY"]["TLSE_PRC"] = $prc;
    $GLOBALS["MAIN_ARRAY"]["TLSE_STAT_SIZE"] = trim(@file_get_contents("/etc/artica-postfix/UNIVTLSE_STAT_DB_SIZE"));
    $GLOBALS["MAIN_ARRAY"]["TLSE_STAT_ITEMS"] = trim(@file_get_contents("/etc/artica-postfix/UNIVTLSE_STAT_DB_ITEMS"));
    $GLOBALS["MAIN_ARRAY"]["TLSE_LAST_SINCE"] = $GLOBALS["CLASS_UNIX"]->distanceOfTimeInWords($STATUS["LAST_DOWNLOAD"]["TIME"], time());
    $GLOBALS["MAIN_ARRAY"]["TLSE_LAST_CAT"] = $STATUS["LAST_DOWNLOAD"]["CATEGORY"];
    $GLOBALS["MAIN_ARRAY"]["TLSE_LAST_SIZE"] = $STATUS["LAST_DOWNLOAD"]["SIZE"];
    $GLOBALS["MAIN_ARRAY"]["TLSE_LAST_CHECK"] = $STATUS["LAST_CHECK"];
    $GLOBALS["MAIN_ARRAY"]["TLSE_ARRAY"] = $TLSE_COUNTZ;
    if ($GLOBALS["VERBOSE"]) {
        print_r($GLOBALS["MAIN_ARRAY"]);
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:99,代码来源:exec.ufdb.databases.php

示例2: CoherenceOffiels

function CoherenceOffiels()
{
    if (!ifMustBeExecuted()) {
        WriteMyLogs("No make sense to execute this script...", __FUNCTION__, __FILE__, __LINE__);
        if ($GLOBALS["VERBOSE"]) {
            echo "No make sense to execute this script...\n";
        }
        die;
    }
    $workdir = "/var/lib/ftpunivtlse1fr";
    $unix = new unix();
    $BASE_URI = "ftp://ftp.univ-tlse1.fr/pub/reseau/cache/squidguard_contrib";
    $q = new mysql_squid_builder();
    $table = $q->TLSE_CONVERTION(true);
    $ARRAYSUM_REMOTE = GET_MD5S_REMOTE();
    while (list($database, $articacat) = each($table)) {
        $directory = str_replace("/", "_", $articacat);
        $targetdir = $workdir . "/{$database}";
        if ($GLOBALS["VERBOSE"]) {
            echo __FUNCTION__ . ":: Checking {$targetdir}/domains\n";
        }
        if (!is_file("{$targetdir}/domains")) {
            ufdbguard_admin_events("{$database} is not in disk... download it..", __FUNCTION__, __FILE__, __LINE__, "Toulouse DB");
            update_remote_file($BASE_URI, "{$database}.tar.gz", $ARRAYSUM_REMOTE["{$database}.tar.gz"]);
        }
    }
    reset($table);
    while (list($database, $articacat) = each($table)) {
        $directory = str_replace("/", "_", $articacat);
        $targetdir = $workdir . "/{$directory}";
        $sourcedir = $workdir . "/{$database}";
        @chmod($sourcedir, 0755);
        $unix->chown_func("squid", "squid", $sourcedir);
        if (!is_dir($targetdir)) {
            if ($GLOBALS["VERBOSE"]) {
                echo __FUNCTION__ . ":: Checking {$targetdir} no such directory make symbolic to {$sourcedir}\n";
            }
            shell_exec("ln -sf {$sourcedir} {$targetdir}");
        }
    }
    if (count($GLOBALS["squid_admin_mysql"])) {
        squid_admin_mysql(2, count($GLOBALS["squid_admin_mysql"]) . " Toulouse Databases updated", @implode("\n", $GLOBALS["squid_admin_mysql"]));
        unset($GLOBALS["squid_admin_mysql"]);
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:45,代码来源:exec.update.squid.tlse.php

示例3: TLSE_CONVERTION_DISK

function TLSE_CONVERTION_DISK()
{
    $unix = new unix();
    $CACHE_FILE = "/etc/artica-postfix/settings/Daemons/CurrentTLSEDbCloud";
    $WORKDIR = "/var/lib/ftpunivtlse1fr";
    $q = new mysql_squid_builder();
    $rm = $unix->find_program("rm");
    $ln = $unix->find_program("ln");
    $LOCAL_ARRAY = unserialize(@file_get_contents($CACHE_FILE));
    $countDecategories = count($LOCAL_ARRAY);
    while (list($categoryname, $MAIN) = each($LOCAL_ARRAY)) {
        $Conversion = $q->TLSE_CONVERTION();
        $categoryDISK = $categoryname;
        if (isset($Conversion[$categoryname])) {
            $categoryDISK = $Conversion[$categoryname];
        }
        $categoryDISK = str_replace("/", "_", $categoryDISK);
        if (is_link("/var/lib/ftpunivtlse1fr/{$categoryname}")) {
            echo "Source dir already linked {$categoryname} -> " . @readlink("/var/lib/ftpunivtlse1fr/{$categoryname}") . "\n";
            continue;
        }
        if (trim(strtolower($categoryDISK)) == trim(strtolower($categoryname))) {
            continue;
        }
        echo "/var/lib/ftpunivtlse1fr/{$categoryDISK} must be a symbolik link to /var/lib/ftpunivtlse1fr/{$categoryname}\n";
        if (is_link("/var/lib/ftpunivtlse1fr/{$categoryDISK}")) {
            $tmpdir = @readlink("/var/lib/ftpunivtlse1fr/{$categoryDISK}");
            echo "{$categoryDISK} is already linked to {$tmpdir}\n";
            if ($tmpdir != "/var/lib/ftpunivtlse1fr/{$categoryname}") {
                echo "remove -> {$tmpdir}\n";
                shell_exec("{$rm} -f /var/lib/ftpunivtlse1fr/{$categoryDISK}");
            }
        }
        if (!is_link("/var/lib/ftpunivtlse1fr/{$categoryDISK}")) {
            if (!is_dir("/var/lib/ftpunivtlse1fr/{$categoryname}")) {
                echo "*** failed /var/lib/ftpunivtlse1fr/{$categoryname} no such directory\n";
                continue;
            }
            echo "Linking {$categoryDISK} -> /var/lib/ftpunivtlse1fr/{$categoryname}\n";
            shell_exec("{$rm} -rf /var/lib/ftpunivtlse1fr/{$categoryDISK}");
            shell_exec("{$ln} -sf /var/lib/ftpunivtlse1fr/{$categoryname} /var/lib/ftpunivtlse1fr/{$categoryDISK}");
        }
    }
}
开发者ID:articatech,项目名称:artica,代码行数:44,代码来源:exec.squid.blacklists.php


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