From 44c6db416fd0ab7445f5cd3038f9245cfa2f9652 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 20 Apr 2007 15:22:41 +0000 Subject: [PATCH] * (bug 5439) "Go" title search will now jump to shared/foreign Image: and MediaWiki: pages that have not been locally edited. --- RELEASE-NOTES | 3 +++ includes/SearchEngine.php | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) 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; } -- 2.20.1