Use WikiPage instead of Article
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 19 Nov 2011 08:51:20 +0000 (08:51 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 19 Nov 2011 08:51:20 +0000 (08:51 +0000)
includes/Import.php

index 6eec5c9..bc02669 100644 (file)
@@ -1246,14 +1246,14 @@ class WikiRevision {
                $linkCache = LinkCache::singleton();
                $linkCache->clear();
 
-               $article = new Article( $this->title );
-               $pageId = $article->getId();
-               if( $pageId == 0 ) {
+               $page = WikiPage::factory( $this->title );
+               if( !$page->exists() ) {
                        # must create the page...
-                       $pageId = $article->insertOn( $dbw );
+                       $pageId = $page->insertOn( $dbw );
                        $created = true;
                        $oldcountable = null;
                } else {
+                       $pageId = $page->getId();
                        $created = false;
 
                        $prior = $dbw->selectField( 'revision', '1',
@@ -1269,7 +1269,7 @@ class WikiRevision {
                                        $this->title->getPrefixedText() . "]], timestamp " . $this->timestamp . "\n" );
                                return false;
                        }
-                       $oldcountable = $article->isCountable();
+                       $oldcountable = $page->isCountable();
                }
 
                # @todo FIXME: Use original rev_id optionally (better for backups)
@@ -1284,11 +1284,11 @@ class WikiRevision {
                        'minor_edit' => $this->minor,
                        ) );
                $revision->insertOn( $dbw );
-               $changed = $article->updateIfNewerOn( $dbw, $revision );
+               $changed = $page->updateIfNewerOn( $dbw, $revision );
 
                if ( $changed !== false && !$this->mNoUpdates ) {
                        wfDebug( __METHOD__ . ": running updates\n" );
-                       $article->doEditUpdates( $revision, $userObj, array( 'created' => $created, 'oldcountable' => $oldcountable ) );
+                       $page->doEditUpdates( $revision, $userObj, array( 'created' => $created, 'oldcountable' => $oldcountable ) );
                }
 
                return true;