Migrations/Tools/Module

The module tool allows you to add or remove modules in the ucp, mcp, or acp.

Note
The documentation is mostly copied from UMIL.module tools, since the functionality is identical.

Umil.module_add, Umil.module_remove

=Add Module= Add a new module

array('module.add', array( mixed $class [, mixed $parent [, array $data [, mixed $include_path ]]] ))

Manually specifying module info
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. $data = array(   'module_enabled'    => 1,    'module_display'    => 1,    'module_basename'   => ,    'module_class'      => $class,    'parent_id'         => (int) $parent,    'module_langname'   => ,    'module_mode'       => ,    'module_auth'       => , );

Automatically determining module info
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. An example follows (this would insert the settings, log, and flag modes from the includes/acp/info/acp_asacp.php file): $data = array(   'module_basename'   => 'acp_asacp',    'modes'             => array('settings', 'log', 'flag'), ); Optionally you may omit 'modes' and it will insert all of the modules in that info file.

Example
public function update_data {   return array(        // Add a new category named ACP_CAT_TEST_MOD to ACP_CAT_DOT_MODS        array('module.add', array(            'acp',            'ACP_CAT_DOT_MODS',            'ACP_CAT_TEST_MOD'       )),

// Add the settings and features modes from the acp_board module to the ACP_CAT_TEST_MOD category using the "automatic" method. array('module.add', array( 'acp', 'ACP_CAT_TEST_MOD', array(               'module_basename'       => 'acp_board',                'modes'                 => array('settings', 'features'),            ), )),

// Add the avatar mode from acp_board to the ACP_CAT_TEST_MOD category using the "manual" method. array('module.add', array( 'acp', 'ACP_CAT_TEST_MOD', array(               'module_basename'   => 'acp_board',                'module_langname'   => 'ACP_AVATAR_SETTINGS',                'module_mode'       => 'avatar',                'module_auth'       => 'acl_a_board && ext_vendor/name',            ), )),   )); }

=Remove Module= array('module.remove', array( mixed $class [, mixed $parent [, array $data [, mixed $include_path ]]] ))

Manually specifying module info
The "manual" way. When removing the module using the manual method you may specify a string (module_langname) or an integer (module_id)

Automatically determining module info
The "automatic" way. When removing the module using the automatic method you may use the same information sent through the $data array when using the automatic method of the module_add function. Just as with the automatic add method, this will automatically find the modules listed according to the given module_basename and modes from the _info file. For more information on this method see Umil.module_add

Example
public function update_data {   return array(        // Remove the avatar mode from acp_board to the ACP_CAT_TEST_MOD category using the "manual" method.        array('module.remove', array(            'acp',            'ACP_CAT_TEST_MOD',            array( 'module_basename'  => 'acp_board', 'module_langname'  => 'ACP_AVATAR_SETTINGS', 'module_mode'      => 'avatar', 'module_auth'      => 'acl_a_board && ext_vendor/name', ),       )),

// Remove the settings and features modes from the acp_board module to the ACP_CAT_TEST_MOD category using the "automatic" method. array('module.remove', array( 'acp', 'ACP_CAT_TEST_MOD', array(               'module_basename'       => 'acp_board',                'modes'                 => array('settings', 'features'),            ), )),

// Remove a new category named ACP_CAT_TEST_MOD to ACP_CAT_DOT_MODS array('module.remove', array( 'acp', 'ACP_CAT_DOT_MODS', 'ACP_CAT_TEST_MOD' )),   )); }