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


PHP mysql::check_storage_table方法代码示例

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


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

示例1: smtpd_client_restrictions_popup

function smtpd_client_restrictions_popup()
{
    $ou = $_GET["ou"];
    $sock = new sockets();
    $users = new usersMenus();
    $q = new mysql();
    if (!$q->TABLE_EXISTS("smptd_client_access", "artica_backup")) {
        $q->check_storage_table(true);
    }
    $sql = "SELECT `configuration` FROM smptd_client_access WHERE `ou`='{$ou}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    if (!$q->ok) {
        echo $q->mysql_error_html();
        die;
    }
    $MAIN = unserialize(base64_decode($ligne["configuration"]));
    $reject_unknown_client_hostname = $MAIN['reject_unknown_client_hostname'];
    $reject_unknown_reverse_client_hostname = $MAIN['reject_unknown_reverse_client_hostname'];
    $reject_unknown_sender_domain = $MAIN['reject_unknown_sender_domain'];
    $reject_invalid_hostname = $MAIN['reject_invalid_hostname'];
    $reject_non_fqdn_sender = $MAIN['reject_non_fqdn_sender'];
    $disable_vrfy_command = $MAIN['disable_vrfy_command'];
    $enforce_helo_restrictions = intval($MAIN['enforce_helo_restrictions']);
    if (!$users->POSTFIX_PCRE_COMPLIANCE) {
        $EnableGenericrDNSClients = 0;
        $EnableGenericrDNSClientsDisabled = 1;
        $EnableGenericrDNSClientsDisabledText = "<br><i><span style='color:#d32d2d;font-size:11px'>{EnableGenericrDNSClientsDisabledText}</span></i>";
    }
    $t = time();
    $page = CurrentPageName();
    $html = "\n\n\n\n\t\n\t<div style='font-size:30px;margin-bottom:50px'>{safety_standards}</div>\n\t<div class=explain style='font-size:18px'>{smtpd_client_restrictions_text}</div>\n\t<div id='smtpd_client_restrictions_div' style='width:98%' class=form>\n\t" . Paragraphe_switch_img("{reject_unknown_client_hostname}", "{reject_unknown_client_hostname_text}", "reject_unknown_client_hostname-{$t}", $reject_unknown_client_hostname, null, 1400) . "\n\t" . Paragraphe_switch_img("{reject_unknown_reverse_client_hostname}", "{reject_unknown_reverse_client_hostname_text}", "reject_unknown_reverse_client_hostname-{$t}", $reject_unknown_reverse_client_hostname, null, 1400) . "\n\t" . Paragraphe_switch_img("{reject_unknown_sender_domain}", "{reject_unknown_sender_domain_text}", "reject_unknown_sender_domain-{$t}", $reject_unknown_sender_domain, null, 1400) . "\n\t" . Paragraphe_switch_img("{reject_invalid_hostname}", "{reject_invalid_hostname_text}", "reject_invalid_hostname-{$t}", $reject_invalid_hostname, null, 1400) . "\n\t" . Paragraphe_switch_img("{reject_non_fqdn_sender}", "{reject_non_fqdn_sender_text}", "reject_non_fqdn_sender-{$t}", $reject_non_fqdn_sender, null, 1400) . "\n\t</table>\n\t</div>\n\n\t<div style='width:100%;text-align:right'><hr>\n\t" . button("{apply}", "Save{$t}()", 45) . "\n\t\n\t</div>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\t\n}\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ou','{$ou}');\n\t\tXHR.appendData('reject_unknown_client_hostname',document.getElementById('reject_unknown_client_hostname-{$t}').value);\n\t\tXHR.appendData('reject_unknown_reverse_client_hostname',document.getElementById('reject_unknown_reverse_client_hostname-{$t}').value);\n\t\tXHR.appendData('reject_unknown_sender_domain',document.getElementById('reject_unknown_sender_domain-{$t}').value);\n\t\tXHR.appendData('reject_invalid_hostname',document.getElementById('reject_invalid_hostname-{$t}').value);\n\t\tXHR.appendData('reject_non_fqdn_sender',document.getElementById('reject_non_fqdn_sender-{$t}').value);\n\t\tXHR.sendAndLoad('{$page}', 'GET',xSave{$t});\t\n\t}\n</script>\t\t\t\n\t";
    //smtpd_client_connection_rate_limit = 100
    //smtpd_client_recipient_rate_limit = 20
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html, "postfix.index.php");
}
开发者ID:articatech,项目名称:artica,代码行数:36,代码来源:postfix.domains.smtpd_client_restrictions.php

