Put image redirects behind $wgFileRedirects config option for now (defaulting off).
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 16 Jan 2008 22:37:19 +0000 (22:37 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 16 Jan 2008 22:37:19 +0000 (22:37 +0000)
Several issues off the top of my head:
* Redirect behavior doesn't match between the image and the page.
* Upload form doesn't appear to pick up conflicts with existing redirects; this leads to confusion when after the upload you see a page showing the already-present redirect target, but the newly uploaded file is what you get when you use the name.
* [[Image:]] link to a redirect to a non-image page links to Special:Upload with the redirect name; [[Image:]] link to a redirect to a non-existent image page just links to the redirect page... behavior seems very hard to predict.
* Caching issues; pages using the redirected image don't appear to get invalidated when the redirect page is deleted
* Upload permissions can't be matched easily to creating-redirect permissions, which may be an issue (eg, create a billion redirects to Image:Goatse.jpg with innocent names)

includes/DefaultSettings.php
includes/filerepo/LocalRepo.php

index 636719f..e0fff68 100644 (file)
@@ -460,6 +460,11 @@ $wgHashedSharedUploadDirectory = true;
  */
 $wgRepositoryBaseUrl="http://commons.wikimedia.org/wiki/Image:";
 
+/**
+ * Experimental feature still under debugging.
+ */
+$wgFileRedirects = false;
+
 
 #
 # Email settings
index 021e679..e41ed44 100644 (file)
@@ -67,7 +67,7 @@ class LocalRepo extends FSRepo {
         * Function link Title::getArticleID().
         * We can't say Title object, what database it should use, so we duplicate that function here.
         */
-       function getArticleID( $title ) {
+       private function getArticleID( $title ) {
                if( !$title instanceof Title ) {
                        return 0;
                }
@@ -85,6 +85,11 @@ class LocalRepo extends FSRepo {
        }
 
        function checkRedirect( $title ) {
+               global $wgFileRedirects;
+               if( !$wgFileRedirects ) {
+                       return false;
+               }
+               
                $id = $this->getArticleID( $title );
                if( !$id ) {
                        return false;