From 4bddc93561b1014ab76629b9e5645493ee30090e Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 5 Nov 2014 21:43:54 -0800 Subject: [PATCH] Make sure that the temp zone has an .htaccess file Change-Id: I357c6f6a60b4eb531636132180a717f4186b1797 --- includes/installer/DatabaseUpdater.php | 23 +++++++++++++++++++++++ maintenance/update.php | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 6e0c37fd64..dac43371a5 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -897,6 +897,29 @@ abstract class DatabaseUpdater { return true; } + /** + * Set any .htaccess files or equivilent for storage repos + * + * Some zones (e.g. "temp") used to be public and may have been initialized as such + */ + public function setFileAccess() { + $repo = RepoGroup::singleton()->getLocalRepo(); + $zonePath = $repo->getZonePath( 'temp' ); + if ( $repo->getBackend()->directoryExists( array( 'dir' => $zonePath ) ) ) { + // If the directory was never made, then it will have the right ACLs when it is made + $status = $repo->getBackend()->secure( array( + 'dir' => $zonePath, + 'noAccess' => true, + 'noListing' => true + ) ); + if ( $status->isOK() ) { + $this->output( "Set the local repo temp zone container to be private.\n" ); + } else { + $this->output( "Failed to set the local repo temp zone container to be private.\n" ); + } + } + } + /** * Purge the objectcache table */ diff --git a/maintenance/update.php b/maintenance/update.php index 657a2fcdce..d1d17cf927 100755 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -178,11 +178,12 @@ class UpdateMediaWiki extends Maintenance { } } + $updater->setFileAccess(); if ( !$this->hasOption( 'nopurge' ) ) { $updater->purgeCache(); } - $time2 = new MWTimestamp(); + $time2 = new MWTimestamp(); $timeDiff = $time2->diff( $time1 ); $this->output( "\nDone in " . $timeDiff->format( "%i:%S" ) . ".\n" ); } -- 2.20.1