示例2: databases_list_fill

function databases_list_fill()
{
    $unix = new unix();
    if (system_is_overloaded(basename(__FILE__))) {
        writelogs("Overloaded system, aborting task", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    if (!$GLOBALS["FORCE"]) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $pidfileTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            writelogs("Already process {$pid} exists", __FUNCTION__, __FILE__, __LINE__);
            return;
        }
        $time = $unix->file_time_min($pidfileTime);
        if ($time < 20) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Minimal time = 20Mn (current is {$time}Mn)\n";
            }
            return;
        }
        @unlink($pidfileTime);
        @file_put_contents($pidfileTime, time());
        @file_put_contents($pidfile, getmypid());
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "databases_list_fill() executed\n";
    }
    $prefix = "INSERT IGNORE INTO mysqldbs (databasename,TableCount,dbsize) VALUES ";
    $q = new mysql();
    if (!$q->TABLE_EXISTS('mysqldbs', 'artica_backup')) {
        if ($GLOBALS["VERBOSE"]) {
            echo "check_storage_table()\n";
        }
        $q->check_storage_table(true);
    }
    eventsDB("DATABASE_LIST_SIMPLE()", __LINE__);
    $databases = $q->DATABASE_LIST_SIMPLE();
    eventsDB("DATABASE_LIST_SIMPLE() fone", __LINE__);
    eventsDB("Found " . count($databases) . " databases -> dROP mysqldbtables", __LINE__);
    $q->QUERY_SQL("DROP TABLE mysqldbtables", "artica_backup");
    eventsDB("BuildTables()...", __LINE__);
    if (!class_exists("mysql_builder")) {
        include_once dirname(__FILE__) . "/ressources/class.mysql.builder.inc";
    }
    $t = new mysql_builder();
    $t->check_mysql_dbtables();
    while (list($database, $ligne) = each($databases)) {
        eventsDB("-> databases_list_tables({$database})...", __LINE__);
        $rr = databases_list_tables($database);
        $TableCount = $rr[0];
        $Size = $rr[1];
        eventsDB("Found database `{$database}` {$TableCount} tables ({$Size})", __LINE__);
        $f[] = "('{$database}','{$TableCount}','{$Size}')";
    }
    if (count($f) > 0) {
        eventsDB("Inbjecting " . count($f) . " elements...", __LINE__);
        $q->QUERY_SQL("TRUNCATE TABLE mysqldbs", "artica_backup");
        $q->QUERY_SQL($prefix . @implode(",", $f), "artica_backup");
    }
    eventsDB("multi_databases_parse()", __LINE__);
    multi_databases_parse();
    eventsDB("multi_databases_parse() done...", __LINE__);
    @file_put_contents($pidfileTime, time());
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:66,代码来源:exec.mysql.build.php

示例3: CheckTables

function CheckTables()
{
    $q = new mysql();
    if (!$q->TABLE_EXISTS('adgroups', 'artica_backup')) {
        $sql = "CREATE TABLE `artica_backup`.`adgroups` (\n\t\t\t`gpid` BIGINT UNSIGNED NOT NULL,\n\t\t\t`groupname` VARCHAR( 128 ) NOT NULL ,\n\t\t\t PRIMARY KEY (`gpid`),\n\t\t\t KEY `groupname` (`groupname`)\n\t\t\t )";
        $q->QUERY_SQL($sql, 'artica_backup');
        if (!$q->ok) {
            writelogs("Fatal: {$q->mysql_error}", __CLASS__ . "/" . __FUNCTION__, __FILE__, __LINE__);
        }
    }
    if (!$q->TABLE_EXISTS('adusers', 'artica_backup')) {
        $sql = "CREATE TABLE IF NOT EXISTS `adusers` (\n\t\t\t\t  `gpid` BIGINT UNSIGNED NOT NULL,\n\t\t\t\t  `uid` varchar(128) NOT NULL,\n\t\t\t\t  KEY `gpid` (`gpid`),\n\t\t\t\t  KEY `uid` (`uid`)\n\t\t\t\t)";
        $q->QUERY_SQL($sql, 'artica_backup');
        if (!$q->ok) {
            writelogs("Fatal: {$q->mysql_error}", __CLASS__ . "/" . __FUNCTION__, __FILE__, __LINE__);
        }
    }
    if (!$q->TABLE_EXISTS('adgroups', 'artica_backup')) {
        return false;
    }
    if (!$q->TABLE_EXISTS('adusers', 'artica_backup')) {
        return false;
    }
    $q->check_storage_table(true);
    return true;
}
开发者ID:articatech,项目名称:artica,代码行数:26,代码来源:exec.adusers.php

