Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
6edd90cc
Commit
6edd90cc
authored
Oct 15, 2013
by
sam marshall
Browse files
MDL-42084 Backup: Update time limit to avoid regression, use new class
parent
366b19a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
backup/util/progress/core_backup_progress.class.php
View file @
6edd90cc
...
...
@@ -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
=
12
0
;
const
TIME_LIMIT_WITHOUT_PROGRESS
=
360
0
;
/**
* @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
();
}
...
...
backup/util/progress/tests/progress_test.php
View file @
6edd90cc
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment