예제 #1
0
    }
    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();
}