r64889 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64888‎ | r64889 | r64890 >
Date:17:18, 10 April 2010
Author:btongminh
Status:ok
Tags:
Comment:
(bug 23136) Regression: Section "Global usage" is not shown on Commons file page

Do show the section if the current repo is the shared repo. The way we detect this is a bit hacky and less than ideal.
Modified paths:
  • /trunk/extensions/GlobalUsage/SpecialGlobalUsage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GlobalUsage/SpecialGlobalUsage.php
@@ -228,10 +228,23 @@
229229 * @return bool
230230 */
231231 protected static function hasResults( $imagePage ) {
 232+ # Don't display links if the target file does not exist
232233 $file = $imagePage->getFile();
233 - if ( !$file->exists() || $file->getRepoName() == 'local' )
 234+ if ( !$file->exists() ) {
234235 return false;
 236+ }
235237
 238+ # Don't show global usage if the file is local.
 239+ # Do show it however if the current repo is the shared repo. The way
 240+ # we detect this is a bit hacky and less than ideal. See bug 23136 for
 241+ # a discussion.
 242+ global $wgGlobalUsageDatabase;
 243+ $dbr = wfGetDB( DB_SLAVE );
 244+ if ( $file->getRepoName() == 'local'
 245+ && $dbr->getDBname() != $wgGlobalUsageDatabase ) {
 246+ return false;
 247+ }
 248+
236249 $query = self::getImagePageQuery( $imagePage->getFile()->getTitle() );
237250 return (bool)$query->getResult();
238251 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r648901.16wmf4: MFT r64889catrope17:33, 10 April 2010

Status & tagging log