diff options
author | Marc Alexander <admin@m-a-styles.de> | 2019-09-30 21:21:50 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2019-09-30 21:21:50 +0200 |
commit | e54aa94e7714483f0f5ef8c18e21317a1f0524f6 (patch) | |
tree | 7364da57623f9bb48fe25a9dccc80426040a73e7 /phpBB/includes/acp | |
parent | d7c644a7923783f875ed7820d52388c8d9f765fb (diff) | |
download | forums-e54aa94e7714483f0f5ef8c18e21317a1f0524f6.tar forums-e54aa94e7714483f0f5ef8c18e21317a1f0524f6.tar.gz forums-e54aa94e7714483f0f5ef8c18e21317a1f0524f6.tar.bz2 forums-e54aa94e7714483f0f5ef8c18e21317a1f0524f6.tar.xz forums-e54aa94e7714483f0f5ef8c18e21317a1f0524f6.zip |
[ticket/15257] Improve readability of check_is_enableable
PHPBB3-15257
Diffstat (limited to 'phpBB/includes/acp')
-rw-r--r-- | phpBB/includes/acp/acp_extensions.php | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index a9cbb8956b..6ac70ce3a8 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -173,7 +173,7 @@ class acp_extensions $extension = $this->ext_manager->get_extension($ext_name); - $this->check_is_enableable($extension->is_enableable()); + $this->check_is_enableable($extension); if ($this->ext_manager->is_enabled($ext_name)) { @@ -208,7 +208,7 @@ class acp_extensions $extension = $this->ext_manager->get_extension($ext_name); - $this->check_is_enableable($extension->is_enableable()); + $this->check_is_enableable($extension); try { @@ -728,15 +728,22 @@ class acp_extensions * Checks whether the extension can be enabled. Triggers error if not. * Error message can be set by the extension. * - * @param bool|array $enableable True if extension is enableable, array of reasons - * if not, false for generic reason. + * @param \phpbb\extension\extension_interface $extension Extension to check */ - protected function check_is_enableable($enableable) + protected function check_is_enableable(\phpbb\extension\extension_interface $extension) { - if ($enableable !== true) + $message = $extension->is_enableable(); + if ($message !== true) { - $message = !empty($enableable) ? $enableable : $this->user->lang('EXTENSION_NOT_ENABLEABLE'); - $message = is_array($message) ? implode('<br />', $message) : $message; + if (empty($message)) + { + $message = $this->user->lang('EXTENSION_NOT_ENABLEABLE'); + } + else if (is_array($message)) + { + $message = implode('<br>', $message); + } + trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); } } |