1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/15011] All errors on metadata throw exceptions

There is inconsistency in the way error are treated in metadata_manager.
Some method return false on error, others throw exception.  With this,
the usage is homogeneus, and the uses of these are also adapted.
Using same ticket as it is the same issue, solved in a different way.

PHPBB3-15011
This commit is contained in:
javiexin
2017-02-15 23:51:08 +01:00
parent b9189ec325
commit 7646280d51
2 changed files with 34 additions and 47 deletions

View File

@@ -141,14 +141,13 @@ class acp_extensions
break;
case 'enable_pre':
if (!$md_manager->validate_dir())
try
{
trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
$md_manager->validate_enable();
}
if (!$md_manager->validate_enable())
catch (\phpbb\extension\exception $e)
{
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
trigger_error($e . adm_back_link($this->u_action), E_USER_WARNING);
}
$extension = $phpbb_extension_manager->get_extension($ext_name);
@@ -172,14 +171,13 @@ class acp_extensions
break;
case 'enable':
if (!$md_manager->validate_dir())
try
{
trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
$md_manager->validate_enable();
}
if (!$md_manager->validate_enable())
catch (\phpbb\extension\exception $e)
{
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
trigger_error($e . adm_back_link($this->u_action), E_USER_WARNING);
}
$extension = $phpbb_extension_manager->get_extension($ext_name);