Use WikiPage instead of Article
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 12 Nov 2011 07:36:41 +0000 (07:36 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 12 Nov 2011 07:36:41 +0000 (07:36 +0000)
includes/api/ApiPageSet.php
includes/api/ApiProtect.php
includes/api/ApiRollback.php

index 0b0fbd7..26b4de3 100644 (file)
@@ -645,8 +645,8 @@ class ApiPageSet extends ApiQueryBase {
                        // We found pages that aren't in the redirect table
                        // Add them
                        foreach ( $this->mPendingRedirectIDs as $id => $title ) {
-                               $article = new Article( $title );
-                               $rt = $article->insertRedirect();
+                               $page = WikiPage::factory( $title );
+                               $rt = $page->insertRedirect();
                                if ( !$rt ) {
                                        // What the hell. Let's just ignore this
                                        continue;
index 177522a..0c7b9b5 100644 (file)
@@ -107,13 +107,13 @@ class ApiProtect extends ApiBase {
                }
 
                $cascade = $params['cascade'];
-               $articleObj = new Article( $titleObj );
 
                $watch = $params['watch'] ? 'watch' : $params['watchlist'];
                $this->setWatch( $watch, $titleObj );
 
                if ( $titleObj->exists() ) {
-                       $ok = $articleObj->updateRestrictions( $protections, $params['reason'], $cascade, $expiryarray );
+                       $pageObj = WikiPage::factory( $titleObj );
+                       $ok = $pageObj->updateRestrictions( $protections, $params['reason'], $cascade, $expiryarray );
                } else {
                        $ok = $titleObj->updateTitleProtection( $protections['create'], $params['reason'], $expiryarray['create'] );
                }
index 5c84a14..bbe90dc 100644 (file)
@@ -53,10 +53,10 @@ class ApiRollback extends ApiBase {
 
                // User and title already validated in call to getTokenSalt from Main
                $titleObj = $this->getRbTitle();
-               $articleObj = new Article( $titleObj );
+               $pageObj = WikiPage::factory( $titleObj );
                $summary = ( isset( $params['summary'] ) ? $params['summary'] : '' );
                $details = array();
-               $retval = $articleObj->doRollback( $this->getRbUser(), $summary, $params['token'], $params['markbot'], $details );
+               $retval = $pageObj->doRollback( $this->getRbUser(), $summary, $params['token'], $params['markbot'], $details, $this->getUser() );
 
                if ( $retval ) {
                        // We don't care about multiple errors, just report one of them