r53102 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53101‎ | r53102 | r53103 >
Date:05:02, 11 July 2009
Author:mrzman
Status:deferred
Tags:
Comment:
Fix database error
Modified paths:
  • /trunk/extensions/IndexFunction/IndexFunction.i18n.php (modified) (history)
  • /trunk/extensions/IndexFunction/SpecialIndex.php (modified) (history)

Diff [purge]

Index: trunk/extensions/IndexFunction/IndexFunction.i18n.php
@@ -19,4 +19,5 @@
2020 'index-disambig-start' => "'''$1''' may refer to several pages:",
2121 'index-exclude-categories' => '', # List of categories to exclude from the auto-disambig pages
2222 'index-missing-param' => 'This page cannot be used with no parameters',
 23+ 'index-emptylist' => 'There are no pages associated with "$1"',
2324 );
Index: trunk/extensions/IndexFunction/SpecialIndex.php
@@ -38,7 +38,6 @@
3939 global $wgOut, $wgUser;
4040 $sk = $wgUser->getSkin();
4141 $wgOut->setPagetitle( $t1->getPrefixedText() );
42 - $wgOut->addWikiMsg( 'index-disambig-start', $t1->getPrefixedText() );
4342 $dbr = wfGetDB( DB_SLAVE );
4443 $pages = $dbr->select( array('page', 'indexes'),
4544 array( 'page_id', 'page_namespace', 'page_title' ),
@@ -53,6 +52,14 @@
5453 $t = Title::newFromRow( $row );
5554 $list[strval($row->page_id)] = array( 'title' => $t, 'cats' => array() );
5655 }
 56+ if (count($list) == 0) {
 57+ $wgOut->addWikiMsg( 'index-emptylist', $t1->getPrefixedText() );
 58+ return;
 59+ } elseif (count($list) == 1) {
 60+ $target = reset( $list );
 61+ $wgOut->redirect( $target['title']->getLocalURL() );
 62+ }
 63+ $wgOut->addWikiMsg( 'index-disambig-start', $t1->getPrefixedText() );
5764 $keys = array_keys( $list );
5865 $set = '(' . implode(',', $keys) . ')';
5966

Status & tagging log