r56215 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56214‎ | r56215 | r56216 >
Date:23:36, 11 September 2009
Author:brion
Status:ok
Tags:
Comment:
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 (modified) (history)
  • /trunk/phase3/includes/ImagePage.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUndelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ImagePage.php
@@ -720,6 +720,13 @@
721721 * Delete the file, or an earlier version of it
722722 */
723723 public function delete() {
 724+ global $wgUploadMaintenance;
 725+ if( $wgUploadMaintenance && $this->mTitle && $this->mTitle->getNamespace() == NS_FILE ) {
 726+ global $wgOut;
 727+ $wgOut->addWikiText('Deletion and restoration of images temporarily disabled during maintenance.' );
 728+ return;
 729+ }
 730+
724731 $this->loadFile();
725732 if( !$this->img->exists() || !$this->img->isLocal() || $this->img->getRedirected() ) {
726733 // Standard article deletion
Index: trunk/phase3/includes/DefaultSettings.php
@@ -4222,3 +4222,6 @@
42234223 * Note that this requires JS2 and the script loader.
42244224 */
42254225 $wgUseAJAXCategories = false;
 4226+
 4227+// to disable image delete/restore temporarily
 4228+$wgUploadMaintenance = false;
Index: trunk/phase3/includes/specials/SpecialUndelete.php
@@ -646,6 +646,11 @@
647647 }
648648 }
649649 if( $this->mRestore && $this->mAction == "submit" ) {
 650+ global $wgUploadMaintenance;
 651+ if( $wgUploadMaintenance && $this->mTargetObj && $this->mTargetObj->getNamespace() == NS_FILE ) {
 652+ $wgOut->addWikiText('Deletion and restoration of images temporarily disabled during maintenance.' );
 653+ return;
 654+ }
650655 return $this->undelete();
651656 }
652657 if( $this->mInvert && $this->mAction == "submit" ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r56221Follow-up r56215: Replace hardcoded text with a new message....raymond08:25, 12 September 2009
r56374Merge post-branch trunk updates replacing old live hacks:...brion17:25, 15 September 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r53386throw in a quick hack to disable image deletion/restore if $wgUploadMaintenan...brion00:19, 17 July 2009

Status & tagging log