aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2012-11-10 04:00:38 -0600
committerNathan Guse <nathaniel.guse@gmail.com>2013-01-09 16:42:44 -0600
commite7389e4c32f031fc6025880adf22b40d7d195f27 (patch)
tree3a4f238a97f3a134357a595b11c758269483e1b6 /phpBB/includes
parentb999a75528156b2cf229cc2ceac04b5a8bac859d (diff)
downloadforums-e7389e4c32f031fc6025880adf22b40d7d195f27.tar
forums-e7389e4c32f031fc6025880adf22b40d7d195f27.tar.gz
forums-e7389e4c32f031fc6025880adf22b40d7d195f27.tar.bz2
forums-e7389e4c32f031fc6025880adf22b40d7d195f27.tar.xz
forums-e7389e4c32f031fc6025880adf22b40d7d195f27.zip
[feature/migrations] 3.0.8-rc1 migration, fix some calls
PHPBB3-9737
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/db/migration/v3011rc1.php4
-rw-r--r--phpBB/includes/db/migration/v308rc1.php169
-rw-r--r--phpBB/includes/db/migration/v309rc1.php2
3 files changed, 89 insertions, 86 deletions
diff --git a/phpBB/includes/db/migration/v3011rc1.php b/phpBB/includes/db/migration/v3011rc1.php
index aad80ba59f..3bae7a4a2d 100644
--- a/phpBB/includes/db/migration/v3011rc1.php
+++ b/phpBB/includes/db/migration/v3011rc1.php
@@ -47,7 +47,7 @@ class phpbb_db_migration_v3011rc1 extends phpbb_db_migration
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_style = ' . (int) $this->config['default_style'] .'
WHERE ' . $this->db->sql_in_set('user_style', $deactivated_style_ids);
- $this->sql_query($sql, $errored, $error_ary);
+ $this->sql_query($sql);
}
}
@@ -84,7 +84,7 @@ class phpbb_db_migration_v3011rc1 extends phpbb_db_migration
{
$sql = 'DELETE FROM ' . PRIVMSGS_TABLE . '
WHERE ' . $this->db->sql_in_set('msg_id', $delete_pms);
- $this->sql_query($sql, $errored, $error_ary);
+ $this->sql_query($sql);
return true;
}
diff --git a/phpBB/includes/db/migration/v308rc1.php b/phpBB/includes/db/migration/v308rc1.php
index 13d0e98b1c..cbfedb1b53 100644
--- a/phpBB/includes/db/migration/v308rc1.php
+++ b/phpBB/includes/db/migration/v308rc1.php
@@ -21,13 +21,36 @@ class phpbb_db_migration_v308rc1 extends phpbb_db_migration
function update_data()
{
+ return array(
+ array('custom', array(array(&$this, 'update_file_extension_group_names'))),
+ array('custom', array(array(&$this, 'update_module_auth'))),
+ 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')
+ ),
+ )),
+ array('config.add', array('load_unreads_search', 1)),
+ array('config.update_if', array(600, 'queue_interval', 60)),
+ array('config.update_if', array(50, 'email_package_size', 20)),
+ );
+ }
+
+ function update_file_extension_group_names()
+ {
// Update file extension group names to use language strings.
$sql = 'SELECT lang_dir
FROM ' . LANG_TABLE;
- $result = $db->sql_query($sql);
+ $result = $this->db->sql_query($sql);
$extension_groups_updated = array();
- while ($lang_dir = $db->sql_fetchfield('lang_dir'))
+ while ($lang_dir = $this->db->sql_fetchfield('lang_dir'))
{
$lang_dir = basename($lang_dir);
@@ -37,9 +60,9 @@ class phpbb_db_migration_v308rc1 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(
- "{$phpbb_root_path}install/update/new/language/$lang_dir/acp/attachments.$phpEx",
- "{$phpbb_root_path}language/$lang_dir/install.$phpEx",
- "{$phpbb_root_path}language/$lang_dir/acp/attachments.$phpEx",
+ "{$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",
);
foreach ($lang_files as $lang_file)
@@ -64,48 +87,38 @@ class phpbb_db_migration_v308rc1 extends phpbb_db_migration
);
$sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . '
- SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
- WHERE group_name = '" . $db->sql_escape($lang_val) . "'";
- _sql($sql, $errored, $error_ary);
+ SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . "
+ WHERE group_name = '" . $this->db->sql_escape($lang_val) . "'";
+ $this->sql_query($sql);
$extension_groups_updated[$lang_key] = true;
}
}
}
- $db->sql_freeresult($result);
-
- // Install modules
- $modules_to_install = array(
- 'post' => array(
- 'base' => 'board',
- 'class' => 'acp',
- 'title' => 'ACP_POST_SETTINGS',
- 'auth' => 'acl_a_board',
- 'cat' => 'ACP_MESSAGES',
- 'after' => array('message', 'ACP_MESSAGE_SETTINGS')
- ),
- );
-
- _add_modules($modules_to_install);
+ $this->db->sql_freeresult($result);
+ }
- // update
+ function update_module_auth()
+ {
$sql = 'UPDATE ' . MODULES_TABLE . '
SET module_auth = \'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload)\'
WHERE module_class = \'ucp\'
AND module_basename = \'profile\'
AND module_mode = \'avatar\'';
- _sql($sql, $errored, $error_ary);
+ $this->sql_query($sql);
+ }
- // add Bing Bot
+ function update_bots()
+ {
$bot_name = 'Bing [Bot]';
$bot_name_clean = utf8_clean_string($bot_name);
$sql = 'SELECT user_id
FROM ' . USERS_TABLE . "
- WHERE username_clean = '" . $db->sql_escape($bot_name_clean) . "'";
- $result = $db->sql_query($sql);
- $bing_already_added = (bool) $db->sql_fetchfield('user_id');
- $db->sql_freeresult($result);
+ WHERE username_clean = '" . $this->db->sql_escape($bot_name_clean) . "'";
+ $result = $this->db->sql_query($sql);
+ $bing_already_added = (bool) $this->db->sql_fetchfield('user_id');
+ $this->db->sql_freeresult($result);
if (!$bing_already_added)
{
@@ -114,9 +127,9 @@ class phpbb_db_migration_v308rc1 extends phpbb_db_migration
$sql = 'SELECT group_id, group_colour
FROM ' . GROUPS_TABLE . "
WHERE group_name = 'BOTS'";
- $result = $db->sql_query($sql);
- $group_row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ $result = $this->db->sql_query($sql);
+ $group_row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
if (!$group_row)
{
@@ -127,7 +140,7 @@ class phpbb_db_migration_v308rc1 extends phpbb_db_migration
if (!function_exists('user_add'))
{
- include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ include($this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx);
}
$user_row = array(
@@ -138,16 +151,16 @@ class phpbb_db_migration_v308rc1 extends phpbb_db_migration
'user_password' => '',
'user_colour' => $group_row['group_colour'],
'user_email' => '',
- 'user_lang' => $config['default_lang'],
- 'user_style' => $config['default_style'],
+ 'user_lang' => $this->config['default_lang'],
+ 'user_style' => $this->config['default_style'],
'user_timezone' => 0,
- 'user_dateformat' => $config['default_dateformat'],
+ 'user_dateformat' => $this->config['default_dateformat'],
'user_allow_massemail' => 0,
);
$user_id = user_add($user_row);
- $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
+ $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', array(
'bot_active' => 1,
'bot_name' => (string) $bot_name,
'user_id' => (int) $user_id,
@@ -155,68 +168,58 @@ class phpbb_db_migration_v308rc1 extends phpbb_db_migration
'bot_ip' => (string) $bot_ip,
));
- _sql($sql, $errored, $error_ary);
+ $this->sql_query($sql);
}
- // end Bing Bot addition
+ }
+ function delete_orphan_shadow_topics()
+ {
// Delete shadow topics pointing to not existing topics
$batch_size = 500;
// Set of affected forums we have to resync
$sync_forum_ids = array();
- do
- {
- $sql_array = array(
- 'SELECT' => 't1.topic_id, t1.forum_id',
- 'FROM' => array(
- TOPICS_TABLE => 't1',
- ),
- 'LEFT_JOIN' => array(
- array(
- 'FROM' => array(TOPICS_TABLE => 't2'),
- 'ON' => 't1.topic_moved_id = t2.topic_id',
- ),
+ $sql_array = array(
+ 'SELECT' => 't1.topic_id, t1.forum_id',
+ 'FROM' => array(
+ TOPICS_TABLE => 't1',
+ ),
+ 'LEFT_JOIN' => array(
+ array(
+ 'FROM' => array(TOPICS_TABLE => 't2'),
+ 'ON' => 't1.topic_moved_id = t2.topic_id',
),
- 'WHERE' => 't1.topic_moved_id <> 0
- AND t2.topic_id IS NULL',
- );
- $sql = $db->sql_build_query('SELECT', $sql_array);
- $result = $db->sql_query_limit($sql, $batch_size);
-
- $topic_ids = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $topic_ids[] = (int) $row['topic_id'];
+ ),
+ 'WHERE' => 't1.topic_moved_id <> 0
+ AND t2.topic_id IS NULL',
+ );
+ $sql = $this->db->sql_build_query('SELECT', $sql_array);
+ $result = $this->db->sql_query_limit($sql, $batch_size);
- $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id'];
- }
- $db->sql_freeresult($result);
+ $topic_ids = array();
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $topic_ids[] = (int) $row['topic_id'];
- if (!empty($topic_ids))
- {
- $sql = 'DELETE FROM ' . TOPICS_TABLE . '
- WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
- $db->sql_query($sql);
- }
+ $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id'];
}
- while (sizeof($topic_ids) == $batch_size);
+ $this->db->sql_freeresult($result);
- // Sync the forums we have deleted shadow topics from.
- sync('forum', 'forum_id', $sync_forum_ids, true, true);
+ if (!empty($topic_ids))
+ {
+ $sql = 'DELETE FROM ' . TOPICS_TABLE . '
+ WHERE ' . $this->db->sql_in_set('topic_id', $topic_ids);
+ $this->db->sql_query($sql);
- // Unread posts search load switch
- set_config('load_unreads_search', '1');
+ // Sync the forums we have deleted shadow topics from.
+ sync('forum', 'forum_id', $sync_forum_ids, true, true);
- // Reduce queue interval to 60 seconds, email package size to 20
- if ($config['queue_interval'] == 600)
- {
- set_config('queue_interval', '60');
+ return true;
}
-
- if ($config['email_package_size'] == 50)
+ else
{
- set_config('email_package_size', '20');
+ return false;
}
}
}
diff --git a/phpBB/includes/db/migration/v309rc1.php b/phpBB/includes/db/migration/v309rc1.php
index ce51e54642..e8db93c78d 100644
--- a/phpBB/includes/db/migration/v309rc1.php
+++ b/phpBB/includes/db/migration/v309rc1.php
@@ -79,7 +79,7 @@ class phpbb_db_migration_v309rc1 extends phpbb_db_migration
$sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . '
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
WHERE group_id = ' . $row['group_id'];
- $this->sql_query($sql, $errored, $error_ary);
+ $this->sql_query($sql);
}
$this->db->sql_freeresult($result);
}