[ticket/11394] Relax Migration Tools

Do not throw as many exceptions in the migration tools (when something
unexpected occurs but can be safely ignored).

PHPBB3-11394
This commit is contained in:
Nathaniel Guse 2013-03-03 20:25:31 -06:00
parent bee4f8d818
commit 2aadc5a22c
4 changed files with 8 additions and 12 deletions

View file

@ -49,7 +49,7 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interfac
{ {
if (isset($this->config[$config_name])) if (isset($this->config[$config_name]))
{ {
throw new phpbb_db_migration_exception('CONFIG_ALREADY_EXIST', $config_name); return;
} }
$this->config->set($config_name, $config_value, !$is_dynamic); $this->config->set($config_name, $config_value, !$is_dynamic);
@ -105,7 +105,7 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interfac
{ {
if (!isset($this->config[$config_name])) if (!isset($this->config[$config_name]))
{ {
throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name); return;
} }
$this->config->delete($config_name); $this->config->delete($config_name);

View file

@ -236,7 +236,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
if ($this->exists($class, $parent, $data['module_langname'])) if ($this->exists($class, $parent, $data['module_langname']))
{ {
throw new phpbb_db_migration_exception('MODULE_ALREADY_EXIST', $data['module_langname']); return;
} }
if (!class_exists('acp_modules')) if (!class_exists('acp_modules'))
@ -369,7 +369,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
{ {
if (!$this->exists($class, $parent, $module)) if (!$this->exists($class, $parent, $module))
{ {
throw new phpbb_db_migration_exception('MODULE_NOT_EXIST', ((isset($this->user->lang[$module])) ? $this->user->lang[$module] : $module)); return;
} }
$parent_sql = ''; $parent_sql = '';
@ -442,7 +442,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
$result = $acp_modules->delete_module($module_id); $result = $acp_modules->delete_module($module_id);
if (!empty($result)) if (!empty($result))
{ {
throw new phpbb_db_migration_exception('MODULE_NOT_REMOVABLE', $module_id, $result); return;
} }
} }

View file

@ -107,7 +107,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
{ {
if ($this->exists($auth_option, $global)) if ($this->exists($auth_option, $global))
{ {
throw new phpbb_db_migration_exception('PERMISSION_ALREADY_EXIST', $auth_option); return;
} }
// We've added permissions, so set to true to notify the user. // We've added permissions, so set to true to notify the user.
@ -190,7 +190,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
{ {
if (!$this->exists($auth_option, $global)) if (!$this->exists($auth_option, $global))
{ {
throw new phpbb_db_migration_exception('PERMISSION_NOT_EXIST', $auth_option); return;
} }
if ($global) if ($global)
@ -315,7 +315,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
if (!$role_id) if (!$role_id)
{ {
throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $role_name); return;
} }
$sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' $sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . '

View file

@ -35,7 +35,6 @@ if (empty($lang) || !is_array($lang))
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array( $lang = array_merge($lang, array(
'CONFIG_ALREADY_EXIST' => 'The config setting "%s" unexpectedly already exists.',
'CONFIG_NOT_EXIST' => 'The config setting "%s" unexpectedly does not exist.', 'CONFIG_NOT_EXIST' => 'The config setting "%s" unexpectedly does not exist.',
'GROUP_NOT_EXIST' => 'The group "%s" unexpectedly does not exist.', 'GROUP_NOT_EXIST' => 'The group "%s" unexpectedly does not exist.',
@ -43,13 +42,10 @@ $lang = array_merge($lang, array(
'MIGRATION_EXCEPTION_ERROR' => 'Something went wrong during the request and an exception was thrown. The changes made before the error occurred were reversed to the best of our abilities, but you should check the board for errors.', 'MIGRATION_EXCEPTION_ERROR' => 'Something went wrong during the request and an exception was thrown. The changes made before the error occurred were reversed to the best of our abilities, but you should check the board for errors.',
'MIGRATION_NOT_FULFILLABLE' => 'The migration "%1$s" is not fulfillable, missing migration "%2$s".', 'MIGRATION_NOT_FULFILLABLE' => 'The migration "%1$s" is not fulfillable, missing migration "%2$s".',
'MODULE_ALREADY_EXIST' => 'The module "%s" unexpectedly already exists.',
'MODULE_ERROR' => 'An error occured while creating a module: %s', 'MODULE_ERROR' => 'An error occured while creating a module: %s',
'MODULE_INFO_FILE_NOT_EXIST' => 'A required module info file is missing: %2$s', 'MODULE_INFO_FILE_NOT_EXIST' => 'A required module info file is missing: %2$s',
'MODULE_NOT_EXIST' => 'A required module does not exist: %s', 'MODULE_NOT_EXIST' => 'A required module does not exist: %s',
'MODULE_NOT_REMOVABLE' => 'Module %1$s was unable to be removed: %2$s',
'PERMISSION_ALREADY_EXIST' => 'The permission setting "%s" unexpectedly already exists.',
'PERMISSION_NOT_EXIST' => 'The permission setting "%s" unexpectedly does not exist.', 'PERMISSION_NOT_EXIST' => 'The permission setting "%s" unexpectedly does not exist.',
'ROLE_NOT_EXIST' => 'The permission role "%s" unexpectedly does not exist.', 'ROLE_NOT_EXIST' => 'The permission role "%s" unexpectedly does not exist.',