2005-07-05 03:16:56 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
2012-07-17 05:40:40 +00:00
|
|
|
* Import XML dump files into the current wiki.
|
|
|
|
|
*
|
|
|
|
|
* Copyright © 2005 Brion Vibber <brion@pobox.com>
|
2014-03-20 15:45:01 +00:00
|
|
|
* https://www.mediawiki.org/
|
2005-08-02 13:35:19 +00:00
|
|
|
*
|
2005-07-05 03:16:56 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2005-08-02 13:35:19 +00:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
2005-07-05 03:16:56 +00:00
|
|
|
* (at your option) any later version.
|
2005-08-02 13:35:19 +00:00
|
|
|
*
|
2005-07-05 03:16:56 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
2005-08-02 13:35:19 +00:00
|
|
|
*
|
2005-07-05 03:16:56 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
2006-04-05 07:43:17 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-07-05 03:16:56 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @file
|
|
|
|
|
* @ingroup Maintenance
|
2005-07-05 03:16:56 +00:00
|
|
|
*/
|
|
|
|
|
|
2013-05-17 00:16:59 +00:00
|
|
|
require_once __DIR__ . '/Maintenance.php';
|
2005-07-05 03:16:56 +00:00
|
|
|
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
/**
|
2012-07-17 05:40:40 +00:00
|
|
|
* Maintenance script that imports XML dump files into the current wiki.
|
|
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup Maintenance
|
|
|
|
|
*/
|
2011-05-21 23:22:47 +00:00
|
|
|
class BackupReader extends Maintenance {
|
2012-09-14 18:57:14 +00:00
|
|
|
public $reportingInterval = 100;
|
|
|
|
|
public $pageCount = 0;
|
2013-04-18 18:48:44 +00:00
|
|
|
public $revCount = 0;
|
|
|
|
|
public $dryRun = false;
|
|
|
|
|
public $uploads = false;
|
2012-09-14 18:57:14 +00:00
|
|
|
public $imageBasePath = false;
|
2013-04-18 18:48:44 +00:00
|
|
|
public $nsFilter = false;
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2010-08-30 16:52:51 +00:00
|
|
|
function __construct() {
|
2011-05-21 23:22:47 +00:00
|
|
|
parent::__construct();
|
2014-04-23 08:53:03 +00:00
|
|
|
$gz = in_array( 'compress.zlib', stream_get_wrappers() )
|
|
|
|
|
? 'ok'
|
|
|
|
|
: '(disabled; requires PHP zlib module)';
|
|
|
|
|
$bz2 = in_array( 'compress.bzip2', stream_get_wrappers() )
|
|
|
|
|
? 'ok'
|
|
|
|
|
: '(disabled; requires PHP bzip2 module)';
|
2011-05-21 23:22:47 +00:00
|
|
|
|
|
|
|
|
$this->mDescription = <<<TEXT
|
|
|
|
|
This script reads pages from an XML file as produced from Special:Export or
|
|
|
|
|
dumpBackup.php, and saves them into the current wiki.
|
|
|
|
|
|
|
|
|
|
Compressed XML files may be read directly:
|
|
|
|
|
.gz $gz
|
|
|
|
|
.bz2 $bz2
|
|
|
|
|
.7z (if 7za executable is in PATH)
|
|
|
|
|
|
|
|
|
|
Note that for very large data sets, importDump.php may be slow; there are
|
|
|
|
|
alternate methods which can be much faster for full site restoration:
|
2014-03-20 15:45:01 +00:00
|
|
|
<https://www.mediawiki.org/wiki/Manual:Importing_XML_dumps>
|
2011-05-21 23:22:47 +00:00
|
|
|
TEXT;
|
2005-07-05 03:16:56 +00:00
|
|
|
$this->stderr = fopen( "php://stderr", "wt" );
|
2011-05-21 23:22:47 +00:00
|
|
|
$this->addOption( 'report',
|
|
|
|
|
'Report position and speed after every n pages processed', false, true );
|
2011-10-18 17:31:54 +00:00
|
|
|
$this->addOption( 'namespaces',
|
2011-05-21 23:22:47 +00:00
|
|
|
'Import only the pages from namespaces belonging to the list of ' .
|
|
|
|
|
'pipe-separated namespace names or namespace indexes', false, true );
|
2015-12-26 03:49:48 +00:00
|
|
|
$this->addOption( 'rootpage', 'Pages will be imported as subpages of the specified page',
|
|
|
|
|
false, true );
|
2011-05-21 23:22:47 +00:00
|
|
|
$this->addOption( 'dry-run', 'Parse dump without actually importing pages' );
|
|
|
|
|
$this->addOption( 'debug', 'Output extra verbose debug information' );
|
|
|
|
|
$this->addOption( 'uploads', 'Process file upload data if included (experimental)' );
|
2014-04-23 08:53:03 +00:00
|
|
|
$this->addOption(
|
|
|
|
|
'no-updates',
|
|
|
|
|
'Disable link table updates. Is faster but leaves the wiki in an inconsistent state'
|
|
|
|
|
);
|
2011-05-21 23:22:47 +00:00
|
|
|
$this->addOption( 'image-base-path', 'Import files from a specified path', false, true );
|
|
|
|
|
$this->addArg( 'file', 'Dump file to import [else use stdin]', false );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function execute() {
|
2013-04-18 18:48:44 +00:00
|
|
|
if ( wfReadOnly() ) {
|
2011-05-21 23:22:47 +00:00
|
|
|
$this->error( "Wiki is in read-only mode; you'll need to disable it for import to work.", true );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->reportingInterval = intval( $this->getOption( 'report', 100 ) );
|
2011-09-06 18:02:44 +00:00
|
|
|
if ( !$this->reportingInterval ) {
|
|
|
|
|
$this->reportingInterval = 100; // avoid division by zero
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-21 23:22:47 +00:00
|
|
|
$this->dryRun = $this->hasOption( 'dry-run' );
|
|
|
|
|
$this->uploads = $this->hasOption( 'uploads' ); // experimental!
|
|
|
|
|
if ( $this->hasOption( 'image-base-path' ) ) {
|
|
|
|
|
$this->imageBasePath = $this->getOption( 'image-base-path' );
|
|
|
|
|
}
|
|
|
|
|
if ( $this->hasOption( 'namespaces' ) ) {
|
|
|
|
|
$this->setNsfilter( explode( '|', $this->getOption( 'namespaces' ) ) );
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-18 18:48:44 +00:00
|
|
|
if ( $this->hasArg() ) {
|
2011-06-01 16:27:46 +00:00
|
|
|
$this->importFromFile( $this->getArg() );
|
2011-05-21 23:22:47 +00:00
|
|
|
} else {
|
2011-06-01 16:27:46 +00:00
|
|
|
$this->importFromStdin();
|
2011-05-21 23:22:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->output( "Done!\n" );
|
|
|
|
|
$this->output( "You might want to run rebuildrecentchanges.php to regenerate RecentChanges\n" );
|
2005-07-05 03:16:56 +00:00
|
|
|
}
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2011-03-04 18:25:21 +00:00
|
|
|
function setNsfilter( array $namespaces ) {
|
|
|
|
|
if ( count( $namespaces ) == 0 ) {
|
|
|
|
|
$this->nsFilter = false;
|
2014-04-23 18:09:13 +00:00
|
|
|
|
2011-03-04 18:25:21 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$this->nsFilter = array_unique( array_map( array( $this, 'getNsIndex' ), $namespaces ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getNsIndex( $namespace ) {
|
|
|
|
|
global $wgContLang;
|
2015-11-01 19:56:20 +00:00
|
|
|
$result = $wgContLang->getNsIndex( $namespace );
|
|
|
|
|
if ( $result !== false ) {
|
2011-03-04 18:25:21 +00:00
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
$ns = intval( $namespace );
|
|
|
|
|
if ( strval( $ns ) === $namespace && $wgContLang->getNsText( $ns ) !== false ) {
|
|
|
|
|
return $ns;
|
|
|
|
|
}
|
2011-05-21 23:22:47 +00:00
|
|
|
$this->error( "Unknown namespace text / index specified: $namespace", true );
|
2011-03-04 18:25:21 +00:00
|
|
|
}
|
|
|
|
|
|
2011-10-28 18:11:47 +00:00
|
|
|
/**
|
2014-04-17 20:48:32 +00:00
|
|
|
* @param Title|Revision $obj
|
2011-10-28 18:11:47 +00:00
|
|
|
* @return bool
|
|
|
|
|
*/
|
2011-03-04 18:25:21 +00:00
|
|
|
private function skippedNamespace( $obj ) {
|
2015-12-19 09:06:26 +00:00
|
|
|
$title = null;
|
2011-03-04 18:25:21 +00:00
|
|
|
if ( $obj instanceof Title ) {
|
2015-12-19 09:06:26 +00:00
|
|
|
$title = $obj;
|
2011-03-04 18:25:21 +00:00
|
|
|
} elseif ( $obj instanceof Revision ) {
|
2015-12-19 09:06:26 +00:00
|
|
|
$title = $obj->getTitle();
|
2011-03-04 18:25:21 +00:00
|
|
|
} elseif ( $obj instanceof WikiRevision ) {
|
2015-12-19 09:06:26 +00:00
|
|
|
$title = $obj->title;
|
2011-03-04 18:25:21 +00:00
|
|
|
} else {
|
2014-07-24 00:47:10 +00:00
|
|
|
throw new MWException( "Cannot get namespace of object in " . __METHOD__ );
|
2011-03-04 18:25:21 +00:00
|
|
|
}
|
2014-04-23 18:09:13 +00:00
|
|
|
|
2015-12-19 09:06:26 +00:00
|
|
|
if ( is_null( $title ) ) {
|
|
|
|
|
// Probably a log entry
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$ns = $title->getNamespace();
|
|
|
|
|
|
2011-03-04 18:25:21 +00:00
|
|
|
return is_array( $this->nsFilter ) && !in_array( $ns, $this->nsFilter );
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-05 03:16:56 +00:00
|
|
|
function reportPage( $page ) {
|
|
|
|
|
$this->pageCount++;
|
|
|
|
|
}
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2011-10-28 18:11:47 +00:00
|
|
|
/**
|
2014-04-17 20:48:32 +00:00
|
|
|
* @param Revision $rev
|
2011-10-28 18:11:47 +00:00
|
|
|
*/
|
2005-07-05 03:16:56 +00:00
|
|
|
function handleRevision( $rev ) {
|
|
|
|
|
$title = $rev->getTitle();
|
2010-05-22 16:50:39 +00:00
|
|
|
if ( !$title ) {
|
2005-09-24 03:44:54 +00:00
|
|
|
$this->progress( "Got bogus revision with null title!" );
|
2014-04-23 18:09:13 +00:00
|
|
|
|
2005-08-02 13:35:19 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-04 18:25:21 +00:00
|
|
|
if ( $this->skippedNamespace( $title ) ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-05 03:16:56 +00:00
|
|
|
$this->revCount++;
|
|
|
|
|
$this->report();
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2010-05-22 16:50:39 +00:00
|
|
|
if ( !$this->dryRun ) {
|
2005-07-05 03:16:56 +00:00
|
|
|
call_user_func( $this->importCallback, $rev );
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2011-10-18 17:31:54 +00:00
|
|
|
/**
|
2014-04-17 20:48:32 +00:00
|
|
|
* @param Revision $revision
|
2011-10-18 17:31:54 +00:00
|
|
|
* @return bool
|
|
|
|
|
*/
|
2008-03-07 23:14:30 +00:00
|
|
|
function handleUpload( $revision ) {
|
2010-05-22 16:50:39 +00:00
|
|
|
if ( $this->uploads ) {
|
2011-03-04 18:25:21 +00:00
|
|
|
if ( $this->skippedNamespace( $revision ) ) {
|
2014-07-21 09:32:34 +00:00
|
|
|
return false;
|
2011-03-04 18:25:21 +00:00
|
|
|
}
|
2008-03-07 23:14:30 +00:00
|
|
|
$this->uploadCount++;
|
2010-05-22 16:50:39 +00:00
|
|
|
// $this->report();
|
2008-03-07 23:14:30 +00:00
|
|
|
$this->progress( "upload: " . $revision->getFilename() );
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2010-05-22 16:50:39 +00:00
|
|
|
if ( !$this->dryRun ) {
|
2008-03-07 23:14:30 +00:00
|
|
|
// bluuuh hack
|
2010-05-22 16:50:39 +00:00
|
|
|
// call_user_func( $this->uploadCallback, $revision );
|
2015-12-31 00:07:37 +00:00
|
|
|
$dbw = $this->getDB( DB_MASTER );
|
2014-04-23 18:09:13 +00:00
|
|
|
|
2008-03-07 23:14:30 +00:00
|
|
|
return $dbw->deadlockLoop( array( $revision, 'importUpload' ) );
|
|
|
|
|
}
|
2008-03-06 07:24:29 +00:00
|
|
|
}
|
2014-07-21 09:32:34 +00:00
|
|
|
|
|
|
|
|
return false;
|
2008-03-06 07:24:29 +00:00
|
|
|
}
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2008-09-18 20:52:34 +00:00
|
|
|
function handleLogItem( $rev ) {
|
2011-03-04 18:25:21 +00:00
|
|
|
if ( $this->skippedNamespace( $rev ) ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2008-09-18 20:52:34 +00:00
|
|
|
$this->revCount++;
|
|
|
|
|
$this->report();
|
|
|
|
|
|
2010-05-22 16:50:39 +00:00
|
|
|
if ( !$this->dryRun ) {
|
2008-09-18 20:52:34 +00:00
|
|
|
call_user_func( $this->logItemCallback, $rev );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-05 03:16:56 +00:00
|
|
|
function report( $final = false ) {
|
2010-05-22 16:50:39 +00:00
|
|
|
if ( $final xor ( $this->pageCount % $this->reportingInterval == 0 ) ) {
|
2005-07-05 03:16:56 +00:00
|
|
|
$this->showReport();
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2005-07-05 03:16:56 +00:00
|
|
|
function showReport() {
|
2012-01-11 10:38:25 +00:00
|
|
|
if ( !$this->mQuiet ) {
|
2012-09-04 19:05:40 +00:00
|
|
|
$delta = microtime( true ) - $this->startTime;
|
2010-05-22 16:50:39 +00:00
|
|
|
if ( $delta ) {
|
|
|
|
|
$rate = sprintf( "%.2f", $this->pageCount / $delta );
|
|
|
|
|
$revrate = sprintf( "%.2f", $this->revCount / $delta );
|
2005-07-05 03:16:56 +00:00
|
|
|
} else {
|
|
|
|
|
$rate = '-';
|
|
|
|
|
$revrate = '-';
|
|
|
|
|
}
|
2008-09-18 21:48:55 +00:00
|
|
|
# Logs dumps don't have page tallies
|
2011-03-20 21:55:54 +00:00
|
|
|
if ( $this->pageCount ) {
|
2008-09-18 21:48:55 +00:00
|
|
|
$this->progress( "$this->pageCount ($rate pages/sec $revrate revs/sec)" );
|
2011-03-20 21:55:54 +00:00
|
|
|
} else {
|
2008-09-18 21:48:55 +00:00
|
|
|
$this->progress( "$this->revCount ($revrate revs/sec)" );
|
2011-03-20 21:55:54 +00:00
|
|
|
}
|
2005-07-05 03:16:56 +00:00
|
|
|
}
|
2011-04-20 00:12:06 +00:00
|
|
|
wfWaitForSlaves();
|
2005-07-05 03:16:56 +00:00
|
|
|
}
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2005-07-05 03:16:56 +00:00
|
|
|
function progress( $string ) {
|
|
|
|
|
fwrite( $this->stderr, $string . "\n" );
|
|
|
|
|
}
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2005-07-05 03:16:56 +00:00
|
|
|
function importFromFile( $filename ) {
|
2010-05-22 16:50:39 +00:00
|
|
|
if ( preg_match( '/\.gz$/', $filename ) ) {
|
2005-07-05 03:16:56 +00:00
|
|
|
$filename = 'compress.zlib://' . $filename;
|
2011-10-28 18:11:47 +00:00
|
|
|
} elseif ( preg_match( '/\.bz2$/', $filename ) ) {
|
2009-08-07 00:53:21 +00:00
|
|
|
$filename = 'compress.bzip2://' . $filename;
|
2011-10-28 18:11:47 +00:00
|
|
|
} elseif ( preg_match( '/\.7z$/', $filename ) ) {
|
2009-08-07 00:53:21 +00:00
|
|
|
$filename = 'mediawiki.compress.7z://' . $filename;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-04 15:04:41 +00:00
|
|
|
$file = fopen( $filename, 'rt' );
|
2014-04-23 18:09:13 +00:00
|
|
|
|
2005-09-17 11:10:15 +00:00
|
|
|
return $this->importFromHandle( $file );
|
2005-07-05 03:16:56 +00:00
|
|
|
}
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2005-07-05 03:16:56 +00:00
|
|
|
function importFromStdin() {
|
|
|
|
|
$file = fopen( 'php://stdin', 'rt' );
|
2013-04-18 18:48:44 +00:00
|
|
|
if ( self::posix_isatty( $file ) ) {
|
2011-05-21 23:22:47 +00:00
|
|
|
$this->maybeHelp( true );
|
2011-02-08 23:45:16 +00:00
|
|
|
}
|
2014-04-23 18:09:13 +00:00
|
|
|
|
2005-09-17 11:10:15 +00:00
|
|
|
return $this->importFromHandle( $file );
|
2005-07-05 03:16:56 +00:00
|
|
|
}
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2005-07-05 03:16:56 +00:00
|
|
|
function importFromHandle( $handle ) {
|
2012-09-04 19:05:40 +00:00
|
|
|
$this->startTime = microtime( true );
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2005-07-05 03:16:56 +00:00
|
|
|
$source = new ImportStreamSource( $handle );
|
2014-08-23 07:40:00 +00:00
|
|
|
$importer = new WikiImporter( $source, $this->getConfig() );
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2013-04-18 18:48:44 +00:00
|
|
|
if ( $this->hasOption( 'debug' ) ) {
|
2011-05-21 23:22:47 +00:00
|
|
|
$importer->setDebug( true );
|
|
|
|
|
}
|
2011-08-02 14:05:01 +00:00
|
|
|
if ( $this->hasOption( 'no-updates' ) ) {
|
|
|
|
|
$importer->setNoUpdates( true );
|
|
|
|
|
}
|
2015-12-26 03:49:48 +00:00
|
|
|
if ( $this->hasOption( 'rootpage' ) ) {
|
|
|
|
|
$statusRootPage = $importer->setTargetRootPage( $this->getOption( 'rootpage' ) );
|
|
|
|
|
if ( !$statusRootPage->isGood() ) {
|
|
|
|
|
// Die here so that it doesn't print "Done!"
|
|
|
|
|
$this->error( $statusRootPage->getMessage()->text(), 1 );
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-07-05 03:16:56 +00:00
|
|
|
$importer->setPageCallback( array( &$this, 'reportPage' ) );
|
2013-04-13 11:36:24 +00:00
|
|
|
$this->importCallback = $importer->setRevisionCallback(
|
2005-07-05 03:16:56 +00:00
|
|
|
array( &$this, 'handleRevision' ) );
|
2008-03-06 07:24:29 +00:00
|
|
|
$this->uploadCallback = $importer->setUploadCallback(
|
|
|
|
|
array( &$this, 'handleUpload' ) );
|
2008-09-18 20:52:34 +00:00
|
|
|
$this->logItemCallback = $importer->setLogItemCallback(
|
|
|
|
|
array( &$this, 'handleLogItem' ) );
|
2011-05-15 10:39:15 +00:00
|
|
|
if ( $this->uploads ) {
|
|
|
|
|
$importer->setImportUploads( true );
|
|
|
|
|
}
|
|
|
|
|
if ( $this->imageBasePath ) {
|
|
|
|
|
$importer->setImageBasePath( $this->imageBasePath );
|
|
|
|
|
}
|
2010-12-04 03:20:14 +00:00
|
|
|
|
2010-06-25 21:03:48 +00:00
|
|
|
if ( $this->dryRun ) {
|
|
|
|
|
$importer->setPageOutCallback( null );
|
|
|
|
|
}
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2005-09-17 11:10:15 +00:00
|
|
|
return $importer->doImport();
|
2005-07-05 03:16:56 +00:00
|
|
|
}
|
2005-09-17 11:10:15 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-21 23:22:47 +00:00
|
|
|
$maintClass = 'BackupReader';
|
2013-05-07 23:00:15 +00:00
|
|
|
require_once RUN_MAINTENANCE_IF_MAIN;
|