aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2013-02-09 20:05:39 -0600
committerNathaniel Guse <nathaniel.guse@gmail.com>2013-02-09 20:05:39 -0600
commitfc4d5f74c0b82989370e899939d6f31e9a85723d (patch)
tree958fec017306f05582dc6c3a9cd304a0a3874ae8
parenta8da6b89e9da1d3b4e16317c21fc88fa1173d0f1 (diff)
downloadforums-fc4d5f74c0b82989370e899939d6f31e9a85723d.tar
forums-fc4d5f74c0b82989370e899939d6f31e9a85723d.tar.gz
forums-fc4d5f74c0b82989370e899939d6f31e9a85723d.tar.bz2
forums-fc4d5f74c0b82989370e899939d6f31e9a85723d.tar.xz
forums-fc4d5f74c0b82989370e899939d6f31e9a85723d.zip
[feature/migrations] Call revert correctly when purging an extension
PHPBB3-11318
-rw-r--r--phpBB/includes/extension/manager.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php
index 926cc015de..21a9ec1370 100644
--- a/phpBB/includes/extension/manager.php
+++ b/phpBB/includes/extension/manager.php
@@ -522,11 +522,13 @@ class phpbb_extension_manager
protected function handle_migrations($extension_name, $mode)
{
$migrations_path = $this->phpbb_root_path . $this->get_extension_path($extension_name) . 'migrations/';
- if (file_exists($migrations_path) && is_dir($migrations_path))
+ if (!file_exists($migrations_path) || !is_dir($migrations_path))
{
- $this->migrator->load_migrations($migrations_path);
+ return true;
}
+ $migrations = $this->migrator->load_migrations($migrations_path);
+
// What is a safe limit of execution time? Half the max execution time should be safe.
$safe_time_limit = (ini_get('max_execution_time') / 2);
$start_time = time();
@@ -546,14 +548,17 @@ class phpbb_extension_manager
}
else if ($mode == 'purge')
{
- while ($this->migrator->migration_state() !== false)
+ foreach ($migrations as $migration)
{
- $this->migrator->revert();
-
- // Are we approaching the time limit? If so we want to pause the update and continue after refreshing
- if ((time() - $start_time) >= $safe_time_limit)
+ while ($this->migrator->migration_state($migration) !== false)
{
- return false;
+ $this->migrator->revert($migration);
+
+ // Are we approaching the time limit? If so we want to pause the update and continue after refreshing
+ if ((time() - $start_time) >= $safe_time_limit)
+ {
+ return false;
+ }
}
}
}