From: Chad Horohoe Date: Tue, 21 Jun 2011 01:13:45 +0000 (+0000) Subject: (bug 29492) Long-running steps in the installer (such as Upgrade and Install) can... X-Git-Tag: 1.31.0-rc.0~29384 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=852334b7366ebfff658731abeb7cae70e70878c5;p=lhc%2Fweb%2Fwiklou.git (bug 29492) Long-running steps in the installer (such as Upgrade and Install) can sometimes timeout --- diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index fb2f0d2395..180817be7c 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -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. diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index c496ecc5e9..f9f59cdf73 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -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(); + } } diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 4ea0cd4071..4189ece062 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -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(); diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index f0ae6ba66e..a06dc20145 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -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' ) ) {