diff --git a/backup/util/progress/core_backup_progress.class.php b/backup/util/progress/core_backup_progress.class.php index d4a5012075e..fcdd459e47b 100644 --- a/backup/util/progress/core_backup_progress.class.php +++ b/backup/util/progress/core_backup_progress.class.php @@ -31,9 +31,14 @@ abstract class core_backup_progress { const INDETERMINATE = -1; /** + * This value is set rather high to ensure there are no regressions from + * previous behaviour. For testing, it may be useful to set the + * frontendservertimeout config option to a lower value, such as 180 + * seconds (default for some commercial products). + * * @var int The number of seconds that can pass without progress() calls. */ - const TIME_LIMIT_WITHOUT_PROGRESS = 120; + const TIME_LIMIT_WITHOUT_PROGRESS = 3600; /** * @var int Time of last progress call. @@ -202,7 +207,9 @@ abstract class core_backup_progress { // Update progress. $this->count++; $this->lastprogresstime = $now; - set_time_limit(self::TIME_LIMIT_WITHOUT_PROGRESS); + + // Update time limit before next progress display. + core_php_time_limit::raise(self::TIME_LIMIT_WITHOUT_PROGRESS); $this->update_progress(); } diff --git a/backup/util/progress/tests/progress_test.php b/backup/util/progress/tests/progress_test.php index 28f9f035ab3..0ba77486a47 100644 --- a/backup/util/progress/tests/progress_test.php +++ b/backup/util/progress/tests/progress_test.php @@ -56,9 +56,11 @@ class backup_progress_testcase extends basic_testcase { // Make some progress and check that the time limit gets added. $progress->step_time(); + core_php_time_limit::get_and_clear_unit_test_data(); $progress->progress(2); $this->assertTrue($progress->was_update_called()); - $this->assertEquals(120, ini_get('max_execution_time')); + $this->assertEquals(array(core_backup_progress::TIME_LIMIT_WITHOUT_PROGRESS), + core_php_time_limit::get_and_clear_unit_test_data()); // Check the new value. $this->assert_min_max(0.2, 0.2, $progress);