(bug 29492) Long-running steps in the installer (such as Upgrade and Install) can...
authorChad Horohoe <demon@users.mediawiki.org>
Tue, 21 Jun 2011 01:13:45 +0000 (01:13 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Tue, 21 Jun 2011 01:13:45 +0000 (01:13 +0000)
RELEASE-NOTES-1.19
includes/installer/Installer.php
includes/installer/WebInstaller.php
includes/installer/WebInstallerPage.php

index fb2f0d2..180817b 100644 (file)
@@ -108,6 +108,8 @@ production.
 * (bug 29342) Patrol preferences shouldn't be visible to users who don't have
   patrol permissions
 * (bug 29471) Exception thrown for files with invalid date in metadata
+* (bug 29492) Long-running steps in the installer (such as Upgrade and Install)
+  can sometimes timeout
 
 === API changes in 1.19 ===
 * BREAKING CHANGE: action=watch now requires POST and token.
index c496ecc..f9f59cd 100644 (file)
@@ -1533,4 +1533,14 @@ abstract class Installer {
        public function addInstallStep( $callback, $findStep = 'BEGINNING' ) {
                $this->extraInstallSteps[$findStep][] = $callback;
        }
+
+       /**
+        * Disable the time limit for execution.
+        * Some long-running pages (Install, Upgrade) will want to do this
+        */
+       protected function disableTimeLimit() {
+               wfSuppressWarnings();
+               set_time_limit( 0 );
+               wfRestoreWarnings();
+       }
 }
index 4ea0cd4..4189ece 100644 (file)
@@ -247,6 +247,10 @@ class WebInstaller extends Installer {
                $this->currentPageName = $page->getName();
                $this->startPageWrapper( $pageName );
 
+               if( $page->isSlow() ) {
+                       $this->disableTimeLimit();
+               }
+
                $result = $page->execute();
 
                $this->endPageWrapper();
index f0ae6ba..a06dc20 100644 (file)
@@ -32,6 +32,15 @@ abstract class WebInstallerPage {
                $this->parent = $parent;
        }
 
+       /**
+        * Is this a slow-running page in the installer? If so, WebInstaller will
+        * set_time_limit(0) before calling execute(). Right now this only applies
+        * to Install and Upgrade pages
+        */
+       public function isSlow() {
+               return false;
+       }
+
        public function addHTML( $html ) {
                $this->parent->output->addHTML( $html );
        }
@@ -467,6 +476,9 @@ class WebInstaller_DBConnect extends WebInstallerPage {
 }
 
 class WebInstaller_Upgrade extends WebInstallerPage {
+       public function isSlow() {
+               return true;
+       }
 
        public function execute() {
                if ( $this->getVar( '_UpgradeDone' ) ) {
@@ -1086,6 +1098,9 @@ class WebInstaller_Options extends WebInstallerPage {
 }
 
 class WebInstaller_Install extends WebInstallerPage {
+       public function isSlow() {
+               return true;
+       }
 
        public function execute() {
                if( $this->getVar( '_UpgradeDone' ) ) {