From eee2d3b9f8febbf4390dac04ccfcfde9dcf947ab Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 16 Jan 2008 22:37:19 +0000 Subject: [PATCH] Put image redirects behind $wgFileRedirects config option for now (defaulting off). 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 | 5 +++++ includes/filerepo/LocalRepo.php | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 636719f5b7..e0fff685d2 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -460,6 +460,11 @@ $wgHashedSharedUploadDirectory = true; */ $wgRepositoryBaseUrl="http://commons.wikimedia.org/wiki/Image:"; +/** + * Experimental feature still under debugging. + */ +$wgFileRedirects = false; + # # Email settings diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index 021e67942f..e41ed44e81 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -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; -- 2.20.1