mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[feature/migrations] Remove references as it is now 3.1 code
PHPBB3-9737
This commit is contained in:
parent
91a921a96b
commit
82efb3e446
45 changed files with 1179 additions and 280 deletions
|
@ -44,10 +44,10 @@ class phpbb_db_migration
|
|||
* @param string $phpbb_root_path
|
||||
* @param string $php_ext
|
||||
*/
|
||||
function phpbb_db_migration(&$db, &$db_tools, $table_prefix, $phpbb_root_path, $php_ext)
|
||||
function phpbb_db_migration($db, $db_tools, $table_prefix, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
$this->db = &$db;
|
||||
$this->db_tools = &$db_tools;
|
||||
$this->db = $db;
|
||||
$this->db_tools = $db_tools;
|
||||
$this->table_prefix = $table_prefix;
|
||||
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_1_rc1');
|
||||
return array('phpbb_db_migration_data_3_0_1_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_10 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_10 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_10_rc3');
|
||||
return array('phpbb_db_migration_data_3_0_10_rc3');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_10_rc1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_10_rc1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_9');
|
||||
return array('phpbb_db_migration_data_3_0_9');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_10_rc2 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_10_rc2 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_10_rc1');
|
||||
return array('phpbb_db_migration_data_3_0_10_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_10_rc3 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_10_rc3 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_10_rc2');
|
||||
return array('phpbb_db_migration_data_3_0_10_rc2');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_11 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_11 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_11_rc2');
|
||||
return array('phpbb_db_migration_data_3_0_11_rc2');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_11_rc1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_11_rc1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_10');
|
||||
return array('phpbb_db_migration_data_3_0_10');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_11_rc2 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_11_rc2 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_11_rc1');
|
||||
return array('phpbb_db_migration_data_3_0_11_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_12_rc1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_12_rc1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_11');
|
||||
return array('phpbb_db_migration_data_3_0_11');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_1_rc1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_1_rc1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_2 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_2 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_2_rc2');
|
||||
return array('phpbb_db_migration_data_3_0_2_rc2');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_1_rc1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_1_rc1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_1');
|
||||
return array('phpbb_db_migration_data_3_0_1');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_2_rc2 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_2_rc2 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_2_rc1');
|
||||
return array('phpbb_db_migration_data_3_0_2_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_3 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_3 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_2_rc2');
|
||||
return array('phpbb_db_migration_data_3_0_2_rc2');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_3_rc1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_3_rc1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_2');
|
||||
return array('phpbb_db_migration_data_3_0_2');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_4 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_4 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_4_rc1');
|
||||
return array('phpbb_db_migration_data_3_0_4_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_4_rc1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_4_rc1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_3');
|
||||
return array('phpbb_db_migration_data_3_0_3');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_5 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_5 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_5_rc1part2');
|
||||
return array('phpbb_db_migration_data_3_0_5_rc1part2');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_5_rc1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_5_rc1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_4');
|
||||
return array('phpbb_db_migration_data_3_0_4');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_5_rc1part2 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_5_rc1part2 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_5_rc1');
|
||||
return array('phpbb_db_migration_data_3_0_5_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_6 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_6 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_6_rc4');
|
||||
return array('phpbb_db_migration_data_3_0_6_rc4');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_6_rc1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_6_rc1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_5');
|
||||
return array('phpbb_db_migration_data_3_0_5');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
|
@ -62,12 +62,10 @@ class phpbb_db_migration_3_0_6_rc1 extends phpbb_db_migration
|
|||
function update_data()
|
||||
{
|
||||
return array(
|
||||
//array('custom', array(array(&$this, '')))
|
||||
array('config.add', array('captcha_plugin', 'phpbb_captcha_nogd')),
|
||||
array('config.update_if', array(
|
||||
array('if', array(
|
||||
($this->config['captcha_gd']),
|
||||
'captcha_plugin',
|
||||
'phpbb_captcha_gd',
|
||||
array('config.update', array('captcha_plugin', 'phpbb_captcha_gd')),
|
||||
)),
|
||||
|
||||
array('config.add', array('feed_enable', 0)),
|
||||
|
@ -89,83 +87,70 @@ class phpbb_db_migration_3_0_6_rc1 extends phpbb_db_migration
|
|||
array('config.add', array('delete_time', $this->config['edit_time'])),
|
||||
|
||||
array('config.add', array('allow_avatar', 0)),
|
||||
array('config.add_if', array(
|
||||
array('if', array(
|
||||
($this->config['allow_avatar_upload'] || $this->config['allow_avatar_local'] || $this->config['allow_avatar_remote']),
|
||||
'allow_avatar',
|
||||
1,
|
||||
array('config.add', array('allow_avatar', 1)),
|
||||
)),
|
||||
array('config.add', array('allow_avatar_remote_upload', 0)),
|
||||
array('config.add_if', array(
|
||||
array('if', array(
|
||||
($this->config['allow_avatar_remote'] && $this->config['allow_avatar_upload']),
|
||||
'allow_avatar_remote_upload',
|
||||
1,
|
||||
array('config.add', array('allow_avatar_remote_upload', 1)),
|
||||
)),
|
||||
|
||||
array('module.add', array(
|
||||
'feed' => array(
|
||||
'base' => 'board',
|
||||
'class' => 'acp',
|
||||
'title' => 'ACP_FEED_SETTINGS',
|
||||
'auth' => 'acl_a_board',
|
||||
'cat' => 'ACP_BOARD_CONFIGURATION',
|
||||
'after' => array('signature', 'ACP_SIGNATURE_SETTINGS')
|
||||
'acp',
|
||||
'ACP_BOARD_CONFIGURATION',
|
||||
array(
|
||||
'module_basename' => 'board',
|
||||
'modes' => array('feed'),
|
||||
),
|
||||
)),
|
||||
array('module.add', array(
|
||||
'warnings' => array(
|
||||
'base' => 'users',
|
||||
'class' => 'acp',
|
||||
'title' => 'ACP_USER_WARNINGS',
|
||||
'auth' => 'acl_a_user',
|
||||
'display' => 0,
|
||||
'cat' => 'ACP_CAT_USERS',
|
||||
'after' => array('feedback', 'ACP_USER_FEEDBACK')
|
||||
'acp',
|
||||
'ACP_CAT_USERS',
|
||||
array(
|
||||
'module_basename' => 'users',
|
||||
'modes' => array('warnings'),
|
||||
),
|
||||
)),
|
||||
array('module.add', array(
|
||||
'send_statistics' => array(
|
||||
'base' => 'send_statistics',
|
||||
'class' => 'acp',
|
||||
'title' => 'ACP_SEND_STATISTICS',
|
||||
'auth' => 'acl_a_server',
|
||||
'cat' => 'ACP_SERVER_CONFIGURATION'
|
||||
'acp',
|
||||
'ACP_SERVER_CONFIGURATION',
|
||||
array(
|
||||
'module_basename' => 'send_statistics',
|
||||
'modes' => array('send_statistics'),
|
||||
),
|
||||
)),
|
||||
array('module.add', array(
|
||||
'setting_forum_copy' => array(
|
||||
'base' => 'permissions',
|
||||
'class' => 'acp',
|
||||
'title' => 'ACP_FORUM_PERMISSIONS_COPY',
|
||||
'auth' => 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth',
|
||||
'cat' => 'ACP_FORUM_BASED_PERMISSIONS',
|
||||
'after' => array('setting_forum_local', 'ACP_FORUM_PERMISSIONS')
|
||||
'acp',
|
||||
'ACP_FORUM_BASED_PERMISSIONS',
|
||||
array(
|
||||
'module_basename' => 'permissions',
|
||||
'modes' => array('setting_forum_copy'),
|
||||
),
|
||||
)),
|
||||
array('module.add', array(
|
||||
'pm_reports' => array(
|
||||
'base' => 'pm_reports',
|
||||
'class' => 'mcp',
|
||||
'title' => 'MCP_PM_REPORTS_OPEN',
|
||||
'auth' => 'aclf_m_report',
|
||||
'cat' => 'MCP_REPORTS'
|
||||
'mcp',
|
||||
'MCP_REPORTS',
|
||||
array(
|
||||
'module_basename' => 'pm_reports',
|
||||
'modes' => array('pm_reports'),
|
||||
),
|
||||
)),
|
||||
array('module.add', array(
|
||||
'pm_reports_closed' => array(
|
||||
'base' => 'pm_reports',
|
||||
'class' => 'mcp',
|
||||
'title' => 'MCP_PM_REPORTS_CLOSED',
|
||||
'auth' => 'aclf_m_report',
|
||||
'cat' => 'MCP_REPORTS'
|
||||
'mcp',
|
||||
'MCP_REPORTS',
|
||||
array(
|
||||
'module_basename' => 'pm_reports',
|
||||
'modes' => array('pm_reports_closed'),
|
||||
),
|
||||
)),
|
||||
array('module.add', array(
|
||||
'pm_report_details' => array(
|
||||
'base' => 'pm_reports',
|
||||
'class' => 'mcp',
|
||||
'title' => 'MCP_PM_REPORT_DETAILS',
|
||||
'auth' => 'aclf_m_report',
|
||||
'cat' => 'MCP_REPORTS'
|
||||
'mcp',
|
||||
'MCP_REPORTS',
|
||||
array(
|
||||
'module_basename' => 'pm_reports',
|
||||
'modes' => array('pm_report_details'),
|
||||
),
|
||||
)),
|
||||
array('custom', array(array(&$this, 'add_newly_registered_group'))),
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_6_rc2 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_6_rc2 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_6_rc1');
|
||||
return array('phpbb_db_migration_data_3_0_6_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_6_rc3 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_6_rc3 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_6_rc2');
|
||||
return array('phpbb_db_migration_data_3_0_6_rc2');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_6_rc4 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_6_rc4 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_6_rc3');
|
||||
return array('phpbb_db_migration_data_3_0_6_rc3');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_7 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_7 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_7_rc2');
|
||||
return array('phpbb_db_migration_data_3_0_7_rc2');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_7_pl1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_7_pl1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_7');
|
||||
return array('phpbb_db_migration_data_3_0_7');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_7_rc1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_7_rc1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_6');
|
||||
return array('phpbb_db_migration_data_3_0_6');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_7_rc2 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_7_rc2 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_7_rc1');
|
||||
return array('phpbb_db_migration_data_3_0_7_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_8 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_8 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_8_rc1');
|
||||
return array('phpbb_db_migration_data_3_0_8_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_8_rc1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_8_rc1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_7_pl1');
|
||||
return array('phpbb_db_migration_data_3_0_7_pl1');
|
||||
}
|
||||
|
||||
function update_schema()
|
||||
|
@ -27,13 +27,11 @@ class phpbb_db_migration_3_0_8_rc1 extends phpbb_db_migration
|
|||
array('custom', array(array(&$this, 'update_bots'))),
|
||||
array('custom', array(array(&$this, 'delete_orphan_shadow_topics'))),
|
||||
array('module.add', array(
|
||||
'post' => array(
|
||||
'base' => 'board',
|
||||
'class' => 'acp',
|
||||
'title' => 'ACP_POST_SETTINGS',
|
||||
'auth' => 'acl_a_board',
|
||||
'cat' => 'ACP_MESSAGES',
|
||||
'after' => array('message', 'ACP_MESSAGE_SETTINGS')
|
||||
'acp',
|
||||
'ACP_MESSAGES',
|
||||
array(
|
||||
'module_basename' => 'board',
|
||||
'modes' => array('post'),
|
||||
),
|
||||
)),
|
||||
array('config.add', array('load_unreads_search', 1)),
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_9 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_9 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_9_rc4');
|
||||
return array('phpbb_db_migration_data_3_0_9_rc4');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_9_rc1 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_9_rc1 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_8');
|
||||
return array('phpbb_db_migration_data_3_0_8');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_9_rc2 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_9_rc2 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_9_rc1');
|
||||
return array('phpbb_db_migration_data_3_0_9_rc1');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_9_rc3 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_9_rc3 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_9_rc2');
|
||||
return array('phpbb_db_migration_data_3_0_9_rc2');
|
||||
}
|
||||
|
||||
function update_schema()
|
|
@ -7,11 +7,11 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_3_0_9_rc4 extends phpbb_db_migration
|
||||
class phpbb_db_migration_data_3_0_9_rc4 extends phpbb_db_migration
|
||||
{
|
||||
function depends_on()
|
||||
{
|
||||
return array('phpbb_db_migration_3_0_9_rc3');
|
||||
return array('phpbb_db_migration_data_3_0_9_rc3');
|
||||
}
|
||||
|
||||
function update_schema()
|
47
phpBB/includes/db/migration/tools/base.php
Normal file
47
phpBB/includes/db/migration/tools/base.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package migration
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_tools_base
|
||||
{
|
||||
/** @var phpbb_auth */
|
||||
protected $auth = null;
|
||||
|
||||
/** @var phpbb_cache_service */
|
||||
protected $cache = null;
|
||||
|
||||
/** @var phpbb_config */
|
||||
protected $config = null;
|
||||
|
||||
/** @var dbal */
|
||||
protected $db = null;
|
||||
|
||||
/** @var phpbb_template */
|
||||
protected $template = null;
|
||||
|
||||
/** @var phpbb_user */
|
||||
protected $user = null;
|
||||
|
||||
/** @var string */
|
||||
protected $phpbb_root_path = null;
|
||||
|
||||
/** @var string */
|
||||
protected $php_ext = null;
|
||||
|
||||
public function __construct(dbal $db, phpbb_cache_driver_interface $cache, phpbb_template $template, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->cache = $cache;
|
||||
$this->template = $template;
|
||||
$this->user = $user;
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
}
|
||||
}
|
106
phpBB/includes/db/migration/tools/config.php
Normal file
106
phpBB/includes/db/migration/tools/config.php
Normal file
|
@ -0,0 +1,106 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package migration
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_tools_config extends phpbb_db_migration_tools_base
|
||||
{
|
||||
/**
|
||||
* Config Exists
|
||||
*
|
||||
* This function is to check to see if a config variable exists or if it does not.
|
||||
*
|
||||
* @param string $config_name The name of the config setting you wish to check for.
|
||||
*
|
||||
* @return bool true/false if config exists
|
||||
*/
|
||||
public function exists($config_name)
|
||||
{
|
||||
return (bool) $this->config->offsetExists($config_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Config Add
|
||||
*
|
||||
* This function allows you to add a config setting.
|
||||
*
|
||||
* @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 bool $is_dynamic True if it is dynamic (changes very often) and should not be stored in the cache, false if not.
|
||||
*/
|
||||
public function add($config_name, $config_value = '', $is_dynamic = false)
|
||||
{
|
||||
if ($this->config_exists($config_name))
|
||||
{
|
||||
throw new phpbb_db_migration_exception('CONFIG_ALREADY_EXISTS', $config_name);
|
||||
}
|
||||
|
||||
$this->config->set($config_name, $config_value, $is_dynamic);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Config Update
|
||||
*
|
||||
* This function allows you to update an existing config setting.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function update($config_name, $config_value = '')
|
||||
{
|
||||
if (!$this->config_exists($config_name))
|
||||
{
|
||||
throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name);
|
||||
}
|
||||
|
||||
$this->config->set($config_name, $config_value);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Config Update If Equals
|
||||
*
|
||||
* This function allows you to 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 $config_name The name of the config setting you would like to update
|
||||
* @param mixed $config_value The value of the config setting
|
||||
*/
|
||||
public function update_if_equals($compare, $config_name, $config_value = '')
|
||||
{
|
||||
if (!$this->config_exists($config_name))
|
||||
{
|
||||
throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name);
|
||||
}
|
||||
|
||||
$this->config->set_atomic($config_name, $compare, $config_value);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Config Remove
|
||||
*
|
||||
* This function allows you to remove an existing config setting.
|
||||
*
|
||||
* @param string $config_name The name of the config setting you would like to remove
|
||||
*/
|
||||
public function remove($config_name)
|
||||
{
|
||||
if (!$this->config_exists($config_name))
|
||||
{
|
||||
throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name);
|
||||
}
|
||||
|
||||
$this->config->delete($config_name);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
419
phpBB/includes/db/migration/tools/module.php
Normal file
419
phpBB/includes/db/migration/tools/module.php
Normal file
|
@ -0,0 +1,419 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package migration
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_tools_module extends phpbb_db_migration_tools_base
|
||||
{
|
||||
/**
|
||||
* Module Exists
|
||||
*
|
||||
* Check if a module exists
|
||||
*
|
||||
* @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 $module The module_id|module_langname you would like to check for to see if it exists
|
||||
*
|
||||
* @return bool true/false if module exists
|
||||
*/
|
||||
public function exists($class, $parent, $module)
|
||||
{
|
||||
// the main root directory should return true
|
||||
if (!$module)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$class = $this->db->sql_escape($class);
|
||||
$module = $this->db->sql_escape($module);
|
||||
|
||||
$parent_sql = '';
|
||||
if ($parent !== false)
|
||||
{
|
||||
// Allows '' to be sent as 0
|
||||
$parent = (!$parent) ? 0 : $parent;
|
||||
|
||||
if (!is_numeric($parent))
|
||||
{
|
||||
$sql = 'SELECT module_id FROM ' . MODULES_TABLE . "
|
||||
WHERE module_langname = '" . $this->db->sql_escape($parent) . "'
|
||||
AND module_class = '$class'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if (!$row)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$parent_sql = 'AND parent_id = ' . (int) $row['module_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$parent_sql = 'AND parent_id = ' . (int) $parent;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT module_id FROM ' . MODULES_TABLE . "
|
||||
WHERE module_class = '$class'
|
||||
$parent_sql
|
||||
AND " . ((is_numeric($module)) ? 'module_id = ' . (int) $module : "module_langname = '$module'");
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module Add
|
||||
*
|
||||
* Add a new module
|
||||
*
|
||||
* @param string $class The module class(acp|mcp|ucp)
|
||||
* @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.
|
||||
* 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(
|
||||
* 'module_enabled' => 1,
|
||||
* 'module_display' => 1,
|
||||
* 'module_basename' => '',
|
||||
* 'module_class' => $class,
|
||||
* 'parent_id' => (int) $parent,
|
||||
* 'module_langname' => '',
|
||||
* 'module_mode' => '',
|
||||
* '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.
|
||||
* An example follows (this would insert the settings, log, and flag modes from the includes/acp/info/acp_asacp.php file):
|
||||
* array(
|
||||
* 'module_basename' => 'asacp',
|
||||
* 'modes' => array('settings', 'log', 'flag'),
|
||||
* )
|
||||
* Optionally you may not send 'modes' and it will insert all of the modules in that info file.
|
||||
* @param string|bool $include_path If you would like to use a custom include path, specify that here
|
||||
*/
|
||||
public function add($class, $parent = 0, $data = array(), $include_path = false)
|
||||
{
|
||||
// Allows '' to be sent as 0
|
||||
$parent = (!$parent) ? 0 : $parent;
|
||||
|
||||
// allow sending the name as a string in $data to create a category
|
||||
if (!is_array($data))
|
||||
{
|
||||
$data = array('module_langname' => $data);
|
||||
}
|
||||
|
||||
if (!isset($data['module_langname']))
|
||||
{
|
||||
// The "automatic" way
|
||||
$basename = (isset($data['module_basename'])) ? $data['module_basename'] : '';
|
||||
$basename = str_replace(array('/', '\\'), '', $basename);
|
||||
$class = str_replace(array('/', '\\'), '', $class);
|
||||
$info_file = "$class/info/{$class}_$basename.$this->phpEx";
|
||||
|
||||
// The manual and automatic ways both failed...
|
||||
if (!file_exists((($include_path === false) ? $this->phpbb_root_path . 'includes/' : $include_path) . $info_file))
|
||||
{
|
||||
throw new phpbb_db_migration_exception('MODULE_ADD', $class, $info_file);
|
||||
}
|
||||
|
||||
$classname = "{$class}_{$basename}_info";
|
||||
|
||||
if (!class_exists($classname))
|
||||
{
|
||||
include((($include_path === false) ? $this->phpbb_root_path . 'includes/' : $include_path) . $info_file);
|
||||
}
|
||||
|
||||
$info = new $classname;
|
||||
$module = $info->module();
|
||||
unset($info);
|
||||
|
||||
$result = '';
|
||||
foreach ($module['modes'] as $mode => $module_info)
|
||||
{
|
||||
if (!isset($data['modes']) || in_array($mode, $data['modes']))
|
||||
{
|
||||
$new_module = array(
|
||||
'module_basename' => $basename,
|
||||
'module_langname' => $module_info['title'],
|
||||
'module_mode' => $mode,
|
||||
'module_auth' => $module_info['auth'],
|
||||
'module_display' => (isset($module_info['display'])) ? $module_info['display'] : true,
|
||||
'before' => (isset($module_info['before'])) ? $module_info['before'] : false,
|
||||
'after' => (isset($module_info['after'])) ? $module_info['after'] : false,
|
||||
);
|
||||
|
||||
// Run the "manual" way with the data we've collected.
|
||||
$result .= ((isset($data['spacer'])) ? $data['spacer'] : '<br />') . $this->add($class, $parent, $new_module);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// The "manual" way
|
||||
add_log('admin', 'LOG_MODULE_ADD', ((isset($this->user->lang[$data['module_langname']])) ? $this->user->lang[$data['module_langname']] : $data['module_langname']));
|
||||
|
||||
$class = $this->db->sql_escape($class);
|
||||
|
||||
if (!is_numeric($parent))
|
||||
{
|
||||
$sql = 'SELECT module_id FROM ' . MODULES_TABLE . "
|
||||
WHERE module_langname = '" . $this->db->sql_escape($parent) . "'
|
||||
AND module_class = '$class'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if (!$row)
|
||||
{
|
||||
throw new phpbb_db_migration_exception('MODULE_PARENT_NOT_EXIST', $parent);
|
||||
}
|
||||
|
||||
$parent = $data['parent_id'] = $row['module_id'];
|
||||
}
|
||||
else if (!$this->exists($class, false, $parent))
|
||||
{
|
||||
throw new phpbb_db_migration_exception('MODULE_PARENT_NOT_EXIST', $parent);
|
||||
}
|
||||
|
||||
if ($this->exists($class, $parent, $data['module_langname']))
|
||||
{
|
||||
throw new phpbb_db_migration_exception('MODULE_ALREADY_EXIST', $data['module_langname']);
|
||||
}
|
||||
|
||||
if (!class_exists('acp_modules'))
|
||||
{
|
||||
include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->phpEx);
|
||||
$this->user->add_lang('acp/modules');
|
||||
}
|
||||
$acp_modules = new acp_modules();
|
||||
|
||||
$module_data = array(
|
||||
'module_enabled' => (isset($data['module_enabled'])) ? $data['module_enabled'] : 1,
|
||||
'module_display' => (isset($data['module_display'])) ? $data['module_display'] : 1,
|
||||
'module_basename' => (isset($data['module_basename'])) ? $data['module_basename'] : '',
|
||||
'module_class' => $class,
|
||||
'parent_id' => (int) $parent,
|
||||
'module_langname' => (isset($data['module_langname'])) ? $data['module_langname'] : '',
|
||||
'module_mode' => (isset($data['module_mode'])) ? $data['module_mode'] : '',
|
||||
'module_auth' => (isset($data['module_auth'])) ? $data['module_auth'] : '',
|
||||
);
|
||||
$result = $acp_modules->update_module_data($module_data, true);
|
||||
|
||||
// update_module_data can either return a string or an empty array...
|
||||
if (is_string($result))
|
||||
{
|
||||
// Error
|
||||
throw new phpbb_db_migration_exception('MODULE_ERROR', $result);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Success
|
||||
|
||||
// Move the module if requested above/below an existing one
|
||||
if (isset($data['before']) && $data['before'])
|
||||
{
|
||||
$sql = 'SELECT left_id FROM ' . MODULES_TABLE . '
|
||||
WHERE module_class = \'' . $class . '\'
|
||||
AND parent_id = ' . (int) $parent . '
|
||||
AND module_langname = \'' . $this->db->sql_escape($data['before']) . '\'';
|
||||
$this->db->sql_query($sql);
|
||||
$to_left = $this->db->sql_fetchfield('left_id');
|
||||
|
||||
$sql = 'UPDATE ' . MODULES_TABLE . " SET left_id = left_id + 2, right_id = right_id + 2
|
||||
WHERE module_class = '$class'
|
||||
AND left_id >= $to_left
|
||||
AND left_id < {$module_data['left_id']}";
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . MODULES_TABLE . " SET left_id = $to_left, right_id = " . ($to_left + 1) . "
|
||||
WHERE module_class = '$class'
|
||||
AND module_id = {$module_data['module_id']}";
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
else if (isset($data['after']) && $data['after'])
|
||||
{
|
||||
$sql = 'SELECT right_id FROM ' . MODULES_TABLE . '
|
||||
WHERE module_class = \'' . $class . '\'
|
||||
AND parent_id = ' . (int) $parent . '
|
||||
AND module_langname = \'' . $this->db->sql_escape($data['after']) . '\'';
|
||||
$this->db->sql_query($sql);
|
||||
$to_right = $this->db->sql_fetchfield('right_id');
|
||||
|
||||
$sql = 'UPDATE ' . MODULES_TABLE . " SET left_id = left_id + 2, right_id = right_id + 2
|
||||
WHERE module_class = '$class'
|
||||
AND left_id >= $to_right
|
||||
AND left_id < {$module_data['left_id']}";
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . MODULES_TABLE . ' SET left_id = ' . ($to_right + 1) . ', right_id = ' . ($to_right + 2) . "
|
||||
WHERE module_class = '$class'
|
||||
AND module_id = {$module_data['module_id']}";
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the Modules Cache
|
||||
$this->cache->destroy("_modules_$class");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module Remove
|
||||
*
|
||||
* Remove a module
|
||||
*
|
||||
* @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 $module The module id|module_langname
|
||||
* @param string|bool $include_path If you would like to use a custom include path, specify that here
|
||||
*/
|
||||
public function remove($class, $parent = 0, $module = '', $include_path = false)
|
||||
{
|
||||
// Imitation of module_add's "automatic" and "manual" method so the uninstaller works from the same set of instructions for umil_auto
|
||||
if (is_array($module))
|
||||
{
|
||||
if (isset($module['module_langname']))
|
||||
{
|
||||
// Manual Method
|
||||
return $this->remove($class, $parent, $module['module_langname'], $include_path);
|
||||
}
|
||||
|
||||
// Failed.
|
||||
if (!isset($module['module_basename']))
|
||||
{
|
||||
throw new phpbb_db_migration_exception('MODULE_NOT_EXIST');
|
||||
}
|
||||
|
||||
// Automatic method
|
||||
$basename = str_replace(array('/', '\\'), '', $module['module_basename']);
|
||||
$class = str_replace(array('/', '\\'), '', $class);
|
||||
$info_file = "$class/info/{$class}_$basename.$this->phpEx";
|
||||
|
||||
if (!file_exists((($include_path === false) ? $this->phpbb_root_path . 'includes/' : $include_path) . $info_file))
|
||||
{
|
||||
throw new phpbb_db_migration_exception('MODULE_NOT_EXIST', $info_file);
|
||||
}
|
||||
|
||||
$classname = "{$class}_{$basename}_info";
|
||||
|
||||
if (!class_exists($classname))
|
||||
{
|
||||
include((($include_path === false) ? $this->phpbb_root_path . 'includes/' : $include_path) . $info_file);
|
||||
}
|
||||
|
||||
$info = new $classname;
|
||||
$module_info = $info->module();
|
||||
unset($info);
|
||||
|
||||
foreach ($module_info['modes'] as $mode => $info)
|
||||
{
|
||||
if (!isset($module['modes']) || in_array($mode, $module['modes']))
|
||||
{
|
||||
$this->remove($class, $parent, $info['title']) . '<br />';
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$class = $this->db->sql_escape($class);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
$parent_sql = '';
|
||||
if ($parent !== false)
|
||||
{
|
||||
// Allows '' to be sent as 0
|
||||
$parent = (!$parent) ? 0 : $parent;
|
||||
|
||||
if (!is_numeric($parent))
|
||||
{
|
||||
$sql = 'SELECT module_id FROM ' . MODULES_TABLE . "
|
||||
WHERE module_langname = '" . $this->db->sql_escape($parent) . "'
|
||||
AND module_class = '$class'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
// we know it exists from the module_exists check
|
||||
$parent_sql = 'AND parent_id = ' . (int) $row['module_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$parent_sql = 'AND parent_id = ' . (int) $parent;
|
||||
}
|
||||
}
|
||||
|
||||
$module_ids = array();
|
||||
if (!is_numeric($module))
|
||||
{
|
||||
$module = $this->db->sql_escape($module);
|
||||
$sql = 'SELECT module_id FROM ' . MODULES_TABLE . "
|
||||
WHERE module_langname = '$module'
|
||||
AND module_class = '$class'
|
||||
$parent_sql";
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$module_ids[] = (int) $row['module_id'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$module_name = $module;
|
||||
}
|
||||
else
|
||||
{
|
||||
$module = (int) $module;
|
||||
$sql = 'SELECT module_langname FROM ' . MODULES_TABLE . "
|
||||
WHERE module_id = $module
|
||||
AND module_class = '$class'
|
||||
$parent_sql";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$module_name = $row['module_langname'];
|
||||
$module_ids[] = $module;
|
||||
}
|
||||
|
||||
if (!class_exists('acp_modules'))
|
||||
{
|
||||
include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->phpEx);
|
||||
$this->user->add_lang('acp/modules');
|
||||
}
|
||||
$acp_modules = new acp_modules();
|
||||
$acp_modules->module_class = $class;
|
||||
|
||||
foreach ($module_ids as $module_id)
|
||||
{
|
||||
$result = $acp_modules->delete_module($module_id);
|
||||
if (!empty($result))
|
||||
{
|
||||
throw new phpbb_db_migration_exception('CANNOT_REMOVE_MODULE', $module_id);
|
||||
}
|
||||
}
|
||||
|
||||
$cache->destroy("_modules_$class");
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
480
phpBB/includes/db/migration/tools/permission.php
Normal file
480
phpBB/includes/db/migration/tools/permission.php
Normal file
|
@ -0,0 +1,480 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package migration
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_tools_permission extends phpbb_db_migration_tools_base
|
||||
{
|
||||
/**
|
||||
* Permission Exists
|
||||
*
|
||||
* Check if a permission (auth) setting exists
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @return bool true if it exists, false if not
|
||||
*/
|
||||
public function exists($auth_option, $global = true)
|
||||
{
|
||||
if ($global)
|
||||
{
|
||||
$type_sql = ' AND is_global = 1';
|
||||
}
|
||||
else
|
||||
{
|
||||
$type_sql = ' AND is_local = 1';
|
||||
}
|
||||
|
||||
$sql = 'SELECT auth_option_id
|
||||
FROM ' . ACL_OPTIONS_TABLE . "
|
||||
WHERE auth_option = '" . $this->db->sql_escape($auth_option) . "'"
|
||||
. $type_sql;
|
||||
$result = $this->db->sql_query($sql);
|
||||
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Permission Add
|
||||
*
|
||||
* Add a 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
|
||||
*
|
||||
* @return result
|
||||
*/
|
||||
public function add($auth_option, $global = true)
|
||||
{
|
||||
if ($this->exists($auth_option, $global))
|
||||
{
|
||||
throw new phpbb_db_migration_exception('PERMISSION_ALREADY_EXISTS', $auth_option);
|
||||
}
|
||||
|
||||
// We've added permissions, so set to true to notify the user.
|
||||
$this->permissions_added = true;
|
||||
|
||||
if (!class_exists('auth_admin'))
|
||||
{
|
||||
include($this->phpbb_root_path . 'includes/acp/auth.' . $this->phpEx);
|
||||
}
|
||||
$auth_admin = new auth_admin();
|
||||
|
||||
// We have to add a check to see if the !$global (if global, local, and if local, global) permission already exists. If it does, acl_add_option currently has a bug which would break the ACL system, so we are having a work-around here.
|
||||
if ($this->exists($auth_option, !$global))
|
||||
{
|
||||
$sql_ary = array(
|
||||
'is_global' => 1,
|
||||
'is_local' => 1,
|
||||
);
|
||||
$sql = 'UPDATE ' . ACL_OPTIONS_TABLE . '
|
||||
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE auth_option = \'' . $this->db->sql_escape($auth_option) . "'";
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($global)
|
||||
{
|
||||
$auth_admin->acl_add_option(array('global' => array($auth_option)));
|
||||
}
|
||||
else
|
||||
{
|
||||
$auth_admin->acl_add_option(array('local' => array($auth_option)));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Permission Remove
|
||||
*
|
||||
* Remove a 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
|
||||
*
|
||||
* @return result
|
||||
*/
|
||||
public function remove($auth_option, $global = true)
|
||||
{
|
||||
if (!$this->exists($auth_option, $global))
|
||||
{
|
||||
throw new phpbb_db_migration_exception('PERMISSION_NOT_EXIST', $auth_option);
|
||||
}
|
||||
|
||||
if ($global)
|
||||
{
|
||||
$type_sql = ' AND is_global = 1';
|
||||
}
|
||||
else
|
||||
{
|
||||
$type_sql = ' AND is_local = 1';
|
||||
}
|
||||
$sql = 'SELECT auth_option_id, is_global, is_local FROM ' . ACL_OPTIONS_TABLE . "
|
||||
WHERE auth_option = '" . $this->db->sql_escape($auth_option) . "'" .
|
||||
$type_sql;
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$id = $row['auth_option_id'];
|
||||
|
||||
// If it is a local and global permission, do not remove the row! :P
|
||||
if ($row['is_global'] && $row['is_local'])
|
||||
{
|
||||
$sql = 'UPDATE ' . ACL_OPTIONS_TABLE . '
|
||||
SET ' . (($global) ? 'is_global = 0' : 'is_local = 0') . '
|
||||
WHERE auth_option_id = ' . $id;
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Delete time
|
||||
$this->db->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id = ' . $id);
|
||||
$this->db->sql_query('DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' WHERE auth_option_id = ' . $id);
|
||||
$this->db->sql_query('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id = ' . $id);
|
||||
$this->db->sql_query('DELETE FROM ' . ACL_OPTIONS_TABLE . ' WHERE auth_option_id = ' . $id);
|
||||
}
|
||||
|
||||
// Purge the auth cache
|
||||
$this->cache->destroy('_acl_options');
|
||||
$this->auth->acl_clear_prefetch();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new permission role
|
||||
*
|
||||
* @param string $role_name The new role name
|
||||
* @param sting $role_type The type (u_, m_, a_)
|
||||
*/
|
||||
public function role_add($role_name, $role_type = '', $role_description = '')
|
||||
{
|
||||
$sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . '
|
||||
WHERE role_name = \'' . $this->db->sql_escape($role_name) . '\'';
|
||||
$this->db->sql_query($sql);
|
||||
$role_id = $this->db->sql_fetchfield('role_id');
|
||||
|
||||
if ($role_id)
|
||||
{
|
||||
throw new phpbb_db_migration_exception('ROLE_ALREADY_EXISTS', $old_role_name);
|
||||
}
|
||||
|
||||
$sql = 'SELECT MAX(role_order) AS max FROM ' . ACL_ROLES_TABLE . '
|
||||
WHERE role_type = \'' . $this->db->sql_escape($role_type) . '\'';
|
||||
$this->db->sql_query($sql);
|
||||
$role_order = $this->db->sql_fetchfield('max');
|
||||
$role_order = (!$role_order) ? 1 : $role_order + 1;
|
||||
|
||||
$sql_ary = array(
|
||||
'role_name' => $role_name,
|
||||
'role_description' => $role_description,
|
||||
'role_type' => $role_type,
|
||||
'role_order' => $role_order,
|
||||
);
|
||||
|
||||
$sql = 'INSERT INTO ' . ACL_ROLES_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the name on a permission role
|
||||
*
|
||||
* @param string $old_role_name The old role name
|
||||
* @param string $new_role_name The new role name
|
||||
*/
|
||||
public function role_update($old_role_name, $new_role_name = '')
|
||||
{
|
||||
$sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . '
|
||||
WHERE role_name = \'' . $this->db->sql_escape($old_role_name) . '\'';
|
||||
$this->db->sql_query($sql);
|
||||
$role_id = $this->db->sql_fetchfield('role_id');
|
||||
|
||||
if (!$role_id)
|
||||
{
|
||||
throw new phpbb_db_migration_exception('ROLE_NOT_EXISTS', $old_role_name);
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . ACL_ROLES_TABLE . '
|
||||
SET role_name = \'' . $this->db->sql_escape($new_role_name) . '\'
|
||||
WHERE role_name = \'' . $this->db->sql_escape($old_role_name) . '\'';
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a permission role
|
||||
*
|
||||
* @param string $role_name The role name to remove
|
||||
*/
|
||||
public function role_remove($role_name)
|
||||
{
|
||||
$sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . '
|
||||
WHERE role_name = \'' . $this->db->sql_escape($role_name) . '\'';
|
||||
$this->db->sql_query($sql);
|
||||
$role_id = $this->db->sql_fetchfield('role_id');
|
||||
|
||||
if (!$role_id)
|
||||
{
|
||||
throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $role_name);
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . '
|
||||
WHERE role_id = ' . $role_id;
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$sql = 'DELETE FROM ' . ACL_ROLES_TABLE . '
|
||||
WHERE role_id = ' . $role_id;
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$this->auth->acl_clear_prefetch();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Permission Set
|
||||
*
|
||||
* Allows you to set permissions for a certain group/role
|
||||
*
|
||||
* @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 $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
|
||||
*/
|
||||
public function permission_set($name, $auth_option = array(), $type = 'role', $has_permission = true)
|
||||
{
|
||||
if (!is_array($auth_option))
|
||||
{
|
||||
$auth_option = array($auth_option);
|
||||
}
|
||||
|
||||
$new_auth = array();
|
||||
$sql = 'SELECT auth_option_id FROM ' . ACL_OPTIONS_TABLE . '
|
||||
WHERE ' . $this->db->sql_in_set('auth_option', $auth_option);
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$new_auth[] = $row['auth_option_id'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if (!sizeof($new_auth))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$current_auth = array();
|
||||
|
||||
$type = (string) $type; // Prevent PHP bug.
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'role' :
|
||||
$sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . '
|
||||
WHERE role_name = \'' . $this->db->sql_escape($name) . '\'';
|
||||
$this->db->sql_query($sql);
|
||||
$role_id = $this->db->sql_fetchfield('role_id');
|
||||
|
||||
if (!$role_id)
|
||||
{
|
||||
throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $name);
|
||||
}
|
||||
|
||||
$sql = 'SELECT auth_option_id, auth_setting FROM ' . ACL_ROLES_DATA_TABLE . '
|
||||
WHERE role_id = ' . $role_id;
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$current_auth[$row['auth_option_id']] = $row['auth_setting'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
break;
|
||||
|
||||
case 'group' :
|
||||
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . ' WHERE group_name = \'' . $this->db->sql_escape($name) . '\'';
|
||||
$this->db->sql_query($sql);
|
||||
$group_id = $this->db->sql_fetchfield('group_id');
|
||||
|
||||
if (!$group_id)
|
||||
{
|
||||
throw new phpbb_db_migration_exception('GROUP_NOT_EXIST', $name);
|
||||
}
|
||||
|
||||
// If the group has a role set for them we will add the requested permissions to that role.
|
||||
$sql = 'SELECT auth_role_id FROM ' . ACL_GROUPS_TABLE . '
|
||||
WHERE group_id = ' . $group_id . '
|
||||
AND auth_role_id <> 0
|
||||
AND forum_id = 0';
|
||||
$this->db->sql_query($sql);
|
||||
$role_id = $this->db->sql_fetchfield('auth_role_id');
|
||||
if ($role_id)
|
||||
{
|
||||
$sql = 'SELECT role_name FROM ' . ACL_ROLES_TABLE . '
|
||||
WHERE role_id = ' . $role_id;
|
||||
$this->db->sql_query($sql);
|
||||
$role_name = $this->db->sql_fetchfield('role_name');
|
||||
|
||||
return $this->set($role_name, $auth_option, 'role', $has_permission);
|
||||
}
|
||||
|
||||
$sql = 'SELECT auth_option_id, auth_setting FROM ' . ACL_GROUPS_TABLE . '
|
||||
WHERE group_id = ' . $group_id;
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$current_auth[$row['auth_option_id']] = $row['auth_setting'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
break;
|
||||
}
|
||||
|
||||
$sql_ary = array();
|
||||
switch ($type)
|
||||
{
|
||||
case 'role' :
|
||||
foreach ($new_auth as $auth_option_id)
|
||||
{
|
||||
if (!isset($current_auth[$auth_option_id]))
|
||||
{
|
||||
$sql_ary[] = array(
|
||||
'role_id' => $role_id,
|
||||
'auth_option_id' => $auth_option_id,
|
||||
'auth_setting' => $has_permission,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->sql_multi_insert(ACL_ROLES_DATA_TABLE, $sql_ary);
|
||||
break;
|
||||
|
||||
case 'group' :
|
||||
foreach ($new_auth as $auth_option_id)
|
||||
{
|
||||
if (!isset($current_auth[$auth_option_id]))
|
||||
{
|
||||
$sql_ary[] = array(
|
||||
'group_id' => $group_id,
|
||||
'auth_option_id' => $auth_option_id,
|
||||
'auth_setting' => $has_permission,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->sql_multi_insert(ACL_GROUPS_TABLE, $sql_ary);
|
||||
break;
|
||||
}
|
||||
|
||||
$this->auth->acl_clear_prefetch();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Permission Unset
|
||||
*
|
||||
* Allows you to unset (remove) permissions for a certain group/role
|
||||
*
|
||||
* @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 $type The type (role|group)
|
||||
*/
|
||||
public function permission_unset($name, $auth_option = array(), $type = 'role')
|
||||
{
|
||||
if (!is_array($auth_option))
|
||||
{
|
||||
$auth_option = array($auth_option);
|
||||
}
|
||||
|
||||
$to_remove = array();
|
||||
$sql = 'SELECT auth_option_id FROM ' . ACL_OPTIONS_TABLE . '
|
||||
WHERE ' . $this->db->sql_in_set('auth_option', $auth_option);
|
||||
$result = $this->db->sql_query($sql);
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$to_remove[] = $row['auth_option_id'];
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if (!sizeof($to_remove))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$type = (string) $type; // Prevent PHP bug.
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'role' :
|
||||
$sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . '
|
||||
WHERE role_name = \'' . $this->db->sql_escape($name) . '\'';
|
||||
$this->db->sql_query($sql);
|
||||
$role_id = $this->db->sql_fetchfield('role_id');
|
||||
|
||||
if (!$role_id)
|
||||
{
|
||||
throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $name);
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . '
|
||||
WHERE ' . $this->db->sql_in_set('auth_option_id', $to_remove);
|
||||
$this->db->sql_query($sql);
|
||||
break;
|
||||
|
||||
case 'group' :
|
||||
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . '
|
||||
WHERE group_name = \'' . $this->db->sql_escape($name) . '\'';
|
||||
$this->db->sql_query($sql);
|
||||
$group_id = $this->db->sql_fetchfield('group_id');
|
||||
|
||||
if (!$group_id)
|
||||
{
|
||||
throw new phpbb_db_migration_exception('GROUP_NOT_EXIST', $name);
|
||||
}
|
||||
|
||||
// If the group has a role set for them we will remove the requested permissions from that role.
|
||||
$sql = 'SELECT auth_role_id FROM ' . ACL_GROUPS_TABLE . '
|
||||
WHERE group_id = ' . $group_id . '
|
||||
AND auth_role_id <> 0';
|
||||
$this->db->sql_query($sql);
|
||||
$role_id = $this->db->sql_fetchfield('auth_role_id');
|
||||
if ($role_id)
|
||||
{
|
||||
$sql = 'SELECT role_name FROM ' . ACL_ROLES_TABLE . '
|
||||
WHERE role_id = ' . $role_id;
|
||||
$this->db->sql_query($sql);
|
||||
$role_name = $this->db->sql_fetchfield('role_name');
|
||||
|
||||
return $this->permission_unset($role_name, $auth_option, 'role');
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . '
|
||||
WHERE ' . $this->db->sql_in_set('auth_option_id', $to_remove);
|
||||
$this->db->sql_query($sql);
|
||||
break;
|
||||
}
|
||||
|
||||
$this->auth->acl_clear_prefetch();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package migration
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migrationtools_base
|
||||
{
|
||||
var $cache;
|
||||
var $config;
|
||||
var $db;
|
||||
}
|
|
@ -1,121 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package migration
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migrationtools_config extends phpbb_db_migration
|
||||
{
|
||||
/**
|
||||
* Config Exists
|
||||
*
|
||||
* This function is to check to see if a config variable exists or if it does not.
|
||||
*
|
||||
* @param string $config_name The name of the config setting you wish to check for.
|
||||
* @param bool $return_result - return the config value/default if true : default false.
|
||||
*
|
||||
* @return bool true/false if config exists
|
||||
*/
|
||||
function config_exists($config_name, $return_result = false)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . CONFIG_TABLE . "
|
||||
WHERE config_name = '" . $this->db->sql_escape($config_name) . "'";
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
if (!isset($this->config[$config_name]))
|
||||
{
|
||||
$this->config[$config_name] = $row['config_value'];
|
||||
|
||||
if (!$row['is_dynamic'])
|
||||
{
|
||||
$this->cache->destroy('config');
|
||||
}
|
||||
}
|
||||
|
||||
return ($return_result) ? $row : true;
|
||||
}
|
||||
|
||||
// this should never happen, but if it does, we need to remove the config from the array
|
||||
if (isset($this->config[$config_name]))
|
||||
{
|
||||
unset($this->config[$config_name]);
|
||||
$this->cache->destroy('config');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Config Add
|
||||
*
|
||||
* This function allows you to add a config setting.
|
||||
*
|
||||
* @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 bool $is_dynamic True if it is dynamic (changes very often) and should not be stored in the cache, false if not.
|
||||
*
|
||||
* @return result
|
||||
*/
|
||||
function config_add($config_name, $config_value = '', $is_dynamic = false)
|
||||
{
|
||||
if ($this->config_exists($config_name))
|
||||
{
|
||||
return $this->umil_end('CONFIG_ALREADY_EXISTS', $config_name);
|
||||
}
|
||||
|
||||
set_config($config_name, $config_value, $is_dynamic);
|
||||
}
|
||||
|
||||
/**
|
||||
* Config Update
|
||||
*
|
||||
* This function allows you to update an existing config setting.
|
||||
*
|
||||
* @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 bool $is_dynamic True if it is dynamic (changes very often) and should not be stored in the cache, false if not.
|
||||
*
|
||||
* @return result
|
||||
*/
|
||||
function config_update($config_name, $config_value = '')
|
||||
{
|
||||
if (!$this->config_exists($config_name))
|
||||
{
|
||||
return $this->umil_end('CONFIG_NOT_EXIST', $config_name);
|
||||
}
|
||||
|
||||
set_config($config_name, $config_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Config Remove
|
||||
*
|
||||
* This function allows you to remove an existing config setting.
|
||||
*
|
||||
* @param string $config_name The name of the config setting you would like to remove
|
||||
*
|
||||
* @return result
|
||||
*/
|
||||
function config_remove($config_name)
|
||||
{
|
||||
if (!$this->config_exists($config_name))
|
||||
{
|
||||
return $this->umil_end('CONFIG_NOT_EXIST', $config_name);
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM ' . CONFIG_TABLE . "
|
||||
WHERE config_name = '" . $this->db->sql_escape($config_name) . "'";
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
unset($this->config[$config_name]);
|
||||
$this->cache->destroy('config');
|
||||
}
|
||||
}
|
|
@ -45,10 +45,10 @@ class phpbb_db_migrator
|
|||
* @param string $phpbb_root_path
|
||||
* @param string $php_ext
|
||||
*/
|
||||
function phpbb_db_migrator(&$db, &$db_tools, $table_prefix, $migrations_table, $phpbb_root_path, $php_ext)
|
||||
function phpbb_db_migrator($db, $db_tools, $table_prefix, $migrations_table, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
$this->db = &$db;
|
||||
$this->db_tools = &$db_tools;
|
||||
$this->db = $db;
|
||||
$this->db_tools = $db_tools;
|
||||
$this->table_prefix = $table_prefix;
|
||||
$this->migrations_table = $migrations_table;
|
||||
$this->migrations = array();
|
||||
|
@ -131,7 +131,7 @@ class phpbb_db_migrator
|
|||
return false;
|
||||
}
|
||||
|
||||
$migration =& new $name($this->db, $this->db_tools, $this->table_prefix, $this->phpbb_root_path, $this->php_ext);
|
||||
$migration = new $name($this->db, $this->db_tools, $this->table_prefix, $this->phpbb_root_path, $this->php_ext);
|
||||
$state = (isset($this->migration_state[$name])) ?
|
||||
$this->migration_state[$name] :
|
||||
array(
|
||||
|
@ -182,7 +182,7 @@ class phpbb_db_migrator
|
|||
return true;
|
||||
}
|
||||
|
||||
function process_data_step(&$migration)
|
||||
function process_data_step($migration)
|
||||
{
|
||||
$continue = false;
|
||||
$steps = $migration->update_data();
|
||||
|
@ -199,7 +199,7 @@ class phpbb_db_migrator
|
|||
return $continue;
|
||||
}
|
||||
|
||||
function run_step(&$step)
|
||||
function run_step($step)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ class phpbb_db_migrator
|
|||
return true;
|
||||
}
|
||||
|
||||
$migration =& new $name($this->db, $this->db_tools, $this->table_prefix, $this->phpbb_root_path, $this->php_ext);
|
||||
$migration = new $name($this->db, $this->db_tools, $this->table_prefix, $this->phpbb_root_path, $this->php_ext);
|
||||
$depends = $migration->depends_on();
|
||||
|
||||
foreach ($depends as $depend)
|
||||
|
|
Loading…
Add table
Reference in a new issue