示例4: transfert

    transfert();
    die;
}
$_GET["DOMAINS"] = null;
$_GET["FALSE_EMAILS"] = null;
$_GET["EMAILS"] = null;
include_once dirname(__FILE__) . '/framework/frame.class.inc';
if (posix_getuid() != 0) {
    die("Cannot be used in web server mode\n\n");
}
if (!Build_pid_func(__FILE__, "MAIN")) {
    events(basename(__FILE__) . " Already executed.. aborting the process");
    die;
}
$q = new mysql();
$q->check_storage_table(true);
$sock = new sockets();
if ($sock->GET_INFO("KeepArticaMysqlError") != 1) {
    DeleteMysqlError();
}
$quarantine_dir = "/tmp/savemail";
@mkdir("{$quarantine_dir}");
@chmod("{$quarantine_dir}", 0777);
$files = DirList($quarantine_dir);
$count = 0;
$pid = getmypid();
$max = count($files);
$date1 = date('H:i:s');
if (count($files) > 0) {
    events("Processing " . count($files) . " files in {$quarantine_dir}");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:exec.mailbackup.php

示例5: transfert

    transfert();
    die;
}
$_GET["DOMAINS"] = null;
$_GET["FALSE_EMAILS"] = null;
$_GET["EMAILS"] = null;
include_once dirname(__FILE__) . '/framework/frame.class.inc';
if (posix_getuid() != 0) {
    die("Cannot be used in web server mode\n\n");
}
if (!Build_pid_func(__FILE__, "MAIN")) {
    events(basename(__FILE__) . " Already executed.. aborting the process");
    die;
}
$q = new mysql();
$q->check_storage_table();
$sock = new sockets();
if ($sock->GET_INFO("KeepArticaMysqlError") != 1) {
    DeleteMysqlError();
}
$quarantine_dir = "/tmp/savemail";
@mkdir("{$quarantine_dir}");
@chmod("{$quarantine_dir}", 0777);
$files = DirList($quarantine_dir);
$count = 0;
$pid = getmypid();
$max = count($files);
$date1 = date('H:i:s');
events("Processing " . count($files) . " files in {$quarantine_dir}");
while (list($num, $file) = each($files)) {
    events("################################################################### {$count}/{$max})");
开发者ID:,项目名称:,代码行数:31,代码来源:

示例6: table_list

function table_list()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql();
    $fontsize = "22px";
    $cs = 0;
    $page = 1;
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $_POST["query"] = trim($_POST["query"]);
    $FORCE = 1;
    $search = '%';
    $table = "philesight";
    if ($_GET["dev"] != null) {
        $FORCE = " ((partition='{$_GET["dev"]}') OR (hd='{$_GET["dev"]}'))";
    }
    $page = 1;
    if (!$q->TABLE_EXISTS($table, "artica_backup")) {
        $q->check_storage_table();
    }
    if (!$q->TABLE_EXISTS($table, "artica_backup")) {
        json_error_show("{$table} no such table", 1);
    }
    $total = 0;
    if ($q->COUNT_ROWS($table, "artica_backup") == 0) {
        json_error_show("no data", 1);
    }
    $searchstring = string_to_flexquery();
    if ($searchstring != null) {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE}  {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        if (!$q->ok) {
            if (preg_match("#marked as crashed#", $q->mysql_error)) {
                $q->QUERY_SQL("DROP TABLE `{$table}`", "artica_events");
            }
        }
        $total = $ligne["TCOUNT"];
    } else {
        $total = $q->COUNT_ROWS($table, "artica_backup");
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    $sql = "SELECT *  FROM `{$table}` WHERE {$FORCE} {$searchstring} {$ORDER} {$limitSql}";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        if (preg_match("#marked as crashed#", $q->mysql_error)) {
            $q->QUERY_SQL("DROP TABLE `{$table}`", "artica_events");
        }
    }
    if (!$q->ok) {
        json_error_show($q->mysql_error . "<br>{$sql}", 0);
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    $CurrentPage = CurrentPageName();
    if (mysql_num_rows($results) == 0) {
        json_error_show("no data");
    }
    $uuid = urlencode($_GET["uuid"]);
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $color = "black";
        $icon = "&nbsp;";
        $directory = $ligne["directory"];
        $md5 = md5($directory);
        $partition = $ligne["partition"];
        $hd = $ligne["hd"];
        $maxtime = $ligne["maxtime"];
        $lastscan = $ligne["lastscan"];
        $USED = $ligne["USED"];
        $FREEMB = $ligne["FREEMB"];
        if ($lastscan > 0) {
            $lastscan = date("Y-m-d H:i:s", $lastscan);
        }
        if ($ligne["enabled"] == 0) {
            $color = "#8a8a8a";
        }
        $FREEMB = FormatBytes($FREEMB * 1024);
        $directoryenc = urlencode($directory);
        $jslink = "<a href=\"javascript:blur();\" \n\t\tOnClick=\"javascript:Loadjs('{$MyPage}?directory-js=yes&directory={$directoryenc}');\" \n\t\tstyle='font-size:{$fontsize};text-decoration:underline;color:{$color}'>";
        $distance = $tpl->_ENGINE_parse_body(distanceOfTimeInWords($ligne["lastscan"], time(), true));
//.........这里部分代码省略.........
开发者ID:articatech,项目名称:artica,代码行数:101,代码来源:system.folders.monitor.php

示例7: tabs

function tabs()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $q = new mysql();
    $database = $_GET["database"];
    if (!is_numeric($_GET["instance-id"])) {
        $_GET["instance-id"] = 0;
    }
    $instance_id = $_GET["instance-id"];
    $array["params"] = "{backup_parameters}";
    if (!$q->TABLE_EXISTS("mysqldb_backup_containers", "artica_backup")) {
        $q->check_storage_table(true);
    }
    if (!$q->TABLE_EXISTS("mysqldb_backup_containers", "artica_backup")) {
        echo "mysqldb_backup_containers no such table....\n";
    }
    $md5 = md5("{$database}{$instance_id}");
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(*) as tcount FROM mysqldb_backup_containers WHERE `md5`='{$md5}'", "artica_backup"));
    if (!$q->ok) {
        echo $q->mysql_error . "<hr>";
    }
    if ($ligne["tcount"] > 0) {
        $array["containers"] = "{$ligne["tcount"]} {containers}";
    }
    while (list($num, $ligne) = each($array)) {
        $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes&instance-id={$_GET["instance-id"]}&database={$database}\"><span style='font-size:14px'>{$ligne}</span></a></li>\n");
    }
    echo "\n\t<div id=main_config_mysql_backup style='width:100%;font-size:14px'>\n\t\t<ul>" . implode("\n", $html) . "</ul>\n\t</div>\n\t\t<script>\n\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\$('#main_config_mysql_backup').tabs();\n\t\t\t\t});\n\t\t</script>";
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:30,代码来源:mysql.db.backup.php

示例8: nmap_scan_results


//.........这里部分代码省略.........
        $c++;
        $already[$mac] = true;
        $ldap_ipaddr = null;
        $ComputerRealName = null;
        $uid = null;
        $RAISON = array();
        if (!isset($array["HOSTNAME"])) {
            $array["HOSTNAME"] = null;
        }
        if (!isset($array["OS"])) {
            $array["OS"] = null;
        }
        if (!isset($array["RUNNING"])) {
            $array["RUNNING"] = null;
        }
        if (!isset($array["MACHINE_TYPE"])) {
            $array["MACHINE_TYPE"] = null;
        }
        $date = date('Y-m-d H:i:s');
        $infos = addslashes($array["OS"] . " Type:{$array["MACHINE_TYPE"]} ");
        $SQLAD[] = "('{$mac}','{$date}','{$ipaddr}','{$array["HOSTNAME"]}','{$infos}')";
        $cmp = new computers(null);
        $uid = $cmp->ComputerIDFromMAC($mac);
        if ($uid != null) {
            if ($GLOBALS["VERBOSE"]) {
                echo "{$mac} = {$uid}\n";
            }
            $cmp = new computers($uid);
            $ldap_ipaddr = $cmp->ComputerIP;
            $ComputerRealName = $cmp->ComputerRealName;
            if ($GLOBALS["VERBOSE"]) {
                echo "{$mac} = {$uid}\nLDAP:{$ldap_ipaddr}<>NMAP:{$ipaddr}\nLDAP CMP:{$ComputerRealName}<>NMAP:{$array["HOSTNAME"]}";
            }
            if ($array["HOSTNAME"] != null) {
                $EXPECTED_UID = strtoupper($array["HOSTNAME"]) . "\$";
                if ($EXPECTED_UID != $uid) {
                    $RAISON[] = "UID: {$uid} is different from {$EXPECTED_UID}";
                    nmap_logs("EDIT UID: {$mac}:[{$array["HOSTNAME"]}] ({$ipaddr})", @implode("\n", $array) . "\n" . @implode("\n", $RAISON), $uid);
                    $cmp->update_uid($EXPECTED_UID);
                }
            }
            if ($ldap_ipaddr != $ipaddr) {
                writelogs("Change {$ldap_ipaddr} -> to {$ipaddr} for  {$cmp->uid}", __FUNCTION__, __FILE__, __LINE__);
                $RAISON[] = "LDAP IP ADDR: {$ldap_ipaddr} is different from {$ipaddr}";
                $RAISON[] = "DN: {$cmp->dn}";
                $RAISON[] = "UID: {$cmp->uid}";
                $RAISON[] = "MAC: {$cmp->ComputerMacAddress}";
                if (!$cmp->update_ipaddr($ipaddr)) {
                    $RAISON[] = "ERROR:{$cmp->ldap_last_error}";
                }
                nmap_logs("EDIT IP: {$mac}:[{$array["HOSTNAME"]}] ({$ipaddr})", @implode("\n", $array) . "\n" . @implode("\n", $RAISON), $uid);
            }
            if ($array["OS"] != null) {
                if (strtolower($cmp->ComputerOS == "Unknown")) {
                    $cmp->ComputerOS = null;
                }
                if ($cmp->ComputerOS == null) {
                    $RAISON[] = "LDAP OS: {$cmp->ComputerOS} is different from {$array["OS"]}";
                    nmap_logs("EDIT OS: {$mac}:[{$array["HOSTNAME"]}] ({$ipaddr})", @implode("\n", $array) . "\n" . @implode("\n", $RAISON), $uid);
                    $cmp->update_OS($array["OS"]);
                }
            }
        } else {
            if ($array["HOSTNAME"] != null) {
                $uid = "{$array["HOSTNAME"]}\$";
            } else {
                continue;
            }
            nmap_logs("ADD NEW: {$mac}:[{$array["HOSTNAME"]}] ({$ipaddr})", @implode("\n", $array) . "\n" . @implode("\n", $RAISON), "{$uid}");
            $cmp = new computers();
            $cmp->ComputerIP = $ipaddr;
            $cmp->ComputerMacAddress = $mac;
            $cmp->uid = "{$uid}";
            $cmp->ComputerOS = $array["OS"];
            $cmp->ComputerRunning = $array["RUNNING"];
            $cmp->ComputerMachineType = $array["MACHINE_TYPE"];
            $cmp->Add();
        }
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "*** " . count($SQLAD) . " MYsql queries...***\n";
    }
    system_admin_events("{$c} hosts analyzed in networks", __FUNCTION__, __FILE__, __LINE__, "nmap");
    nmap_logs("{$c} hosts analyzed in networks", @file_get_contents("/etc/artica-postfix/nmap.map"), null);
    if (count($SQLAD) > 0) {
        $q = new mysql();
        $q->QUERY_SQL("DROP TABLE computers_lastscan", "artica_backup");
        $q->check_storage_table(true);
        $final = $prefix_sql . @implode(",", $SQLAD);
        if ($GLOBALS["VERBOSE"]) {
            echo "*** {$final} ***\n";
        }
        $q->QUERY_SQL($prefix_sql . @implode(",", $SQLAD), "artica_backup");
        if (!$q->ok) {
            echo $q->mysql_error . "\n";
        }
    }
    @unlink("/etc/artica-postfix/nmap.map");
    //print_r($computer);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.nmapscan.php

