r69233 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69232‎ | r69233 | r69234 >
Date:10:46, 10 July 2010
Author:btongminh
Status:resolved (Comments)
Tags:
Comment:
(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.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiPageSet.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQuery.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQuery.php
@@ -374,6 +374,17 @@
375375 'missing' => ''
376376 );
377377 }
 378+ // Report special pages
 379+ foreach ( $pageSet->getSpecialTitles() as $fakeId => $title ) {
 380+ $vals = array();
 381+ ApiQueryBase::addTitleInfo( $vals, $title );
 382+ $vals['special'] = '';
 383+ if ( $title->getNamespace() == NS_SPECIAL &&
 384+ !SpecialPage::exists( $title->getText() ) ) {
 385+ $vals['missing'] = '';
 386+ }
 387+ $pages[$fakeId] = $vals;
 388+ }
378389
379390 // Output general page information for found titles
380391 foreach ( $pageSet->getGoodTitles() as $pageid => $title ) {
Index: trunk/phase3/includes/api/ApiPageSet.php
@@ -45,7 +45,7 @@
4646
4747 private $mAllPages; // [ns][dbkey] => page_id or negative when missing
4848 private $mTitles, $mGoodTitles, $mMissingTitles, $mInvalidTitles;
49 - private $mMissingPageIDs, $mRedirectTitles;
 49+ private $mMissingPageIDs, $mRedirectTitles, $mSpecialTitles;
5050 private $mNormalizedTitles, $mInterwikiTitles;
5151 private $mResolveRedirects, $mPendingRedirectIDs;
5252 private $mGoodRevIDs, $mMissingRevIDs;
@@ -72,6 +72,7 @@
7373 $this->mInterwikiTitles = array();
7474 $this->mGoodRevIDs = array();
7575 $this->mMissingRevIDs = array();
 76+ $this->mSpecialTitles = array();
7677
7778 $this->mRequestedPageFields = array();
7879 $this->mResolveRedirects = $resolveRedirects;
@@ -245,6 +246,14 @@
246247 public function getMissingRevisionIDs() {
247248 return $this->mMissingRevIDs;
248249 }
 250+
 251+ /**
 252+ * Get the list of titles with negative namespace
 253+ * @return array Title
 254+ */
 255+ public function getSpecialTitles() {
 256+ return $this->mSpecialTitles;
 257+ }
249258
250259 /**
251260 * Returns the number of revisions (requested with revids= parameter)\
@@ -649,9 +658,10 @@
650659 // This title is an interwiki link.
651660 $this->mInterwikiTitles[$titleObj->getPrefixedText()] = $iw;
652661 } else {
653 - // Validation
654662 if ( $titleObj->getNamespace() < 0 ) {
655 - $this->setWarning( 'No support for special pages has been implemented' );
 663+ $titleObj = $titleObj->fixSpecialName();
 664+ $this->mSpecialTitles[$this->mFakePageId] = $titleObj;
 665+ $this->mFakePageId--;
656666 } else {
657667 $linkBatch->addObj( $titleObj );
658668 }
Index: trunk/phase3/RELEASE-NOTES
@@ -266,7 +266,11 @@
267267 * (bug 22339) Added srwhat=nearmatch to list=search to get a "go" result
268268 * (bug 24303) Added new &servedby parameter to all actions which adds the hostname
269269 that served the request to the result. It is also added unconditionally on error
270 -
 270+* (bug 24185) Titles in the Media and Special namespace are now supported for
 271+ title normalization in action=query. Special pages have their name resolved
 272+ to the local alias.
 273+
 274+
271275 === Languages updated in 1.17 ===
272276
273277 MediaWiki supports over 330 languages. Many localisations are updated

Follow-up revisions

RevisionCommit summaryAuthorDate
r69683Follow-up r69233: Add existence check for NS_MEDIA titlesbtongminh14:40, 21 July 2010
r80833Follow-up r69233: use getDbKey() instead of getText() for special pages.btongminh20:19, 23 January 2011

Comments

#Comment by Catrope (talk | contribs)   15:51, 19 July 2010

This could do with an existence check for Media: titles IMO (those also have a negative namespace).

#Comment by Bryan (talk | contribs)   14:40, 21 July 2010
#Comment by Umherirrender (talk | contribs)   22:57, 15 January 2011

Please use Title::getDBkey() for SpecialPage::exists(), not Title::getText(), see bug 25878. Thanks.

#Comment by Bryan (talk | contribs)   20:21, 23 January 2011

Fixed in r80833

Status & tagging log