aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp/acp_extensions.php
diff options
context:
space:
mode:
authorDavid King <imkingdavid@gmail.com>2013-05-18 11:20:47 -0400
committerDavid King <imkingdavid@gmail.com>2013-05-18 11:20:47 -0400
commitd8ed228ddf2f4117a5a8044e9903ef22febdeb4a (patch)
tree67621e4f166aab54861003b4500133a28e7b3fdd /phpBB/includes/acp/acp_extensions.php
parent367b3dac8c910e7877139d4631e63e44f4f843f0 (diff)
parent20815ed5a2032dbad628304d31a0c29b6eef3d4f (diff)
downloadforums-d8ed228ddf2f4117a5a8044e9903ef22febdeb4a.tar
forums-d8ed228ddf2f4117a5a8044e9903ef22febdeb4a.tar.gz
forums-d8ed228ddf2f4117a5a8044e9903ef22febdeb4a.tar.bz2
forums-d8ed228ddf2f4117a5a8044e9903ef22febdeb4a.tar.xz
forums-d8ed228ddf2f4117a5a8044e9903ef22febdeb4a.zip
Merge remote-tracking branch 'EXreaction/ticket/11415' into develop
* EXreaction/ticket/11415: [ticket/11415] Add test for find_from_extension() [ticket/11415] Send the extension base the finder rather than the manager [ticket/11415] Create function in finder find_from_extension [ticket/11415] Fix ext.manager constructor in tests [ticket/11415] Make migrator/ext.manager dependencies of the base ext class [ticket/11415] Remove migrator dependency from extension manager [ticket/11415] Move migrator to base extension class from ext.manager [ticket/11415] Move while loop from ext manager to acp_extensions.php
Diffstat (limited to 'phpBB/includes/acp/acp_extensions.php')
-rw-r--r--phpBB/includes/acp/acp_extensions.php34
1 files changed, 25 insertions, 9 deletions
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index c52e4e0473..379e779c2c 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -44,6 +44,10 @@ class acp_extensions
$action = $request->variable('action', 'list');
$ext_name = $request->variable('ext_name', '');
+ // 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();
+
// Cancel action
if ($request->is_set_post('cancel'))
{
@@ -105,11 +109,15 @@ class acp_extensions
try
{
- if ($phpbb_extension_manager->enable_step($ext_name))
+ while ($phpbb_extension_manager->enable_step($ext_name))
{
- $template->assign_var('S_NEXT_STEP', true);
+ // 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)
+ {
+ $template->assign_var('S_NEXT_STEP', true);
- meta_refresh(0, $this->u_action . '&amp;action=enable&amp;ext_name=' . urlencode($ext_name));
+ meta_refresh(0, $this->u_action . '&amp;action=enable&amp;ext_name=' . urlencode($ext_name));
+ }
}
}
catch (phpbb_db_migration_exception $e)
@@ -139,11 +147,15 @@ class acp_extensions
break;
case 'disable':
- if ($phpbb_extension_manager->disable_step($ext_name))
+ while ($phpbb_extension_manager->disable_step($ext_name))
{
- $template->assign_var('S_NEXT_STEP', true);
+ // 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)
+ {
+ $template->assign_var('S_NEXT_STEP', true);
- meta_refresh(0, $this->u_action . '&amp;action=disable&amp;ext_name=' . urlencode($ext_name));
+ meta_refresh(0, $this->u_action . '&amp;action=disable&amp;ext_name=' . urlencode($ext_name));
+ }
}
$this->tpl_name = 'acp_ext_disable';
@@ -165,11 +177,15 @@ class acp_extensions
case 'purge':
try
{
- if ($phpbb_extension_manager->purge_step($ext_name))
+ while ($phpbb_extension_manager->purge_step($ext_name))
{
- $template->assign_var('S_NEXT_STEP', true);
+ // 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)
+ {
+ $template->assign_var('S_NEXT_STEP', true);
- meta_refresh(0, $this->u_action . '&amp;action=purge&amp;ext_name=' . urlencode($ext_name));
+ meta_refresh(0, $this->u_action . '&amp;action=purge&amp;ext_name=' . urlencode($ext_name));
+ }
}
}
catch (phpbb_db_migration_exception $e)