Make sure that the temp zone has an .htaccess file
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 6 Nov 2014 05:43:54 +0000 (21:43 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 6 Nov 2014 18:58:47 +0000 (10:58 -0800)
Change-Id: I357c6f6a60b4eb531636132180a717f4186b1797

includes/installer/DatabaseUpdater.php
maintenance/update.php

index 6e0c37f..dac4337 100644 (file)
@@ -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
         */
index 657a2fc..d1d17cf 100755 (executable)
@@ -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" );
        }