[feature/migrations] Remove default values from necessary parameters

Clean up some comments

PHPBB3-9737
This commit is contained in:
Nathaniel Guse 2013-02-04 13:46:23 -06:00
parent 75244eafd9
commit 77df9109b6
3 changed files with 61 additions and 50 deletions

View file

@ -38,12 +38,14 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interfac
/** /**
* Add a config setting. * Add a config setting.
* *
* @param string $config_name The name of the config setting you would like to add * @param string $config_name The name of the config setting
* you would like to add
* @param mixed $config_value The value of the config setting * @param mixed $config_value The value of the config setting
* @param bool $is_dynamic True if it is dynamic (changes very often) and should not be stored in the cache, false if not. * @param bool $is_dynamic True if it is dynamic (changes very often)
* and should not be stored in the cache, false if not.
* @return null * @return null
*/ */
public function add($config_name, $config_value = '', $is_dynamic = false) public function add($config_name, $config_value, $is_dynamic = false)
{ {
if (isset($this->config[$config_name])) if (isset($this->config[$config_name]))
{ {
@ -56,11 +58,12 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interfac
/** /**
* Update an existing config setting. * Update an existing config setting.
* *
* @param string $config_name The name of the config setting you would like to update * @param string $config_name The name of the config setting you would
* like to update
* @param mixed $config_value The value of the config setting * @param mixed $config_value The value of the config setting
* @return null * @return null
*/ */
public function update($config_name, $config_value = '') public function update($config_name, $config_value)
{ {
if (!isset($this->config[$config_name])) if (!isset($this->config[$config_name]))
{ {
@ -71,14 +74,17 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interfac
} }
/** /**
* Update a config setting if the first argument equal to the current config value * Update a config setting if the first argument equal to the
* current config value
* *
* @param bool $compare If equal to the current config value, will be updated to the new config value, otherwise not * @param string $compare If equal to the current config value, will be
* @param string $config_name The name of the config setting you would like to update * updated to the new config value, otherwise not
* @param string $config_name The name of the config setting you would
* like to update
* @param mixed $config_value The value of the config setting * @param mixed $config_value The value of the config setting
* @return null * @return null
*/ */
public function update_if_equals($compare, $config_name, $config_value = '') public function update_if_equals($compare, $config_name, $config_value)
{ {
if (!isset($this->config[$config_name])) if (!isset($this->config[$config_name]))
{ {
@ -91,7 +97,8 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interfac
/** /**
* Remove an existing config setting. * Remove an existing config setting.
* *
* @param string $config_name The name of the config setting you would like to remove * @param string $config_name The name of the config setting you would
* like to remove
* @return null * @return null
*/ */
public function remove($config_name) public function remove($config_name)
@ -105,12 +112,7 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interfac
} }
/** /**
* Reverse an original install action * {@inheritdoc}
*
* First argument is the original call to the class (e.g. add, remove)
* After the first argument, send the original arguments to the function in the original call
*
* @return null
*/ */
public function reverse() public function reverse()
{ {

View file

@ -66,8 +66,10 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
* Check if a module exists * Check if a module exists
* *
* @param string $class The module class(acp|mcp|ucp) * @param string $class The module class(acp|mcp|ucp)
* @param int|string|bool $parent The parent module_id|module_langname (0 for no parent). Use false to ignore the parent check and check class wide. * @param int|string|bool $parent The parent module_id|module_langname (0 for no parent).
* @param int|string $module The module_id|module_langname you would like to check for to see if it exists * Use false to ignore the parent check and check class wide.
* @param int|string $module The module_id|module_langname you would like to
* check for to see if it exists
* @return bool true/false if module exists * @return bool true/false if module exists
*/ */
public function exists($class, $parent, $module) public function exists($class, $parent, $module)
@ -131,9 +133,13 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
* *
* @param string $class The module class(acp|mcp|ucp) * @param string $class The module class(acp|mcp|ucp)
* @param int|string $parent The parent module_id|module_langname (0 for no parent) * @param int|string $parent The parent module_id|module_langname (0 for no parent)
* @param array $data an array of the data on the new module. This can be setup in two different ways. * @param array $data an array of the data on the new module.
* 1. The "manual" way. For inserting a category or one at a time. It will be merged with the base array shown a bit below, * This can be setup in two different ways.
* but at the least requires 'module_langname' to be sent, and, if you want to create a module (instead of just a category) you must send module_basename and module_mode. * 1. The "manual" way. For inserting a category or one at a time.
* It will be merged with the base array shown a bit below,
* but at the least requires 'module_langname' to be sent, and,
* if you want to create a module (instead of just a category) you must
* send module_basename and module_mode.
* array( * array(
* 'module_enabled' => 1, * 'module_enabled' => 1,
* 'module_display' => 1, * 'module_display' => 1,
@ -144,14 +150,19 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
* 'module_mode' => '', * 'module_mode' => '',
* 'module_auth' => '', * 'module_auth' => '',
* ) * )
* 2. The "automatic" way. For inserting multiple at a time based on the specs in the info file for the module(s). For this to work the modules must be correctly setup in the info file. * 2. The "automatic" way. For inserting multiple at a time based on the
* An example follows (this would insert the settings, log, and flag modes from the includes/acp/info/acp_asacp.php file): * specs in the info file for the module(s). For this to work the
* modules must be correctly setup in the info file.
* An example follows (this would insert the settings, log, and flag
* modes from the includes/acp/info/acp_asacp.php file):
* array( * array(
* 'module_basename' => 'asacp', * 'module_basename' => 'asacp',
* 'modes' => array('settings', 'log', 'flag'), * 'modes' => array('settings', 'log', 'flag'),
* ) * )
* Optionally you may not send 'modes' and it will insert all of the modules in that info file. * Optionally you may not send 'modes' and it will insert all of the
* @param string|bool $include_path If you would like to use a custom include path, specify that here * modules in that info file.
* @param string|bool $include_path If you would like to use a custom include
* path, specify that here
* @return null * @return null
*/ */
public function add($class, $parent = 0, $data = array(), $include_path = false) public function add($class, $parent = 0, $data = array(), $include_path = false)
@ -334,9 +345,11 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
* Remove a module * Remove a module
* *
* @param string $class The module class(acp|mcp|ucp) * @param string $class The module class(acp|mcp|ucp)
* @param int|string|bool $parent The parent module_id|module_langname (0 for no parent). Use false to ignore the parent check and check class wide. * @param int|string|bool $parent The parent module_id|module_langname(0 for no parent).
* Use false to ignore the parent check and check class wide.
* @param int|string $module The module id|module_langname * @param int|string $module The module id|module_langname
* @param string|bool $include_path If you would like to use a custom include path, specify that here * @param string|bool $include_path If you would like to use a custom include path,
* specify that here
* @return null * @return null
*/ */
public function remove($class, $parent = 0, $module = '', $include_path = false) public function remove($class, $parent = 0, $module = '', $include_path = false)
@ -473,12 +486,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
} }
/** /**
* Reverse an original install action * {@inheritdoc}
*
* First argument is the original call to the class (e.g. add, remove)
* After the first argument, send the original arguments to the function in the original call
*
* @return null
*/ */
public function reverse() public function reverse()
{ {

View file

@ -61,7 +61,8 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
* Check if a permission (auth) setting exists * Check if a permission (auth) setting exists
* *
* @param string $auth_option The name of the permission (auth) option * @param string $auth_option The name of the permission (auth) option
* @param bool $global True for checking a global permission setting, False for a local permission setting * @param bool $global True for checking a global permission setting,
* False for a local permission setting
* @return bool true if it exists, false if not * @return bool true if it exists, false if not
*/ */
public function exists($auth_option, $global = true) public function exists($auth_option, $global = true)
@ -98,7 +99,8 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
* Add a permission (auth) option * Add a permission (auth) option
* *
* @param string $auth_option The name of the permission (auth) option * @param string $auth_option The name of the permission (auth) option
* @param bool $global True for checking a global permission setting, False for a local permission setting * @param bool $global True for checking a global permission setting,
* False for a local permission setting
* @return null * @return null
*/ */
public function add($auth_option, $global = true, $copy_from = false) public function add($auth_option, $global = true, $copy_from = false)
@ -180,7 +182,8 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
* Remove a permission (auth) option * Remove a permission (auth) option
* *
* @param string $auth_option The name of the permission (auth) option * @param string $auth_option The name of the permission (auth) option
* @param bool $global True for checking a global permission setting, False for a local permission setting * @param bool $global True for checking a global permission setting,
* False for a local permission setting
* @return null * @return null
*/ */
public function remove($auth_option, $global = true) public function remove($auth_option, $global = true)
@ -239,7 +242,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
* @param sting $role_type The type (u_, m_, a_) * @param sting $role_type The type (u_, m_, a_)
* @return null * @return null
*/ */
public function role_add($role_name, $role_type = '', $role_description = '') public function role_add($role_name, $role_type, $role_description = '')
{ {
$sql = 'SELECT role_id $sql = 'SELECT role_id
FROM ' . ACL_ROLES_TABLE . " FROM ' . ACL_ROLES_TABLE . "
@ -277,7 +280,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
* @param string $new_role_name The new role name * @param string $new_role_name The new role name
* @return null * @return null
*/ */
public function role_update($old_role_name, $new_role_name = '') public function role_update($old_role_name, $new_role_name)
{ {
$sql = 'SELECT role_id $sql = 'SELECT role_id
FROM ' . ACL_ROLES_TABLE . " FROM ' . ACL_ROLES_TABLE . "
@ -332,12 +335,14 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
* Allows you to set permissions for a certain group/role * Allows you to set permissions for a certain group/role
* *
* @param string $name The name of the role/group * @param string $name The name of the role/group
* @param string|array $auth_option The auth_option or array of auth_options you would like to set * @param string|array $auth_option The auth_option or array of
* auth_options you would like to set
* @param string $type The type (role|group) * @param string $type The type (role|group)
* @param bool $has_permission True if you want to give them permission, false if you want to deny them permission * @param bool $has_permission True if you want to give them permission,
* false if you want to deny them permission
* @return null * @return null
*/ */
public function permission_set($name, $auth_option = array(), $type = 'role', $has_permission = true) public function permission_set($name, $auth_option, $type = 'role', $has_permission = true)
{ {
if (!is_array($auth_option)) if (!is_array($auth_option))
{ {
@ -477,11 +482,12 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
* Allows you to unset (remove) permissions for a certain group/role * Allows you to unset (remove) permissions for a certain group/role
* *
* @param string $name The name of the role/group * @param string $name The name of the role/group
* @param string|array $auth_option The auth_option or array of auth_options you would like to set * @param string|array $auth_option The auth_option or array of
* auth_options you would like to set
* @param string $type The type (role|group) * @param string $type The type (role|group)
* @return null * @return null
*/ */
public function permission_unset($name, $auth_option = array(), $type = 'role') public function permission_unset($name, $auth_option, $type = 'role')
{ {
if (!is_array($auth_option)) if (!is_array($auth_option))
{ {
@ -565,12 +571,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
} }
/** /**
* Reverse an original install action * {@inheritdoc}
*
* First argument is the original call to the class (e.g. add, remove)
* After the first argument, send the original arguments to the function in the original call
*
* @return null
*/ */
public function reverse() public function reverse()
{ {