}
    function importFromStdin()
    {
        $file = fopen('php://stdin', 'rt');
        $this->importFromHandle($file);
    }
    function importFromHandle($handle)
    {
        $this->startTime = wfTime();
        $source = new ImportStreamSource($handle);
        $importer = new WikiImporter($source);
        $importer->setPageCallback(array(&$this, 'reportPage'));
        $this->importCallback = $importer->setRevisionCallback(array(&$this, 'handleRevision'));
        $importer->doImport();
    }
}
$reader = new BackupReader();
if (isset($options['quiet'])) {
    $reader->reporting = false;
}
if (isset($options['report'])) {
    $reader->reportingInterval = IntVal($options['report']);
}
if (isset($options['dry-run'])) {
    $reader->dryRun = true;
}
if (isset($args[0])) {
    $reader->importFromFile($args[0]);
} else {
    $reader->importFromStdin();
}
Exemple #2
0
    wfDie("Wiki is in read-only mode; you'll need to disable it for import to work.\n");
}
$reader = new BackupReader();
if (isset($options['quiet'])) {
    $reader->reporting = false;
}
if (isset($options['report'])) {
    $reader->reportingInterval = intval($options['report']);
}
if (isset($options['dry-run'])) {
    $reader->dryRun = true;
}
if (isset($options['debug'])) {
    $reader->debug = true;
}
if (isset($options['uploads'])) {
    $reader->uploads = true;
    // experimental!
}
if (isset($args[0])) {
    $result = $reader->importFromFile($args[0]);
} else {
    $result = $reader->importFromStdin();
}
if (WikiError::isError($result)) {
    echo $result->getMessage() . "\n";
} else {
    echo "Done!\n";
    echo "You might want to run rebuildrecentchanges.php to regenerate\n";
    echo "the recentchanges page.\n";
}