aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/install/module/install_finish
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2016-02-04 09:45:32 +0100
committerMarc Alexander <admin@m-a-styles.de>2016-12-03 14:20:28 +0100
commit90a5e22eb51fa20c94d576ffc5cdb49fb31dab3a (patch)
tree3f6adcb936802146e47574134e8bc22d5f3ab2da /phpBB/phpbb/install/module/install_finish
parentc07ecb060dd04c76d8bd166a0a8a7226a8167f06 (diff)
downloadforums-90a5e22eb51fa20c94d576ffc5cdb49fb31dab3a.tar
forums-90a5e22eb51fa20c94d576ffc5cdb49fb31dab3a.tar.gz
forums-90a5e22eb51fa20c94d576ffc5cdb49fb31dab3a.tar.bz2
forums-90a5e22eb51fa20c94d576ffc5cdb49fb31dab3a.tar.xz
forums-90a5e22eb51fa20c94d576ffc5cdb49fb31dab3a.zip
[ticket/14492] Correctly check if extension was enabled during install
Also fixed some incorrectly generated log messages and improved the regex. PHPBB3-14492
Diffstat (limited to 'phpBB/phpbb/install/module/install_finish')
-rw-r--r--phpBB/phpbb/install/module/install_finish/task/install_extensions.php42
1 files changed, 38 insertions, 4 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 d5086e7b82..c9a35a309a 100644
--- a/phpBB/phpbb/install/module/install_finish/task/install_extensions.php
+++ b/phpBB/phpbb/install/module/install_finish/task/install_extensions.php
@@ -49,6 +49,12 @@ class install_extensions extends \phpbb\install\task_base
/** @var \Symfony\Component\Finder\Finder */
protected $finder;
+ /** @var string Extension table */
+ protected $extension_table;
+
+ /** @var \phpbb\db\driver\driver_interface */
+ protected $db;
+
/**
* Constructor
*
@@ -61,11 +67,13 @@ class install_extensions extends \phpbb\install\task_base
{
$this->install_config = $install_config;
$this->iohandler = $iohandler;
+ $this->extension_table = $container->get_parameter('tables.ext');
$this->log = $container->get('log');
$this->user = $container->get('user');
$this->extension_manager = $container->get('ext.manager');
$this->config = $container->get('config');
+ $this->db = $container->get('dbal.conn');
$this->finder = new \Symfony\Component\Finder\Finder();
$this->finder->in($phpbb_root_path . 'ext/')
->ignoreUnreadableDirs()
@@ -101,14 +109,14 @@ class install_extensions extends \phpbb\install\task_base
foreach ($this->finder as $file)
{
/** @var \SplFileInfo $file */
- $ext_name = preg_replace('#(.+ext[\\/\\\])#', '', dirname($file->getRealPath()));
+ $ext_name = preg_replace('#(.+[\\/\\\]ext[\\/\\\])([^\\/\\\]+)[\\/\\\]([^\\/\\\]+)#', '$2/$3', dirname($file->getRealPath()));
if ($this->extension_manager->is_available($ext_name))
{
$this->extension_manager->enable($ext_name);
- $this->extension_manager->load_extensions();
+ $extensions = $this->get_extensions();
- if (!$this->extension_manager->is_enabled($ext_name))
+ if (isset($extensions[$ext_name]) && $extensions[$ext_name]['ext_active'])
{
// Create log
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($ext_name));
@@ -116,7 +124,7 @@ class install_extensions extends \phpbb\install\task_base
}
else
{
- $this->iohandler->add_log_message('CLI_EXTENSION_ENABLE_FAILURE', array($ext_name));
+ $this->iohandler->add_log_message(array('CLI_EXTENSION_ENABLE_FAILURE', $ext_name));
}
}
}
@@ -136,4 +144,30 @@ class install_extensions extends \phpbb\install\task_base
{
return 'TASK_INSTALL_EXTENSIONS';
}
+
+ /**
+ * Get extensions from database
+ *
+ * @return array List of extensions
+ */
+ private function get_extensions()
+ {
+ $sql = 'SELECT *
+ FROM ' . $this->extension_table;
+
+ $result = $this->db->sql_query($sql);
+ $extensions_row = $this->db->sql_fetchrowset($result);
+ $this->db->sql_freeresult($result);
+
+ $extensions = array();
+
+ foreach ($extensions_row as $extension)
+ {
+ $extensions[$extension['ext_name']] = $extension;
+ }
+
+ ksort($extensions);
+
+ return $extensions;
+ }
}