Index: branches/wmf/1.16wmf4/extensions/GlobalUsage/SpecialGlobalUsage.php |
— | — | @@ -226,10 +226,23 @@ |
227 | 227 | * @return bool |
228 | 228 | */ |
229 | 229 | protected static function hasResults( $imagePage ) { |
| 230 | + # Don't display links if the target file does not exist |
230 | 231 | $file = $imagePage->getFile(); |
231 | | - if ( !$file->exists() || $file->getRepoName() == 'local' ) |
| 232 | + if ( !$file->exists() ) { |
232 | 233 | return false; |
| 234 | + } |
233 | 235 | |
| 236 | + # Don't show global usage if the file is local. |
| 237 | + # Do show it however if the current repo is the shared repo. The way |
| 238 | + # we detect this is a bit hacky and less than ideal. See bug 23136 for |
| 239 | + # a discussion. |
| 240 | + global $wgGlobalUsageDatabase; |
| 241 | + $dbr = wfGetDB( DB_SLAVE ); |
| 242 | + if ( $file->getRepoName() == 'local' |
| 243 | + && $dbr->getDBname() != $wgGlobalUsageDatabase ) { |
| 244 | + return false; |
| 245 | + } |
| 246 | + |
234 | 247 | $query = self::getImagePageQuery( $imagePage->getFile()->getTitle() ); |
235 | 248 | return (bool)$query->getResult(); |
236 | 249 | } |
Property changes on: branches/wmf/1.16wmf4/extensions/GlobalUsage |
___________________________________________________________________ |
Name: svn:mergeinfo |
237 | 250 | + /branches/wmf-deployment/extensions/GlobalUsage:60970 |
/trunk/extensions/GlobalUsage:64889 |
/trunk/phase3/extensions/GlobalUsage:63545-63546,63549,63643,63764,63897-63901 |