Merge "Add and use Title::getOtherPage()"
[lhc/web/wiklou.git] / includes / installer / DatabaseUpdater.php
index 6e0c37f..b676f45 100644 (file)
@@ -115,7 +115,7 @@ abstract class DatabaseUpdater {
                $this->maintenance->setDB( $db );
                $this->initOldGlobals();
                $this->loadExtensions();
-               wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) );
+               Hooks::run( 'LoadExtensionSchemaUpdates', array( $this ) );
        }
 
        /**
@@ -612,7 +612,7 @@ abstract class DatabaseUpdater {
         * Append a line to the open filehandle.  The line is assumed to
         * be a complete SQL statement.
         *
-        * This is used as a callback for for sourceLine().
+        * This is used as a callback for sourceLine().
         *
         * @param string $line Text to append to the file
         * @return bool False to skip actually executing the 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
         */
@@ -1035,6 +1058,31 @@ abstract class DatabaseUpdater {
                }
        }
 
+       /**
+        * Enable profiling table when it's turned on
+        */
+       protected function doEnableProfiling() {
+               global $wgProfiler;
+
+               if ( !$this->doTable( 'profiling' ) ) {
+                       return true;
+               }
+
+               $profileToDb = false;
+               if ( isset( $wgProfiler['output'] ) ) {
+                       $out = $wgProfiler['output'];
+                       if ( $out === 'db' ) {
+                               $profileToDb = true;
+                       } elseif ( is_array( $out ) && in_array( 'db', $out ) ) {
+                               $profileToDb = true;
+                       }
+               }
+
+               if ( $profileToDb && !$this->db->tableExists( 'profiling', __METHOD__ ) ) {
+                       $this->applyPatch( 'patch-profiling.sql', false, 'Add profiling table' );
+               }
+       }
+
        /**
         * Rebuilds the localisation cache
         */