Merge branch 'master' of ssh://gerrit.wikimedia.org:29418/mediawiki/core into Wikidata
[lhc/web/wiklou.git] / includes / api / ApiDelete.php
index 21e7b80..121cb48 100644 (file)
@@ -46,13 +46,12 @@ class ApiDelete extends ApiBase {
        public function execute() {
                $params = $this->extractRequestParams();
 
-               $titleObj = $this->getTitleOrPageId( $params );
-               $pageObj = WikiPage::factory( $titleObj );
-               $pageObj->loadPageData( 'fromdbmaster' );
+               $pageObj = $this->getTitleOrPageId( $params, 'fromdbmaster' );
                if ( !$pageObj->exists() ) {
                        $this->dieUsageMsg( 'notanarticle' );
                }
 
+               $titleObj = $pageObj->getTitle();
                $reason = ( isset( $params['reason'] ) ? $params['reason'] : null );
                $user = $this->getUser();
 
@@ -112,7 +111,7 @@ class ApiDelete extends ApiBase {
                        // Need to pass a throwaway variable because generateReason expects
                        // a reference
                        $hasHistory = false;
-                       $reason = $page->getAutoDeleteReason( $hasHistory );
+                       $reason = $page->getAutoDeleteReason( $hasHistory ); #FIXME: use ContentHandler::getAutoDeleteReason()
                        if ( $reason === false ) {
                                return array( array( 'cannotdelete', $title->getPrefixedText() ) );
                        }