* (bug 5439) "Go" title search will now jump to shared/foreign Image: and
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 20 Apr 2007 15:22:41 +0000 (15:22 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 20 Apr 2007 15:22:41 +0000 (15:22 +0000)
  MediaWiki: pages that have not been locally edited.

RELEASE-NOTES
includes/SearchEngine.php

index ba1b0e5..f16e852 100644 (file)
@@ -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 ==
 
index 2ef5914..be04380 100644 (file)
@@ -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;
        }