Beispiel #1
0
            if ($page_id == $curid) {
                $curid++;
            }
        }
    } else {
        if (file_exists($pages_dir . '/' . $page_key)) {
            $tmp = file($pages_dir . '/' . $page_key);
            $page_id = $tmp[0];
        } else {
            file_put_contents($pages_dir . '/' . $page_key, $curid);
            touch($pages_dir . '/' . $page_key, $mtime);
            $page_id = $curid;
            $curid++;
        }
    }
    $buffer[] = "(" . $page_id . "," . $mtime . ",'" . _escape_string($type, $user) . "'," . "'" . $ip . "','" . $ipall . "'," . $ip2long . ",'" . _escape_string($type, $comment) . "'," . $act . ")";
    if ($idx > 100) {
        dump('INSERT INTO ' . $tablename . ' (page_id, `timestamp`, user, ip, ipall, ip2long, comment, action) VALUES ' . implode(",\n", $buffer) . ";\n");
        $idx = 0;
        $buffer = array();
        if ($j % 10000 == 0) {
            endTransaction($type);
            beginTransaction($type);
        }
    }
    $idx++;
}
if (sizeof($buffer) > 0) {
    dump('INSERT INTO ' . $tablename . ' (page_id, `timestamp`, user, ip, ipall, ip2long, comment, action) VALUES ' . implode(",\n", $buffer) . ";\n");
}
endTransaction($type);
Beispiel #2
0
        continue;
    }
    print "" . $progress[$j++ % 4];
    $pagefile = $text_dir . '/' . $file;
    if (is_dir($pagefile)) {
        continue;
    }
    $mtime = filemtime($pagefile);
    if ($dumpmode) {
        $body = file_get_contents($pagefile);
    }
    $pagename = $DBInfo->keyToPagename($file);
    $idx++;
    $tmp = "('" . _escape_string($type, $pagename) . "',";
    if ($dumpmode) {
        $tmp .= "'" . _escape_string($type, $body) . "',";
    }
    $tmp .= $mtime . ")";
    $buffer[] = $tmp;
    if ($idx > 50) {
        dump('INSERT INTO ' . $tablename . ' (' . $vals . ') VALUES ' . implode(",\n", $buffer) . ";\n");
        $idx = 0;
        $buffer = array();
    }
    if ($j % 10000 == 0) {
        endTransaction($type);
        beginTransaction($type);
    }
}
if (sizeof($buffer) > 0) {
    dump('INSERT INTO ' . $tablename . ' (' . $vals . ') VALUES ' . implode(",\n", $buffer) . ";\n");
Beispiel #3
0
while (($file = readdir($handle)) !== false) {
    print "" . $progress[$j % 4];
    $j++;
    if ($file[0] == '.' || in_array($file, array('RCS', 'CVS'))) {
        continue;
    }
    $pagefile = $text_dir . '/' . $file;
    if (is_dir($pagefile)) {
        continue;
    }
    $pagename = $DBInfo->keyToPagename($file);
    $body = file_get_contents($pagefile);
    //$body = str_replace("\n", "\\n", $body);
    $mtime = filemtime($pagefile);
    $idx++;
    $buffer[] = "('" . _escape_string($type, $pagename) . "','" . _escape_string($type, $body) . "'," . $mtime . ")";
    if ($idx > 100) {
        dump('INSERT INTO ' . $tablename . ' (title,body,`mtime`) VALUES ' . implode(",\n", $buffer) . ";\n");
        $idx = 0;
        $buffer = array();
    }
}
if (sizeof($buffer) > 0) {
    dump('INSERT INTO ' . $tablename . ' (title,body,`mtime`) VALUES ' . implode(",\n", $buffer) . ";\n");
}
fclose($fp);
closedir($handle);
echo "\t", $dumpfile, ' generated', "\n";
$params['timer']->Check('done');
echo $params['timer']->Write();
// vim:et:sts=4:sw=4: