mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
[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
This commit is contained in:
43
tests/dbal/migration/recall.php
Normal file
43
tests/dbal/migration/recall.php
Normal file
@@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user