diff options
Diffstat (limited to 'phpBB/phpbb/install')
-rw-r--r-- | phpBB/phpbb/install/module/install_finish/task/install_extensions.php | 17 | ||||
-rw-r--r-- | phpBB/phpbb/install/module/update_database/task/update_extensions.php | 61 |
2 files changed, 44 insertions, 34 deletions
diff --git a/phpBB/phpbb/install/module/install_finish/task/install_extensions.php b/phpBB/phpbb/install/module/install_finish/task/install_extensions.php index 9db922b7f4..eb44bb780b 100644 --- a/phpBB/phpbb/install/module/install_finish/task/install_extensions.php +++ b/phpBB/phpbb/install/module/install_finish/task/install_extensions.php @@ -102,18 +102,17 @@ class install_extensions extends \phpbb\install\task_base $install_extensions = $this->iohandler->get_input('install-extensions', array()); - // Find available extensions - foreach ($this->finder as $file) - { - /** @var \SplFileInfo $file */ - $ext_name = preg_replace('#(.+[\\/\\\]ext[\\/\\\])(\w+)[\\/\\\](\w+)#', '$2/$3', dirname($file->getRealPath())); + $available_extensions = $this->extension_manager->all_available(); + // Install extensions + foreach ($available_extensions as $ext_name => $ext_path) + { if (!empty($install_extensions) && !in_array($ext_name, $install_extensions)) { continue; } - if ($this->extension_manager->is_available($ext_name)) + try { $this->extension_manager->enable($ext_name); $extensions = $this->get_extensions(); @@ -122,12 +121,18 @@ class install_extensions extends \phpbb\install\task_base { // Create log $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($ext_name)); + $this->iohandler->add_success_message(array('CLI_EXTENSION_ENABLE_SUCCESS', $ext_name)); } else { $this->iohandler->add_log_message(array('CLI_EXTENSION_ENABLE_FAILURE', $ext_name)); } } + catch (\Exception $e) + { + // Add fail log and continue + $this->iohandler->add_log_message(array('CLI_EXTENSION_ENABLE_FAILURE', $ext_name)); + } } } diff --git a/phpBB/phpbb/install/module/update_database/task/update_extensions.php b/phpBB/phpbb/install/module/update_database/task/update_extensions.php index 0a339f11e8..e8b73db25a 100644 --- a/phpBB/phpbb/install/module/update_database/task/update_extensions.php +++ b/phpBB/phpbb/install/module/update_database/task/update_extensions.php @@ -143,47 +143,52 @@ class update_extensions extends task_base } } - // Find available extensions - foreach ($this->finder as $file) - { - /** @var \SplFileInfo $file */ - $ext_name = preg_replace('#(.+[\\/\\\]ext[\\/\\\])(\w+)[\\/\\\](\w+)#', '$2/$3', dirname($file->getRealPath())); + $available_extensions = $this->extension_manager->all_available(); + // Update available extensions + foreach ($available_extensions as $ext_name => $ext_path) + { // Update extensions if: // 1) Extension is currently enabled // 2) Extension was implicitly defined as needing an update // 3) Extension was newly added as default phpBB extension in // this update and should be enabled by default. - if ($this->extension_manager->is_available($ext_name) && - ( - $this->extension_manager->is_enabled($ext_name) || - in_array($ext_name, $update_extensions) || - in_array($ext_name, $default_update_extensions) - ) + if ($this->extension_manager->is_enabled($ext_name) || + in_array($ext_name, $update_extensions) || + in_array($ext_name, $default_update_extensions) ) { - $extension_enabled = $this->extension_manager->is_enabled($ext_name); - if ($extension_enabled) + try { - $this->extension_manager->disable($ext_name); + $extension_enabled = $this->extension_manager->is_enabled($ext_name); + if ($extension_enabled) + { + $this->extension_manager->disable($ext_name); + } + $this->extension_manager->enable($ext_name); + $extensions = $this->get_extensions(); + + if (isset($extensions[$ext_name]) && $extensions[$ext_name]['ext_active']) + { + // Create log + $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($ext_name)); + $this->iohandler->add_success_message(array('CLI_EXTENSION_ENABLE_SUCCESS', $ext_name)); + } else + { + $this->iohandler->add_log_message('CLI_EXTENSION_ENABLE_FAILURE', array($ext_name)); + } + + // Disable extensions if it was disabled by the admin before + if (!$extension_enabled && !in_array($ext_name, $default_update_extensions)) + { + $this->extension_manager->disable($ext_name); + } } - $this->extension_manager->enable($ext_name); - $extensions = $this->get_extensions(); - - if (isset($extensions[$ext_name]) && $extensions[$ext_name]['ext_active']) - { - // Create log - $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($ext_name)); - } else + catch (\Exception $e) { + // Add fail log and continue $this->iohandler->add_log_message('CLI_EXTENSION_ENABLE_FAILURE', array($ext_name)); } - - // Disable extensions if it was disabled by the admin before - if (!$extension_enabled && !in_array($ext_name, $default_update_extensions)) - { - $this->extension_manager->disable($ext_name); - } } } } |