(bug 24185) Titles in the Media and Special namespace are now supported for title...
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Sat, 10 Jul 2010 10:46:20 +0000 (10:46 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Sat, 10 Jul 2010 10:46:20 +0000 (10:46 +0000)
RELEASE-NOTES
includes/api/ApiPageSet.php
includes/api/ApiQuery.php

index 4ead788..d0d734e 100644 (file)
@@ -266,7 +266,11 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 22339) Added srwhat=nearmatch to list=search to get a "go" result
 * (bug 24303) Added new &servedby parameter to all actions which adds the hostname
   that served the request to the result. It is also added unconditionally on error
-
+* (bug 24185) Titles in the Media and Special namespace are now supported for 
+  title normalization in action=query. Special pages have their name resolved
+  to the local alias.
+  
 === Languages updated in 1.17 ===
 
 MediaWiki supports over 330 languages. Many localisations are updated
index 9f2f19a..96be5ef 100644 (file)
@@ -45,7 +45,7 @@ class ApiPageSet extends ApiQueryBase {
 
        private $mAllPages; // [ns][dbkey] => page_id or negative when missing
        private $mTitles, $mGoodTitles, $mMissingTitles, $mInvalidTitles;
-       private $mMissingPageIDs, $mRedirectTitles;
+       private $mMissingPageIDs, $mRedirectTitles, $mSpecialTitles;
        private $mNormalizedTitles, $mInterwikiTitles;
        private $mResolveRedirects, $mPendingRedirectIDs;
        private $mGoodRevIDs, $mMissingRevIDs;
@@ -72,6 +72,7 @@ class ApiPageSet extends ApiQueryBase {
                $this->mInterwikiTitles = array();
                $this->mGoodRevIDs = array();
                $this->mMissingRevIDs = array();
+               $this->mSpecialTitles = array();
 
                $this->mRequestedPageFields = array();
                $this->mResolveRedirects = $resolveRedirects;
@@ -245,6 +246,14 @@ class ApiPageSet extends ApiQueryBase {
        public function getMissingRevisionIDs() {
                return $this->mMissingRevIDs;
        }
+       
+       /**
+        * Get the list of titles with negative namespace
+        * @return array Title
+        */
+       public function getSpecialTitles() {
+               return $this->mSpecialTitles;
+       }
 
        /**
         * Returns the number of revisions (requested with revids= parameter)\
@@ -649,9 +658,10 @@ class ApiPageSet extends ApiQueryBase {
                                // This title is an interwiki link.
                                $this->mInterwikiTitles[$titleObj->getPrefixedText()] = $iw;
                        } else {
-                               // Validation
                                if ( $titleObj->getNamespace() < 0 ) {
-                                       $this->setWarning( 'No support for special pages has been implemented' );
+                                       $titleObj = $titleObj->fixSpecialName();
+                                       $this->mSpecialTitles[$this->mFakePageId] = $titleObj;
+                                       $this->mFakePageId--;
                                } else {
                                        $linkBatch->addObj( $titleObj );
                                }
index dc9f583..03d0b44 100644 (file)
@@ -374,6 +374,17 @@ class ApiQuery extends ApiBase {
                                'missing' => ''
                        );
                }
+               // Report special pages
+               foreach ( $pageSet->getSpecialTitles() as $fakeId => $title ) {
+                       $vals = array();
+                       ApiQueryBase::addTitleInfo( $vals, $title );
+                       $vals['special'] = '';
+                       if ( $title->getNamespace() == NS_SPECIAL && 
+                                       !SpecialPage::exists( $title->getText() ) ) {
+                               $vals['missing'] = '';                  
+                       }
+                       $pages[$fakeId] = $vals;
+               }
 
                // Output general page information for found titles
                foreach ( $pageSet->getGoodTitles() as $pageid => $title ) {