aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/migration/data
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-01-08 22:09:14 -0600
committerNathan Guse <nathaniel.guse@gmail.com>2013-01-09 16:44:07 -0600
commit5c91e2569cb3a400acd20bf06cc0e609dd63a778 (patch)
tree0e449198b6e9c5c0875b5107008de4e633b63cd3 /phpBB/includes/db/migration/data
parent826607a40509d40ba5a85e5b0bc72a54f77d41d6 (diff)
downloadforums-5c91e2569cb3a400acd20bf06cc0e609dd63a778.tar
forums-5c91e2569cb3a400acd20bf06cc0e609dd63a778.tar.gz
forums-5c91e2569cb3a400acd20bf06cc0e609dd63a778.tar.bz2
forums-5c91e2569cb3a400acd20bf06cc0e609dd63a778.tar.xz
forums-5c91e2569cb3a400acd20bf06cc0e609dd63a778.zip
[feature/migrations] Migrations now somewhat works
PHPBB3-9737
Diffstat (limited to 'phpBB/includes/db/migration/data')
-rw-r--r--phpBB/includes/db/migration/data/3_0_11_rc1.php2
-rw-r--r--phpBB/includes/db/migration/data/3_0_12_rc1.php101
-rw-r--r--phpBB/includes/db/migration/data/3_0_3_rc1.php6
-rw-r--r--phpBB/includes/db/migration/data/3_0_4.php2
-rw-r--r--phpBB/includes/db/migration/data/3_0_4_rc1.php4
-rw-r--r--phpBB/includes/db/migration/data/3_0_5_rc1.php8
-rw-r--r--phpBB/includes/db/migration/data/3_0_6_rc1.php60
-rw-r--r--phpBB/includes/db/migration/data/3_0_7_rc2.php2
-rw-r--r--phpBB/includes/db/migration/data/3_0_8_rc1.php10
-rw-r--r--phpBB/includes/db/migration/data/3_0_9_rc1.php2
-rw-r--r--phpBB/includes/db/migration/data/3_1_0_dev.php100
-rw-r--r--phpBB/includes/db/migration/data/extensions.php3
-rw-r--r--phpBB/includes/db/migration/data/style_update_p1.php62
-rw-r--r--phpBB/includes/db/migration/data/style_update_p2.php43
-rw-r--r--phpBB/includes/db/migration/data/timezone.php5
15 files changed, 294 insertions, 116 deletions
diff --git a/phpBB/includes/db/migration/data/3_0_11_rc1.php b/phpBB/includes/db/migration/data/3_0_11_rc1.php
index 1509120f68..daf106accf 100644
--- a/phpBB/includes/db/migration/data/3_0_11_rc1.php
+++ b/phpBB/includes/db/migration/data/3_0_11_rc1.php
@@ -80,7 +80,7 @@ class phpbb_db_migration_data_3_0_11_rc1 extends phpbb_db_migration
{
$delete_pms[] = (int) $row['msg_id'];
}
- $db->sql_freeresult($result);
+ $this->db->sql_freeresult($result);
if (!empty($delete_pms))
{
diff --git a/phpBB/includes/db/migration/data/3_0_12_rc1.php b/phpBB/includes/db/migration/data/3_0_12_rc1.php
index e5ff8c5814..0d8702f19e 100644
--- a/phpBB/includes/db/migration/data/3_0_12_rc1.php
+++ b/phpBB/includes/db/migration/data/3_0_12_rc1.php
@@ -9,24 +9,115 @@
/** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.12-RC1 **/
-/*
class phpbb_db_migration_data_3_0_12_rc1 extends phpbb_db_migration
{
- function depends_on()
+ public function depends_on()
{
return array('phpbb_db_migration_data_3_0_11');
}
- function update_schema()
+ public function update_schema()
{
return array();
}
- function update_data()
+ public function update_data()
{
return array(
+ array('custom', array(array(&$this, 'update_module_auth'))),
+ array('custom', array(array(&$this, 'update_bots'))),
+ array('custom', array(array(&$this, 'disable_bots_from_receiving_pms'))),
+
array('config.update', array('version', '3.0.12-rc1')),
);
}
+
+ public function disable_bots_from_receiving_pms()
+ {
+ // Disable receiving pms for bots
+ $sql = 'SELECT user_id
+ FROM ' . BOTS_TABLE;
+ $result = $this->db->sql_query($sql);
+
+ $bot_user_ids = array();
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $bot_user_ids[] = (int) $row['user_id'];
+ }
+ $this->db->sql_freeresult($result);
+
+ if (!empty($bot_user_ids))
+ {
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_allow_pm = 0
+ WHERE ' . $this->db->sql_in_set('user_id', $bot_user_ids);
+ $this->sql_query($sql);
+ }
+ }
+
+ public function update_module_auth()
+ {
+ $sql = 'UPDATE ' . MODULES_TABLE . '
+ SET module_auth = \'acl_u_sig\'
+ WHERE module_class = \'ucp\'
+ AND module_basename = \'profile\'
+ AND module_mode = \'signature\'';
+ $this->sql_query($sql);
+ }
+
+ public function update_bots()
+ {
+ // Update bots
+ if (!function_exists('user_delete'))
+ {
+ include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
+ }
+
+ $bots_updates = array(
+ // Bot Deletions
+ 'NG-Search [Bot]' => false,
+ 'Nutch/CVS [Bot]' => false,
+ 'OmniExplorer [Bot]' => false,
+ 'Seekport [Bot]' => false,
+ 'Synoo [Bot]' => false,
+ 'WiseNut [Bot]' => false,
+
+ // Bot Updates
+ // Bot name to bot user agent map
+ 'Baidu [Spider]' => 'Baiduspider',
+ 'Exabot [Bot]' => 'Exabot',
+ 'Voyager [Bot]' => 'voyager/',
+ 'W3C [Validator]' => 'W3C_Validator',
+ );
+
+ foreach ($bots_updates as $bot_name => $bot_agent)
+ {
+ $sql = 'SELECT user_id
+ FROM ' . USERS_TABLE . '
+ WHERE user_type = ' . USER_IGNORE . "
+ AND username_clean = '" . $this->db->sql_escape(utf8_clean_string($bot_name)) . "'";
+ $result = $this->db->sql_query($sql);
+ $bot_user_id = (int) $this->db->sql_fetchfield('user_id');
+ $this->db->sql_freeresult($result);
+
+ if ($bot_user_id)
+ {
+ if ($bot_agent === false)
+ {
+ $sql = 'DELETE FROM ' . BOTS_TABLE . "
+ WHERE user_id = $bot_user_id";
+ $this->sql_query($sql);
+
+ user_delete('remove', $bot_user_id);
+ }
+ else
+ {
+ $sql = 'UPDATE ' . BOTS_TABLE . "
+ SET bot_agent = '" . $this->db->sql_escape($bot_agent) . "'
+ WHERE user_id = $bot_user_id";
+ $this->sql_query($sql);
+ }
+ }
+ }
+ }
}
-*/ \ No newline at end of file
diff --git a/phpBB/includes/db/migration/data/3_0_3_rc1.php b/phpBB/includes/db/migration/data/3_0_3_rc1.php
index d5c110eb7d..2320c4ac4b 100644
--- a/phpBB/includes/db/migration/data/3_0_3_rc1.php
+++ b/phpBB/includes/db/migration/data/3_0_3_rc1.php
@@ -36,12 +36,12 @@ class phpbb_db_migration_data_3_0_3_rc1 extends phpbb_db_migration
array('config.add', array('queue_trigger_posts', '3')),
array('config.add', array('pm_max_recipients', '0')),
array('custom', array(array(&$this, 'set_group_default_max_recipients'))),
- array('config.add', array('dbms_version', '')),
- array('permission.add', array('u_masspm_group', phpbb_auth::IS_GLOBAL),
+ array('config.add', array('dbms_version', $this->db->sql_server_info(true))),
+ array('permission.add', array('u_masspm_group', true, 'u_masspm')),
array('custom', array(array(&$this, 'correct_acp_email_permissions'))),
array('config.update', array('version', '3.0.3-rc1')),
- ));
+ );
}
function correct_acp_email_permissions()
diff --git a/phpBB/includes/db/migration/data/3_0_4.php b/phpBB/includes/db/migration/data/3_0_4.php
index 4965ac38d0..1af4508331 100644
--- a/phpBB/includes/db/migration/data/3_0_4.php
+++ b/phpBB/includes/db/migration/data/3_0_4.php
@@ -30,7 +30,7 @@ class phpbb_db_migration_data_3_0_4 extends phpbb_db_migration
function rename_log_delete_topic()
{
- if ($db->sql_layer == 'oracle')
+ if ($this->db->sql_layer == 'oracle')
{
// log_operation is CLOB - but we can change this later
$sql = 'UPDATE ' . $this->table_prefix . "log
diff --git a/phpBB/includes/db/migration/data/3_0_4_rc1.php b/phpBB/includes/db/migration/data/3_0_4_rc1.php
index 2964dcebc9..e9bb0e01f5 100644
--- a/phpBB/includes/db/migration/data/3_0_4_rc1.php
+++ b/phpBB/includes/db/migration/data/3_0_4_rc1.php
@@ -69,7 +69,7 @@ class phpbb_db_migration_data_3_0_4_rc1 extends phpbb_db_migration
// Update the Custom Profile Fields based on previous settings to the new format
$sql = 'SELECT field_id, field_required, field_show_on_reg, field_hide
FROM ' . PROFILE_FIELDS_TABLE;
- $result = $this->sql_query($sql);
+ $result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
@@ -101,5 +101,7 @@ class phpbb_db_migration_data_3_0_4_rc1 extends phpbb_db_migration
$this->sql_query('UPDATE ' . $this->table_prefix . 'profile_fields SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE field_id = ' . $row['field_id'], $errored, $error_ary);
}
+
+ $this->db->sql_freeresult($result);
}
}
diff --git a/phpBB/includes/db/migration/data/3_0_5_rc1.php b/phpBB/includes/db/migration/data/3_0_5_rc1.php
index 9205f0d5f8..cbf28c0be6 100644
--- a/phpBB/includes/db/migration/data/3_0_5_rc1.php
+++ b/phpBB/includes/db/migration/data/3_0_5_rc1.php
@@ -32,7 +32,7 @@ class phpbb_db_migration_data_3_0_5_rc1 extends phpbb_db_migration
return array(
array('config.add', array('captcha_gd_wave', 0)),
array('config.add', array('captcha_gd_3d_noise', 1)),
- array('config.add', array('captcha_gd_refresh', 1)),
+ array('config.add', array('captcha_gd_fonts', 1)),
array('config.add', array('confirm_refresh', 1)),
array('config.add', array('max_num_search_keywords', 10)),
array('config.remove', array('search_indexing_state')),
@@ -47,7 +47,7 @@ class phpbb_db_migration_data_3_0_5_rc1 extends phpbb_db_migration
$sql = 'SELECT user_id, user_password
FROM ' . $this->table_prefix . 'users
WHERE user_pass_convert = 1';
- $result = $this->sql_query($sql);
+ $result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
@@ -60,7 +60,7 @@ class phpbb_db_migration_data_3_0_5_rc1 extends phpbb_db_migration
$this->sql_query('UPDATE ' . $this->table_prefix . 'users SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $row['user_id']);
}
}
- $db->sql_freeresult($result);
+ $this->db->sql_freeresult($result);
}
function update_ichiro_bot()
@@ -99,7 +99,7 @@ class phpbb_db_migration_data_3_0_5_rc1 extends phpbb_db_migration
WHERE auth_option = '" . $db->sql_escape($option) . "'
ORDER BY auth_option_id DESC";
// sql_query_limit not possible here, due to bug in postgresql layer
- $result = $this->sql_query($sql);
+ $result = $this->db->sql_query($sql);
// Skip first row, this is our original auth option we want to preserve
$row = $this->db->sql_fetchrow($result);
diff --git a/phpBB/includes/db/migration/data/3_0_6_rc1.php b/phpBB/includes/db/migration/data/3_0_6_rc1.php
index a868d70684..35adcf52be 100644
--- a/phpBB/includes/db/migration/data/3_0_6_rc1.php
+++ b/phpBB/includes/db/migration/data/3_0_6_rc1.php
@@ -35,7 +35,7 @@ class phpbb_db_migration_data_3_0_6_rc1 extends phpbb_db_migration
$this->table_prefix . 'reports' => array(
'pm_id' => array('UINT', 0),
),
- $this->table_prefix . 'fields' => array(
+ $this->table_prefix . 'profile_fields' => array(
'field_show_on_vt' => array('BOOL', 0),
),
$this->table_prefix . 'forums' => array(
@@ -89,19 +89,19 @@ class phpbb_db_migration_data_3_0_6_rc1 extends phpbb_db_migration
array('config.add', array('allow_avatar', 0)),
array('if', array(
($this->config['allow_avatar_upload'] || $this->config['allow_avatar_local'] || $this->config['allow_avatar_remote']),
- array('config.add', array('allow_avatar', 1)),
+ array('config.update', array('allow_avatar', 1)),
)),
array('config.add', array('allow_avatar_remote_upload', 0)),
array('if', array(
($this->config['allow_avatar_remote'] && $this->config['allow_avatar_upload']),
- array('config.add', array('allow_avatar_remote_upload', 1)),
+ array('config.update', array('allow_avatar_remote_upload', 1)),
)),
array('module.add', array(
'acp',
'ACP_BOARD_CONFIGURATION',
array(
- 'module_basename' => 'board',
+ 'module_basename' => 'acp_board',
'modes' => array('feed'),
),
)),
@@ -109,7 +109,7 @@ class phpbb_db_migration_data_3_0_6_rc1 extends phpbb_db_migration
'acp',
'ACP_CAT_USERS',
array(
- 'module_basename' => 'users',
+ 'module_basename' => 'acp_users',
'modes' => array('warnings'),
),
)),
@@ -117,7 +117,7 @@ class phpbb_db_migration_data_3_0_6_rc1 extends phpbb_db_migration
'acp',
'ACP_SERVER_CONFIGURATION',
array(
- 'module_basename' => 'send_statistics',
+ 'module_basename' => 'acp_send_statistics',
'modes' => array('send_statistics'),
),
)),
@@ -125,7 +125,7 @@ class phpbb_db_migration_data_3_0_6_rc1 extends phpbb_db_migration
'acp',
'ACP_FORUM_BASED_PERMISSIONS',
array(
- 'module_basename' => 'permissions',
+ 'module_basename' => 'acp_permissions',
'modes' => array('setting_forum_copy'),
),
)),
@@ -133,24 +133,8 @@ class phpbb_db_migration_data_3_0_6_rc1 extends phpbb_db_migration
'mcp',
'MCP_REPORTS',
array(
- 'module_basename' => 'pm_reports',
- 'modes' => array('pm_reports'),
- ),
- )),
- array('module.add', array(
- 'mcp',
- 'MCP_REPORTS',
- array(
- 'module_basename' => 'pm_reports',
- 'modes' => array('pm_reports_closed'),
- ),
- )),
- array('module.add', array(
- 'mcp',
- 'MCP_REPORTS',
- array(
- 'module_basename' => 'pm_reports',
- 'modes' => array('pm_report_details'),
+ 'module_basename' => 'mcp_pm_reports',
+ 'modes' => array('pm_reports','pm_reports_closed','pm_report_details'),
),
)),
array('custom', array(array(&$this, 'add_newly_registered_group'))),
@@ -209,17 +193,14 @@ class phpbb_db_migration_data_3_0_6_rc1 extends phpbb_db_migration
$this->sql_query($sql);
$u_role = $this->db->sql_nextid();
- if (!$errored)
- {
- // Now add the correct data to the roles...
- // The standard role says that new users are not able to send a PM, Mass PM, are not able to PM groups
- $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $u_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group')";
- $this->sql_query($sql);
+ // Now add the correct data to the roles...
+ // The standard role says that new users are not able to send a PM, Mass PM, are not able to PM groups
+ $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $u_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group')";
+ $this->sql_query($sql);
- // Add user role to group
- $sql = 'INSERT INTO ' . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES ($group_id, 0, 0, $u_role, 0)";
- $this->sql_query($sql);
- }
+ // Add user role to group
+ $sql = 'INSERT INTO ' . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES ($group_id, 0, 0, $u_role, 0)";
+ $this->sql_query($sql);
}
// Insert new forum role
@@ -246,11 +227,8 @@ class phpbb_db_migration_data_3_0_6_rc1 extends phpbb_db_migration
$this->sql_query($sql);
$f_role = $this->db->sql_nextid();
- if (!$errored)
- {
- $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $f_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove')";
- $this->sql_query($sql);
- }
+ $sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $f_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove')";
+ $this->sql_query($sql);
}
// Set every members user_new column to 0 (old users) only if there is no one yet (this makes sure we do not execute this more than once)
@@ -294,7 +272,7 @@ class phpbb_db_migration_data_3_0_6_rc1 extends phpbb_db_migration
}
// Clear permissions...
- include_once($this->phpbb_root_path . 'includes/acp/auth.' . $this->phpEx);
+ include_once($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext);
$auth_admin = new auth_admin();
$auth_admin->acl_clear_prefetch();
}
diff --git a/phpBB/includes/db/migration/data/3_0_7_rc2.php b/phpBB/includes/db/migration/data/3_0_7_rc2.php
index e043f35705..e2c6acce1e 100644
--- a/phpBB/includes/db/migration/data/3_0_7_rc2.php
+++ b/phpBB/includes/db/migration/data/3_0_7_rc2.php
@@ -59,7 +59,7 @@ class phpbb_db_migration_data_3_0_7_rc2 extends phpbb_db_migration
$this->sql_query($sql);
}
}
- $db->sql_freeresult($result);
+ $this->db->sql_freeresult($result);
if ($i < $limit)
{
diff --git a/phpBB/includes/db/migration/data/3_0_8_rc1.php b/phpBB/includes/db/migration/data/3_0_8_rc1.php
index 3f51806fd9..b58b0966a5 100644
--- a/phpBB/includes/db/migration/data/3_0_8_rc1.php
+++ b/phpBB/includes/db/migration/data/3_0_8_rc1.php
@@ -30,7 +30,7 @@ class phpbb_db_migration_data_3_0_8_rc1 extends phpbb_db_migration
'acp',
'ACP_MESSAGES',
array(
- 'module_basename' => 'board',
+ 'module_basename' => 'acp_board',
'modes' => array('post'),
),
)),
@@ -60,9 +60,9 @@ class phpbb_db_migration_data_3_0_8_rc1 extends phpbb_db_migration
// On an already updated board, they can also already be in language/.../acp/attachments.php
// in the board root.
$lang_files = array(
- "{$this->phpbb_root_path}install/update/new/language/$lang_dir/acp/attachments.$this->phpEx",
- "{$this->phpbb_root_path}language/$lang_dir/install.$this->phpEx",
- "{$this->phpbb_root_path}language/$lang_dir/acp/attachments.$this->phpEx",
+ "{$this->phpbb_root_path}install/update/new/language/$lang_dir/acp/attachments.{$this->php_ext}",
+ "{$this->phpbb_root_path}language/$lang_dir/install.{$this->php_ext}",
+ "{$this->phpbb_root_path}language/$lang_dir/acp/attachments.{$this->php_ext}",
);
foreach ($lang_files as $lang_file)
@@ -140,7 +140,7 @@ class phpbb_db_migration_data_3_0_8_rc1 extends phpbb_db_migration
if (!function_exists('user_add'))
{
- include($this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx);
+ include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
}
$user_row = array(
diff --git a/phpBB/includes/db/migration/data/3_0_9_rc1.php b/phpBB/includes/db/migration/data/3_0_9_rc1.php
index 256426849c..ea49cdbba9 100644
--- a/phpBB/includes/db/migration/data/3_0_9_rc1.php
+++ b/phpBB/includes/db/migration/data/3_0_9_rc1.php
@@ -44,7 +44,7 @@ class phpbb_db_migration_data_3_0_9_rc1 extends phpbb_db_migration
),
),
'change_columns' => array(
- $this->table_prefix . 'bbcode' => array(
+ $this->table_prefix . 'bbcodes' => array(
'bbcode_id' => array('USINT', 0),
),
),
diff --git a/phpBB/includes/db/migration/data/3_1_0_dev.php b/phpBB/includes/db/migration/data/3_1_0_dev.php
index 987ab94646..6eb5a6ddee 100644
--- a/phpBB/includes/db/migration/data/3_1_0_dev.php
+++ b/phpBB/includes/db/migration/data/3_1_0_dev.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_db_migration_data_extensions extends phpbb_db_migration
+class phpbb_db_migration_data_3_1_0_dev extends phpbb_db_migration
{
public function depends_on()
{
@@ -78,6 +78,8 @@ class phpbb_db_migration_data_extensions extends phpbb_db_migration
array('config.add', array('site_home_url', '')),
array('config.add', array('site_home_text', '')),
+ array('permission.add', array('u_chgprofileinfo', true, 'u_sig')),
+
array('module.add', array(
'acp',
'ACP_GROUPS',
@@ -103,7 +105,7 @@ class phpbb_db_migration_data_extensions extends phpbb_db_migration
),
)),
array('module.add', array(
- 'acp',
+ 'ucp',
'UCP_PROFILE',
array(
'module_basename' => 'ucp_profile',
@@ -113,20 +115,104 @@ class phpbb_db_migration_data_extensions extends phpbb_db_migration
array('module.remove', array(
'acp',
- 'ACP_CAT_STYLES',
- array(
- 'module_basename' => 'styles',
- 'modes' => array('imageset', 'theme', 'template'),
- ),
+ false,
+ 'ACP_TEMPLATES',
+ )),
+ array('module.remove', array(
+ 'acp',
+ false,
+ 'ACP_THEMES',
+ )),
+ array('module.remove', array(
+ 'acp',
+ false,
+ 'ACP_IMAGESETS',
)),
array('custom', array(array($this, 'rename_module_basenames'))),
+ array('custom', array(array($this, 'rename_styles_module'))),
array('custom', array(array($this, 'add_group_teampage'))),
array('custom', array(array($this, 'update_group_legend'))),
array('custom', array(array($this, 'localise_global_announcements'))),
+ array('custom', array(array($this, 'update_ucp_pm_basename'))),
+ array('custom', array(array($this, 'update_ucp_profile_auth'))),
+ array('custom', array(array($this, 'move_customise_modules'))),
+
+ array('config.update', array('version', '3.1.0-dev')),
);
}
+ public function move_customise_modules()
+ {
+ // Move language management to new location in the Customise tab
+ // First get language module id
+ $sql = 'SELECT module_id FROM ' . MODULES_TABLE . "
+ WHERE module_basename = 'acp_language'";
+ $result = $this->db->sql_query($sql);
+ $language_module_id = $this->db->sql_fetchfield('module_id');
+ $this->db->sql_freeresult($result);
+ // Next get language management module id of the one just created
+ $sql = 'SELECT module_id FROM ' . MODULES_TABLE . "
+ WHERE module_langname = 'ACP_LANGUAGE'";
+ $result = $this->db->sql_query($sql);
+ $language_management_module_id = $this->db->sql_fetchfield('module_id');
+ $this->db->sql_freeresult($result);
+
+ if (!class_exists('acp_modules'))
+ {
+ include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext);
+ }
+ // acp_modules calls adm_back_link, which is undefined at this point
+ if (!function_exists('adm_back_link'))
+ {
+ include($this->phpbb_root_path . 'includes/functions_acp.' . $this->php_ext);
+ }
+ $module_manager = new acp_modules();
+ $module_manager->module_class = 'acp';
+ $module_manager->move_module($language_module_id, $language_management_module_id);
+ }
+
+ public function update_ucp_pm_basename()
+ {
+ $sql = 'SELECT module_id, module_basename
+ FROM ' . MODULES_TABLE . "
+ WHERE module_basename <> 'ucp_pm' AND
+ module_langname='UCP_PM'";
+ $result = $this->db->sql_query_limit($sql, 1);
+
+ if ($row = $this->db->sql_fetchrow($result))
+ {
+ // This update is still not applied. Applying it
+
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET module_basename = 'ucp_pm'
+ WHERE module_id = " . (int) $row['module_id'];
+
+ $this->sql_query($sql);
+ }
+ $this->db->sql_freeresult($result);
+ }
+
+ public function update_ucp_profile_auth()
+ {
+ // Update the auth setting for the module
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET module_auth = 'acl_u_chgprofileinfo'
+ WHERE module_class = 'ucp'
+ AND module_basename = 'ucp_profile'
+ AND module_mode = 'profile_info'";
+ $this->sql_query($sql);
+ }
+
+ public function rename_styles_module()
+ {
+ // Rename styles module to Customise
+ $sql = 'UPDATE ' . MODULES_TABLE . "
+ SET module_langname = 'ACP_CAT_CUSTOMISE'
+ WHERE module_langname = 'ACP_CAT_STYLES'";
+ $this->sql_query($sql);
+ }
+
public function rename_module_basenames()
{
// rename all module basenames to full classname
diff --git a/phpBB/includes/db/migration/data/extensions.php b/phpBB/includes/db/migration/data/extensions.php
index 85d5511ef0..d28e0ebabb 100644
--- a/phpBB/includes/db/migration/data/extensions.php
+++ b/phpBB/includes/db/migration/data/extensions.php
@@ -39,10 +39,11 @@ class phpbb_db_migration_data_extensions extends phpbb_db_migration
'acp',
'ACP_GENERAL_TASKS',
array(
- 'module_basename' => 'extensions',
+ 'module_basename' => 'acp_extensions',
'modes' => array('main'),
),
)),
+ array('permission.add', array('a_extensions', true, 'a_styles')),
);
}
}
diff --git a/phpBB/includes/db/migration/data/style_update_p1.php b/phpBB/includes/db/migration/data/style_update_p1.php
index d570caae04..1c46e4147b 100644
--- a/phpBB/includes/db/migration/data/style_update_p1.php
+++ b/phpBB/includes/db/migration/data/style_update_p1.php
@@ -31,7 +31,7 @@ class phpbb_db_migration_data_style_update_p1 extends phpbb_db_migration
// Get list of valid 3.1 styles
$available_styles = array('prosilver');
- $iterator = new DirectoryIterator($phpbb_root_path . 'styles');
+ $iterator = new DirectoryIterator($this->phpbb_root_path . 'styles');
$skip_dirs = array('.', '..', 'prosilver');
foreach ($iterator as $fileinfo)
{
@@ -91,9 +91,67 @@ class phpbb_db_migration_data_style_update_p1 extends phpbb_db_migration
'style_parent_id' => 0,
'style_parent_tree' => '',
);
- $this->sql_query('UPDATE ' . STYLES_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE style_id = ' . $style_row['style_id'], $errored, $error_ary);
+ $this->sql_query('UPDATE ' . STYLES_TABLE . '
+ SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
+ WHERE style_id = ' . $style_row['style_id']);
$valid_styles[] = (int) $style_row['style_id'];
}
}
+
+ // Remove old entries from styles table
+ if (!sizeof($valid_styles))
+ {
+ // No valid styles: remove everything and add prosilver
+ $this->sql_query('DELETE FROM ' . STYLES_TABLE, $errored, $error_ary);
+
+ $sql_ary = array(
+ 'style_name' => 'prosilver',
+ 'style_copyright' => '&copy; phpBB Group',
+ 'style_active' => 1,
+ 'style_path' => 'prosilver',
+ 'bbcode_bitfield' => 'kNg=',
+ 'style_parent_id' => 0,
+ 'style_parent_tree' => '',
+
+ // Will be removed in the next step
+ 'imageset_id' => 0,
+ 'template_id' => 0,
+ 'theme_id' => 0,
+ );
+
+ $sql = 'INSERT INTO ' . STYLES_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
+ $this->sql_query($sql);
+
+ $sql = 'SELECT style_id
+ FROM ' . $table . "
+ WHERE style_name = 'prosilver'";
+ $result = $this->sql_query($sql);
+ $default_style = $this->db->sql_fetchfield($result);
+ $this->db->sql_freeresult($result);
+
+ set_config('default_style', $default_style);
+
+ $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0';
+ $this->sql_query($sql);
+ }
+ else
+ {
+ // There are valid styles in styles table. Remove styles that are outdated
+ $this->sql_query('DELETE FROM ' . STYLES_TABLE . '
+ WHERE ' . $this->db->sql_in_set('style_id', $valid_styles, true));
+
+ // Change default style
+ if (!in_array($this->config['default_style'], $valid_styles))
+ {
+ $this->sql_query('UPDATE ' . CONFIG_TABLE . "
+ SET config_value = '" . $valid_styles[0] . "'
+ WHERE config_name = 'default_style'");
+ }
+
+ // Reset styles for users
+ $this->sql_query('UPDATE ' . USERS_TABLE . '
+ SET user_style = 0
+ WHERE ' . $this->db->sql_in_set('user_style', $valid_styles, true));
+ }
}
}
diff --git a/phpBB/includes/db/migration/data/style_update_p2.php b/phpBB/includes/db/migration/data/style_update_p2.php
index 2c0991de59..db4b7f1753 100644
--- a/phpBB/includes/db/migration/data/style_update_p2.php
+++ b/phpBB/includes/db/migration/data/style_update_p2.php
@@ -37,47 +37,6 @@ class phpbb_db_migration_data_style_update_p2 extends phpbb_db_migration
public function update_data()
{
- return array(
- array('custom', array(array($this, 'styles_update'))),
- );
- }
-
- public function styles_update()
- {
- // Remove old entries from styles table
- if (!sizeof($valid_styles))
- {
- // No valid styles: remove everything and add prosilver
- $this->sql_query('DELETE FROM ' . STYLES_TABLE, $errored, $error_ary);
-
- $sql = 'INSERT INTO ' . STYLES_TABLE . " (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '&copy; phpBB Group', 1, 'prosilver', 'kNg=', 0, '')";
- $this->sql_query($sql);
-
- $sql = 'SELECT style_id
- FROM ' . $table . "
- WHERE style_name = 'prosilver'";
- $result = $this->sql_query($sql);
- $default_style = $this->db->sql_fetchfield($result);
- $this->db->sql_freeresult($result);
-
- set_config('default_style', $default_style);
-
- $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0';
- $this->sql_query($sql);
- }
- else
- {
- // There are valid styles in styles table. Remove styles that are outdated
- $this->sql_query('DELETE FROM ' . STYLES_TABLE . ' WHERE ' . $this->db->sql_in_set('style_id', $valid_styles, true), $errored, $error_ary);
-
- // Change default style
- if (!in_array($config['default_style'], $valid_styles))
- {
- set_config('default_style', $valid_styles[0]);
- }
-
- // Reset styles for users
- $this->sql_query('UPDATE ' . USERS_TABLE . ' SET user_style = 0 WHERE ' . $this->db->sql_in_set('user_style', $valid_styles, true), $errored, $error_ary);
- }
+ return array();
}
}
diff --git a/phpBB/includes/db/migration/data/timezone.php b/phpBB/includes/db/migration/data/timezone.php
index 89fafbad28..7734ed4b76 100644
--- a/phpBB/includes/db/migration/data/timezone.php
+++ b/phpBB/includes/db/migration/data/timezone.php
@@ -51,7 +51,10 @@ class phpbb_db_migration_data_timezone extends phpbb_db_migration
$this->db->sql_freeresult($result);
// Update board default timezone
- set_config('board_timezone', $this->convert_phpbb30_timezone($config['board_timezone'], $config['board_dst']));
+ $sql = 'UPDATE ' . CONFIG_TABLE . "
+ SET config_value = '" . $this->convert_phpbb30_timezone($this->config['board_timezone'], $this->config['board_dst']) . "'
+ WHERE config_name = 'board_timezone'";
+ $this->sql_query($sql);
// After we have calculated the timezones we can delete user_dst column from user table.
$this->db_tools->sql_column_remove(USERS_TABLE, 'user_dst');