示例9: Scan_mysql_dirs

function Scan_mysql_dirs()
{
    $GLOBALS["INDEXED"] = 0;
    $GLOBALS["SKIPPED"] = 0;
    $GLOBALS["DIRS"] = array();
    $unix = new unix();
    $GLOBALS["omindex"] = $unix->find_program("omindex");
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid)) {
        system_admin_events("Already instance executed pid:{$olpid}", __FUNCTION__, __FILE__, __LINE__, "xapian");
        die;
    }
    @file_put_contents($pidfile, getmypid());
    $q = new mysql();
    $q->check_storage_table(true);
    $localdatabase = "/usr/share/artica-postfix/LocalDatabases";
    $nice = EXEC_NICE();
    $sql = "SELECT * FROM xapian_folders";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        system_admin_events("{$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "xapian");
        return;
    }
    $t1 = time();
    if (!is_file($GLOBALS["omindex"])) {
        system_admin_events("omindex no such binary, aborting", __FUNCTION__, __FILE__, __LINE__, "xapian");
        return;
    }
    $autofs = new autofs();
    $autofs->automounts_Browse();
    $count = 0;
    while ($ligne = mysql_fetch_assoc($results)) {
        $directory = $ligne["directory"];
        $database = "{$localdatabase}/samba." . md5($directory) . ".db";
        $depth = $ligne["depth"];
        $maxsize = $ligne["maxsize"];
        $samplsize = $ligne["sample-size"];
        $lang = $ligne["lang"];
        $WebCopyID = $ligne["WebCopyID"];
        $autmountdn = $ligne["autmountdn"];
        if ($lang == null) {
            $lang = "english";
        }
        $indexed = $ligne["indexed"];
        if (!is_numeric($samplsize)) {
            $samplsize = 512;
        }
        if (!is_numeric($maxsize)) {
            $maxsize = 60;
        }
        if (!is_numeric($depth)) {
            $depth = 0;
        }
        $BaseUrl = $directory;
        if ($WebCopyID > 0) {
            $directory = WebCopyIDDirectory($WebCopyID);
            $BaseUrl = WebCopyIDAddresses($WebCopyID) . "/";
        }
        if ($autmountdn != null) {
            if (!isset($autofs->hash_by_dn[$autmountdn])) {
                system_admin_events("Fatal.. {$autmountdn} no such connection", __FUNCTION__, __FILE__, __LINE__, "xapian");
                continue;
            }
            $autmountdn_array = $autofs->hash_by_dn[$autmountdn];
            $directory = "/automounts/{$autmountdn_array["FOLDER"]}";
            $autmountdn_infos = $autmountdn_array["INFOS"];
            if (!isset($autmountdn_infos["BROWSER_URI"])) {
                system_admin_events("Fatal.. {$autmountdn} external protocol error", __FUNCTION__, __FILE__, __LINE__, "xapian");
                continue;
            }
            $BaseUrl = $autmountdn_infos["BROWSER_URI"];
        }
        if (!is_dir($database)) {
            @mkdir($database, 0755, true);
        }
        if (!is_dir($directory)) {
            system_admin_events("{$directory}, no such directory", __FUNCTION__, __FILE__, __LINE__, "xapian");
            continue;
        }
        $t = time();
        $cmd = "{$nice}{$GLOBALS["omindex"]} -l {$depth} -s {$lang} -E {$samplsize} -m {$maxsize}M --follow -D \"{$database}\" -U \"{$BaseUrl}\" \"{$directory}\" 2>&1";
        if ($GLOBALS["VERBOSE"]) {
            echo "{$cmd}\n";
        }
        $GLOBALS["DIRS"]["{$directory}"] = true;
        $results_scan = array();
        exec($cmd, $results_scan);
        $dirRes = ParseLogs($results_scan);
        $took = $unix->distanceOfTimeInWords($t, time(), true);
        $DatabaseSize = $unix->DIRSIZE_BYTES($database);
        $count++;
        $indexed = $indexed + $dirRes[0];
        system_admin_events("scanned {$directory} took {$took} indexed:{$indexed} skipped:{$dirRes[1]}", __FUNCTION__, __FILE__, __LINE__, "xapian");
        $q->QUERY_SQL("UPDATE xapian_folders SET ScannedTime=NOW(),indexed={$indexed},DatabasePath='{$database}',DatabaseSize='{$DatabaseSize}'\n\t\n\t\tWHERE ID={$ligne["ID"]}", "artica_backup");
        if (!$q->ok) {
            system_admin_events("{$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "xapian");
        }
    }
    $took = $unix->distanceOfTimeInWords($t1, time(), true);
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.xapian.index.php


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