示例#1
0
function import_files()
{
    writelogs("Starting importing files to migrate", __FUNCTION__, __FILE__, __LINE__);
    $sql = "SELECT ID,filepath,local_domain,ou FROM mbx_migr WHERE imported=0 and finish=0";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        writelogs("{$sql} {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__);
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if (!is_file($ligne["filepath"])) {
            $sql = "UPDATE mbx_migr SET imported=1,finish=1 WHERE ID={$ligne["ID"]}";
            $q->QUERY_SQL($sql, "artica_backup");
            continue;
        }
        import_single_file($ligne["filepath"], $ligne["ID"], $ligne["ou"], $ligne["local_domain"]);
    }
}
function import_files()
{
    system_admin_events("Starting importing files to migrate", __FUNCTION__, __FILE__, __LINE__, "mbximport");
    $sql = "SELECT ID,filepath,local_domain,ou FROM mbx_migr WHERE imported=0 and finish=0";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        system_admin_events("{$sql} {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__, "mbximport");
    }
    if ($GLOBALS["VERBOSE"]) {
        echo mysql_num_rows($results) . " items...\n";
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if (!is_file($ligne["filepath"])) {
            if ($GLOBALS["VERBOSE"]) {
                echo "{$ligne["filepath"]} no such file, stamp finish\n";
            }
            $sql = "UPDATE mbx_migr SET imported=1,finish=1 WHERE ID={$ligne["ID"]}";
            $q->QUERY_SQL($sql, "artica_backup");
            continue;
        }
        import_single_file($ligne["filepath"], $ligne["ID"], $ligne["ou"], $ligne["local_domain"]);
    }
}