From: Brion Vibber Date: Fri, 20 Apr 2007 15:22:41 +0000 (+0000) Subject: * (bug 5439) "Go" title search will now jump to shared/foreign Image: and X-Git-Tag: 1.31.0-rc.0~53327 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=44c6db416fd0ab7445f5cd3038f9245cfa2f9652;p=lhc%2Fweb%2Fwiklou.git * (bug 5439) "Go" title search will now jump to shared/foreign Image: and MediaWiki: pages that have not been locally edited. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ba1b0e54b1..f16e852ae4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -121,6 +121,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Improved error reporting for image thumbnailing * Added sharpening option for ImageMagick thumbnailing + == Bugfixes since 1.9 == * (bug 7292) Fix site statistics when moving pages in/out of content namespaces @@ -336,6 +337,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Workaround for djvutoxml bug #1704049 (poor performance). Use djvudump instead. * Fixed odd behaviour in ImagePage on DjVu thumbnailing errors +* (bug 5439) "Go" title search will now jump to shared/foreign Image: and + MediaWiki: pages that have not been locally edited. == Maintenance == diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index 2ef5914302..be04380102 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -119,13 +119,29 @@ class SearchEngine { if ( $title->getNamespace() == NS_USER ) { return $title; } + + # Go to images that exist even if there's no local page. + # There may have been a funny upload, or it may be on a shared + # file repository such as Wikimedia Commons. + if( $title->getNamespace() == NS_IMAGE ) { + $image = new Image( $title ); + if( $image->exists() ) { + return $title; + } + } + + # MediaWiki namespace? Page may be "implied" if not customized. + # Just return it, with caps forced as the message system likes it. + if( $title->getNamespace() == NS_MEDIAWIKI ) { + return Title::makeTitle( NS_MEDIAWIKI, $wgContLang->ucfirst( $title->getText() ) ); + } # Quoted term? Try without the quotes... $matches = array(); if( preg_match( '/^"([^"]+)"$/', $searchterm, $matches ) ) { return SearchEngine::getNearMatch( $matches[1] ); } - + return NULL; }