diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-01-10 12:49:13 -0600 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-01-10 12:49:13 -0600 |
commit | ddb1eaab6868cfac70b7b202468cab29315b794d (patch) | |
tree | eeac822752a856b0457b189bfcc09699ffdbef4d /tests/dbal/migration | |
parent | 44c10f661ee548ae08fe81ba76f47f1c8134b96f (diff) | |
download | forums-ddb1eaab6868cfac70b7b202468cab29315b794d.tar forums-ddb1eaab6868cfac70b7b202468cab29315b794d.tar.gz forums-ddb1eaab6868cfac70b7b202468cab29315b794d.tar.bz2 forums-ddb1eaab6868cfac70b7b202468cab29315b794d.tar.xz forums-ddb1eaab6868cfac70b7b202468cab29315b794d.zip |
[feature/migrations] Test for calling a step multiple times
This is used when a long-running process is needed during an update. For
example, iterating over all posts and applying some transformation. This
allows the process to be broken apart into multiple shorter steps to prevent
hitting the time limit.
PHPBB3-9737
Diffstat (limited to 'tests/dbal/migration')
-rw-r--r-- | tests/dbal/migration/recall.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/dbal/migration/recall.php b/tests/dbal/migration/recall.php new file mode 100644 index 0000000000..18d8b4a6d2 --- /dev/null +++ b/tests/dbal/migration/recall.php @@ -0,0 +1,43 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2011 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* +*/ + +class phpbb_dbal_migration_recall extends phpbb_db_migration +{ + function depends_on() + { + return array(); + } + + function update_schema() + { + return array(); + } + + function update_data() + { + return array( + array('custom', array(array(&$this, 'test_call'))), + ); + } + + // This function should be called 10 times + function test_call($input) + { + global $migrator_test_call_input; + + $migrator_test_call_input = (int) $input; + + if ($migrator_test_call_input < 10) + { + return ($migrator_test_call_input + 1); + } + + return; + } +} |