From 3f3465126ae71739b28df5198a7348735c221756 Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Sat, 10 Jul 2010 10:46:20 +0000 Subject: [PATCH] (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. --- RELEASE-NOTES | 6 +++++- includes/api/ApiPageSet.php | 16 +++++++++++++--- includes/api/ApiQuery.php | 11 +++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4ead788389..d0d734e9e4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index 9f2f19a89d..96be5ef02e 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -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 ); } diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index dc9f583be2..03d0b44c84 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -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 ) { -- 2.20.1