function __construct() {
parent::__construct();
- $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)';
+ $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)';
$this->mDescription = <<<TEXT
This script reads pages from an XML file as produced from Special:Export or
$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)' );
- $this->addOption( 'no-updates', 'Disable link table updates. Is faster but leaves the wiki in an inconsistent state' );
+ $this->addOption(
+ 'no-updates',
+ 'Disable link table updates. Is faster but leaves the wiki in an inconsistent state'
+ );
$this->addOption( 'image-base-path', 'Import files from a specified path', false, true );
$this->addArg( 'file', 'Dump file to import [else use stdin]', false );
}
function setNsfilter( array $namespaces ) {
if ( count( $namespaces ) == 0 ) {
$this->nsFilter = false;
+
return;
}
$this->nsFilter = array_unique( array_map( array( $this, 'getNsIndex' ), $namespaces ) );
}
/**
- * @param $obj Title|Revision
+ * @param Title|Revision $obj
* @return bool
*/
private function skippedNamespace( $obj ) {
echo wfBacktrace();
$this->error( "Cannot get namespace of object in " . __METHOD__, true );
}
+
return is_array( $this->nsFilter ) && !in_array( $ns, $this->nsFilter );
}
}
/**
- * @param $rev Revision
- * @return mixed
+ * @param Revision $rev
*/
function handleRevision( $rev ) {
$title = $rev->getTitle();
if ( !$title ) {
$this->progress( "Got bogus revision with null title!" );
+
return;
}
}
/**
- * @param $revision Revision
+ * @param Revision $revision
* @return bool
*/
function handleUpload( $revision ) {
if ( $this->uploads ) {
if ( $this->skippedNamespace( $revision ) ) {
- return;
+ return false;
}
$this->uploadCount++;
// $this->report();
// bluuuh hack
// call_user_func( $this->uploadCallback, $revision );
$dbw = wfGetDB( DB_MASTER );
+
return $dbw->deadlockLoop( array( $revision, 'importUpload' ) );
}
}
+
+ return false;
}
function handleLogItem( $rev ) {
}
$file = fopen( $filename, 'rt' );
+
return $this->importFromHandle( $file );
}
if ( self::posix_isatty( $file ) ) {
$this->maybeHelp( true );
}
+
return $this->importFromHandle( $file );
}