http://www.mediawiki.org/wiki/Special:Code/MediaWiki/56215

Revision: 56215
Author:   brion
Date:     2009-09-11 23:36:28 +0000 (Fri, 11 Sep 2009)

Log Message:
-----------
Forward-port image manipulation disabling hack from wmf-deployment r53386.
Turning on $wgUploadMaintenance will disable deletion and undeletion of images; 
useful when performing maintenance on file servers to ensure that nobody's 
messing with your data while you work.
Note that $wgEnableUploads really should be disabled too or it'll be a bit 
silly. ;)
Could use localization and other polishing.

Modified Paths:
--------------
    trunk/phase3/includes/DefaultSettings.php
    trunk/phase3/includes/ImagePage.php
    trunk/phase3/includes/specials/SpecialUndelete.php

Modified: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php   2009-09-11 23:21:25 UTC (rev 
56214)
+++ trunk/phase3/includes/DefaultSettings.php   2009-09-11 23:36:28 UTC (rev 
56215)
@@ -4222,3 +4222,6 @@
  * Note that this requires JS2 and the script loader.
  */
 $wgUseAJAXCategories = false;
+
+// to disable image delete/restore temporarily
+$wgUploadMaintenance = false;

Modified: trunk/phase3/includes/ImagePage.php
===================================================================
--- trunk/phase3/includes/ImagePage.php 2009-09-11 23:21:25 UTC (rev 56214)
+++ trunk/phase3/includes/ImagePage.php 2009-09-11 23:36:28 UTC (rev 56215)
@@ -720,6 +720,13 @@
         * Delete the file, or an earlier version of it
         */
        public function delete() {
+               global $wgUploadMaintenance;
+               if( $wgUploadMaintenance && $this->mTitle && 
$this->mTitle->getNamespace() == NS_FILE ) {
+                       global $wgOut;
+                       $wgOut->addWikiText('Deletion and restoration of images 
temporarily disabled during maintenance.' );
+                       return;
+               }
+
                $this->loadFile();
                if( !$this->img->exists() || !$this->img->isLocal() || 
$this->img->getRedirected() ) {
                        // Standard article deletion

Modified: trunk/phase3/includes/specials/SpecialUndelete.php
===================================================================
--- trunk/phase3/includes/specials/SpecialUndelete.php  2009-09-11 23:21:25 UTC 
(rev 56214)
+++ trunk/phase3/includes/specials/SpecialUndelete.php  2009-09-11 23:36:28 UTC 
(rev 56215)
@@ -646,6 +646,11 @@
                        }
                }
                if( $this->mRestore && $this->mAction == "submit" ) {
+                       global $wgUploadMaintenance;
+                       if( $wgUploadMaintenance && $this->mTargetObj && 
$this->mTargetObj->getNamespace() == NS_FILE ) {
+                               $wgOut->addWikiText('Deletion and restoration 
of images temporarily disabled during maintenance.' );
+                               return;
+                       }
                        return $this->undelete();
                }
                if( $this->mInvert && $this->mAction == "submit" ) {



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to