} elseif( $changed ) {
wfDebug( __METHOD__ . ": running onArticleEdit\n" );
- Article::onArticleEdit( $this->title, 'skiptransclusions' ); // leave templatelinks for editUpdates()
+ Article::onArticleEdit( $this->title );
wfDebug( __METHOD__ . ": running edit updates\n" );
$article->editUpdates(
$this->timestamp . "\n" );
return false;
}
- $log_id = $dbw->nextSequenceValue( 'log_log_id_seq' );
+ $log_id = $dbw->nextSequenceValue( 'logging_log_id_seq' );
$data = array(
'log_id' => $log_id,
'log_type' => $this->type,
$resultDetails = array( 'internal' => $status->getWikiText() );
*/
- // @fixme upload() uses $wgUser, which is wrong here
+ // @todo Fixme: upload() uses $wgUser, which is wrong here
// it may also create a page without our desire, also wrong potentially.
// and, it will record a *current* upload, but we might want an archive version here
return false;
}
- // @fixme!
+ // @todo Fixme!
$src = $this->getSrc();
$data = Http::get( $src );
if( !$data ) {
}
function handleXmlNamespace ( $parser, $data, $prefix=false, $uri=false ) {
- if( preg_match( '/www.mediawiki.org/',$prefix ) ) {
- $prefix = str_replace( '/','\/',$prefix );
+ if( preg_match( '/www.mediawiki.org/',$prefix ) ) {
+ $prefix = str_replace( '/','\/',$prefix );
$this->mXmlNamespace='/^'.$prefix.':/';
}
}
function stripXmlNamespace($name) {
if( $this->mXmlNamespace ) {
- return(preg_replace($this->mXmlNamespace,'',$name,1));
+ return(preg_replace($this->mXmlNamespace,'',$name,1));
}
else {
- return($name);
- }
+ return($name);
+ }
}
-
+
# --------------
function doImport() {
/**
* Default per-revision callback, performs the import.
- * @param $revision WikiRevision
+ * @param $rev WikiRevision
* @private
*/
function importLogItem( $rev ) {
}
function in_start( $parser, $name, $attribs ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "in_start $name" );
if( $name != "mediawiki" ) {
return $this->throwXMLerror( "Expected <mediawiki>, got <$name>" );
}
function in_mediawiki( $parser, $name, $attribs ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "in_mediawiki $name" );
if( $name == 'siteinfo' ) {
xml_set_element_handler( $parser, "in_siteinfo", "out_siteinfo" );
}
}
function out_mediawiki( $parser, $name ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "out_mediawiki $name" );
if( $name != "mediawiki" ) {
return $this->throwXMLerror( "Expected </mediawiki>, got </$name>" );
function in_siteinfo( $parser, $name, $attribs ) {
// no-ops for now
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "in_siteinfo $name" );
switch( $name ) {
case "sitename":
}
function out_siteinfo( $parser, $name ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
if( $name == "siteinfo" ) {
xml_set_element_handler( $parser, "in_mediawiki", "out_mediawiki" );
}
function in_page( $parser, $name, $attribs ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "in_page $name" );
switch( $name ) {
case "id":
case "title":
+ case "redirect":
case "restrictions":
$this->appendfield = $name;
$this->appenddata = "";
}
function out_page( $parser, $name ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "out_page $name" );
$this->pop();
if( $name != "page" ) {
}
function in_nothing( $parser, $name, $attribs ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "in_nothing $name" );
return $this->throwXMLerror( "No child elements allowed here; got <$name>" );
}
}
function out_append( $parser, $name ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "out_append $name" );
if( $name != $this->appendfield ) {
return $this->throwXMLerror( "Expected </{$this->appendfield}>, got </$name>" );
}
function in_revision( $parser, $name, $attribs ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "in_revision $name" );
switch( $name ) {
case "id":
}
function out_revision( $parser, $name ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "out_revision $name" );
$this->pop();
if( $name != "revision" ) {
}
}
}
-
+
function in_logitem( $parser, $name, $attribs ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "in_logitem $name" );
switch( $name ) {
case "id":
}
function out_logitem( $parser, $name ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "out_logitem $name" );
$this->pop();
if( $name != "logitem" ) {
}
function in_upload( $parser, $name, $attribs ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "in_upload $name" );
switch( $name ) {
case "timestamp":
}
function out_upload( $parser, $name ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "out_revision $name" );
$this->pop();
if( $name != "upload" ) {
}
function in_contributor( $parser, $name, $attribs ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "in_contributor $name" );
switch( $name ) {
case "username":
}
function out_contributor( $parser, $name ) {
- $name = $this->stripXmlNamespace($name);
+ $name = $this->stripXmlNamespace($name);
$this->debug( "out_contributor $name" );
$this->pop();
if( $name != "contributor" ) {
return new WikiErrorMsg( 'importuploaderrorsize' );
case 3: # The uploaded file was only partially uploaded
return new WikiErrorMsg( 'importuploaderrorpartial' );
- case 6: #Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.
- return new WikiErrorMsg( 'importuploaderrortemp' );
- # case else: # Currently impossible
+ case 6: #Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.
+ return new WikiErrorMsg( 'importuploaderrortemp' );
+ # case else: # Currently impossible
}
}
}
}
- public static function newFromInterwiki( $interwiki, $page, $history=false ) {
+ public static function newFromInterwiki( $interwiki, $page, $history = false, $templates = false, $pageLinkDepth = 0 ) {
if( $page == '' ) {
return new WikiErrorMsg( 'import-noarticle' );
}
if( is_null( $link ) || $link->getInterwiki() == '' ) {
return new WikiErrorMsg( 'importbadinterwiki' );
} else {
- $params = $history ? 'history=1' : '';
+ $params = array();
+ if ( $history ) $params['history'] = 1;
+ if ( $templates ) $params['templates'] = 1;
+ if ( $pageLinkDepth ) $params['pagelink-depth'] = $pageLinkDepth;
$url = $link->getFullUrl( $params );
# For interwikis, use POST to avoid redirects.
return ImportStreamSource::newFromURL( $url, "POST" );