r90506 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90505‎ | r90506 | r90507 >
Date:01:13, 21 June 2011
Author:demon
Status:ok
Tags:
Comment:
(bug 29492) Long-running steps in the installer (such as Upgrade and Install) can sometimes timeout
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstallerPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -108,6 +108,8 @@
109109 * (bug 29342) Patrol preferences shouldn't be visible to users who don't have
110110 patrol permissions
111111 * (bug 29471) Exception thrown for files with invalid date in metadata
 112+* (bug 29492) Long-running steps in the installer (such as Upgrade and Install)
 113+ can sometimes timeout
112114
113115 === API changes in 1.19 ===
114116 * BREAKING CHANGE: action=watch now requires POST and token.
Index: trunk/phase3/includes/installer/WebInstaller.php
@@ -247,6 +247,10 @@
248248 $this->currentPageName = $page->getName();
249249 $this->startPageWrapper( $pageName );
250250
 251+ if( $page->isSlow() ) {
 252+ $this->disableTimeLimit();
 253+ }
 254+
251255 $result = $page->execute();
252256
253257 $this->endPageWrapper();
Index: trunk/phase3/includes/installer/Installer.php
@@ -1533,4 +1533,14 @@
15341534 public function addInstallStep( $callback, $findStep = 'BEGINNING' ) {
15351535 $this->extraInstallSteps[$findStep][] = $callback;
15361536 }
 1537+
 1538+ /**
 1539+ * Disable the time limit for execution.
 1540+ * Some long-running pages (Install, Upgrade) will want to do this
 1541+ */
 1542+ protected function disableTimeLimit() {
 1543+ wfSuppressWarnings();
 1544+ set_time_limit( 0 );
 1545+ wfRestoreWarnings();
 1546+ }
15371547 }
Index: trunk/phase3/includes/installer/WebInstallerPage.php
@@ -32,6 +32,15 @@
3333 $this->parent = $parent;
3434 }
3535
 36+ /**
 37+ * Is this a slow-running page in the installer? If so, WebInstaller will
 38+ * set_time_limit(0) before calling execute(). Right now this only applies
 39+ * to Install and Upgrade pages
 40+ */
 41+ public function isSlow() {
 42+ return false;
 43+ }
 44+
3645 public function addHTML( $html ) {
3746 $this->parent->output->addHTML( $html );
3847 }
@@ -467,6 +476,9 @@
468477 }
469478
470479 class WebInstaller_Upgrade extends WebInstallerPage {
 480+ public function isSlow() {
 481+ return true;
 482+ }
471483
472484 public function execute() {
473485 if ( $this->getVar( '_UpgradeDone' ) ) {
@@ -1086,6 +1098,9 @@
10871099 }
10881100
10891101 class WebInstaller_Install extends WebInstallerPage {
 1102+ public function isSlow() {
 1103+ return true;
 1104+ }
10901105
10911106 public function execute() {
10921107 if( $this->getVar( '_UpgradeDone' ) ) {

Status & tagging log