aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/migration/data
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/db/migration/data')
-rw-r--r--phpBB/includes/db/migration/data/3_0_1.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_10.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_10_rc1.php28
-rw-r--r--phpBB/includes/db/migration/data/3_0_10_rc2.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_10_rc3.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_11.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_11_rc1.php96
-rw-r--r--phpBB/includes/db/migration/data/3_0_11_rc231
-rw-r--r--phpBB/includes/db/migration/data/3_0_12_rc1.php26
-rw-r--r--phpBB/includes/db/migration/data/3_0_1_rc1.php77
-rw-r--r--phpBB/includes/db/migration/data/3_0_2.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_2_rc1.php30
-rw-r--r--phpBB/includes/db/migration/data/3_0_2_rc2.php52
-rw-r--r--phpBB/includes/db/migration/data/3_0_3.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_3_rc1.php61
-rw-r--r--phpBB/includes/db/migration/data/3_0_4.php47
-rw-r--r--phpBB/includes/db/migration/data/3_0_4_rc1.php103
-rw-r--r--phpBB/includes/db/migration/data/3_0_5.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_5_rc1.php119
-rw-r--r--phpBB/includes/db/migration/data/3_0_5_rc1part2.php34
-rw-r--r--phpBB/includes/db/migration/data/3_0_6.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_6_rc1.php299
-rw-r--r--phpBB/includes/db/migration/data/3_0_6_rc2.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_6_rc3.php38
-rw-r--r--phpBB/includes/db/migration/data/3_0_6_rc4.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_7.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_7_pl1.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_7_rc1.php51
-rw-r--r--phpBB/includes/db/migration/data/3_0_7_rc2.php70
-rw-r--r--phpBB/includes/db/migration/data/3_0_8.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_8_rc1.php223
-rw-r--r--phpBB/includes/db/migration/data/3_0_9.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_9_rc1.php108
-rw-r--r--phpBB/includes/db/migration/data/3_0_9_rc2.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_9_rc3.php25
-rw-r--r--phpBB/includes/db/migration/data/3_0_9_rc4.php25
36 files changed, 1943 insertions, 0 deletions
diff --git a/phpBB/includes/db/migration/data/3_0_1.php b/phpBB/includes/db/migration/data/3_0_1.php
new file mode 100644
index 0000000000..294db3d946
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_1.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_1_rc1');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_10.php b/phpBB/includes/db/migration/data/3_0_10.php
new file mode 100644
index 0000000000..6d39969d48
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_10.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_10 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_10_rc3');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_10_rc1.php b/phpBB/includes/db/migration/data/3_0_10_rc1.php
new file mode 100644
index 0000000000..06105c5b0d
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_10_rc1.php
@@ -0,0 +1,28 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_10_rc1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_9');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ return array(
+ array('config.add', array('email_max_chunk_size', 50)),
+ );
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_10_rc2.php b/phpBB/includes/db/migration/data/3_0_10_rc2.php
new file mode 100644
index 0000000000..04161caf28
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_10_rc2.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_10_rc2 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_10_rc1');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_10_rc3.php b/phpBB/includes/db/migration/data/3_0_10_rc3.php
new file mode 100644
index 0000000000..539f0b8fec
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_10_rc3.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_10_rc3 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_10_rc2');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_11.php b/phpBB/includes/db/migration/data/3_0_11.php
new file mode 100644
index 0000000000..3404272ef9
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_11.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_11 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_11_rc2');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_11_rc1.php b/phpBB/includes/db/migration/data/3_0_11_rc1.php
new file mode 100644
index 0000000000..f44226df02
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_11_rc1.php
@@ -0,0 +1,96 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_11_rc1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_10');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ return array(
+ array('custom', array(array(&$this, 'cleanup_deactivated_styles'))),
+ array('custom', array(array(&$this, 'delete_orphan_private_messages'))),
+ );
+ }
+
+ function cleanup_deactivated_styles()
+ {
+ // Updates users having current style a deactivated one
+ $sql = 'SELECT style_id
+ FROM ' . STYLES_TABLE . '
+ WHERE style_active = 0';
+ $result = $this->sql_query($sql);
+
+ $deactivated_style_ids = array();
+ while ($style_id = $this->db->sql_fetchfield('style_id', false, $result))
+ {
+ $deactivated_style_ids[] = (int) $style_id;
+ }
+ $this->db->sql_freeresult($result);
+
+ if (!empty($deactivated_style_ids))
+ {
+ $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);
+ }
+ }
+
+ function delete_orphan_private_messages()
+ {
+ // Delete orphan private messages
+ $batch_size = 500;
+
+ $sql_array = array(
+ 'SELECT' => 'p.msg_id',
+ 'FROM' => array(
+ PRIVMSGS_TABLE => 'p',
+ ),
+ 'LEFT_JOIN' => array(
+ array(
+ 'FROM' => array(PRIVMSGS_TO_TABLE => 't'),
+ 'ON' => 'p.msg_id = t.msg_id',
+ ),
+ ),
+ 'WHERE' => 't.user_id IS NULL',
+ );
+ $sql = $this->db->sql_build_query('SELECT', $sql_array);
+
+ $result = $this->db->sql_query_limit($sql, $batch_size);
+
+ $delete_pms = array();
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $delete_pms[] = (int) $row['msg_id'];
+ }
+ $db->sql_freeresult($result);
+
+ if (!empty($delete_pms))
+ {
+ $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . '
+ WHERE ' . $this->db->sql_in_set('msg_id', $delete_pms);
+ $this->sql_query($sql);
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_11_rc2 b/phpBB/includes/db/migration/data/3_0_11_rc2
new file mode 100644
index 0000000000..6add980c73
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_11_rc2
@@ -0,0 +1,31 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_11_rc2 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_11_rc1');
+ }
+
+ function update_schema()
+ {
+ return array(
+ 'add_columns' => array(
+ $this->table_prefix . 'profile_fields' => array(
+ 'field_show_novalue' => array('BOOL', 0),
+ ),
+ ),
+ );
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_12_rc1.php b/phpBB/includes/db/migration/data/3_0_12_rc1.php
new file mode 100644
index 0000000000..734a57ecee
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_12_rc1.php
@@ -0,0 +1,26 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_12_rc1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_11');
+ }
+
+ function update_schema()
+ {
+ /** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.12-RC1 */
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_1_rc1.php b/phpBB/includes/db/migration/data/3_0_1_rc1.php
new file mode 100644
index 0000000000..1a696e0003
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_1_rc1.php
@@ -0,0 +1,77 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_1_rc1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array();
+ }
+
+ function update_schema()
+ {
+ return array(
+ 'add_columns' => array(
+ $this->table_prefix . 'forums' => array(
+ 'display_subforum_list' => array('BOOL', 1),
+ ),
+ $this->table_prefix . 'sessions' => array(
+ 'session_forum_id' => array('UINT', 0),
+ ),
+ ),
+ 'drop_keys' => array(
+ $this->table_prefix . 'groups' => array('group_legend'),
+ ),
+ 'add_index' => array(
+ $this->table_prefix . 'sessions' => array(
+ 'session_forum_id' => array('session_forum_id'),
+ ),
+ $this->table_prefix . 'groups' => array(
+ 'group_legend_name' => array('group_legend', 'group_name'),
+ ),
+ ),
+ );
+ }
+
+ function update_data()
+ {
+ return array(
+ array('custom', array(array(&$this, 'fix_unset_last_view_time'))),
+ array('custom', array(array(&$this, 'reset_smiley_size'))),
+ );
+ }
+
+ function fix_unset_last_view_time()
+ {
+ $sql = 'UPDATE ' . $this->table_prefix . "topics
+ SET topic_last_view_time = topic_last_post_time
+ WHERE topic_last_view_time = 0";
+ $this->sql_query($sql);
+ }
+
+ function reset_smiley_size()
+ {
+ // Update smiley sizes
+ $smileys = array('icon_e_surprised.gif', 'icon_eek.gif', 'icon_cool.gif', 'icon_lol.gif', 'icon_mad.gif', 'icon_razz.gif', 'icon_redface.gif', 'icon_cry.gif', 'icon_evil.gif', 'icon_twisted.gif', 'icon_rolleyes.gif', 'icon_exclaim.gif', 'icon_question.gif', 'icon_idea.gif', 'icon_arrow.gif', 'icon_neutral.gif', 'icon_mrgreen.gif', 'icon_e_ugeek.gif');
+
+ foreach ($smileys as $smiley)
+ {
+ if (file_exists($this->phpbb_root_path . 'images/smilies/' . $smiley))
+ {
+ list($width, $height) = getimagesize($this->phpbb_root_path . 'images/smilies/' . $smiley);
+
+ $sql = 'UPDATE ' . SMILIES_TABLE . '
+ SET smiley_width = ' . $width . ', smiley_height = ' . $height . "
+ WHERE smiley_url = '" . $this->db->sql_escape($smiley) . "'";
+
+ $this->sql_query($sql);
+ }
+ }
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_2.php b/phpBB/includes/db/migration/data/3_0_2.php
new file mode 100644
index 0000000000..a5f94e644b
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_2.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_2 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_2_rc2');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_2_rc1.php b/phpBB/includes/db/migration/data/3_0_2_rc1.php
new file mode 100644
index 0000000000..1b4d3bc2b8
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_2_rc1.php
@@ -0,0 +1,30 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_1_rc1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_1');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ return array(
+ array('config.add', array('referer_validation', '1')),
+ array('config.add', array('check_attachment_content', '1')),
+ array('config.add', array('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title')),
+ );
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_2_rc2.php b/phpBB/includes/db/migration/data/3_0_2_rc2.php
new file mode 100644
index 0000000000..9ddeb60a14
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_2_rc2.php
@@ -0,0 +1,52 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_2_rc2 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_2_rc1');
+ }
+
+ function update_schema()
+ {
+ return array(
+ 'change_columns' => array(
+ $this->table_prefix . 'drafts' => array(
+ 'draft_subject' => array('STEXT_UNI', ''),
+ ),
+ $this->table_prefix . 'forums' => array(
+ 'forum_last_post_subject' => array('STEXT_UNI', ''),
+ ),
+ $this->table_prefix . 'posts' => array(
+ 'post_subject' => array('STEXT_UNI', '', 'true_sort'),
+ ),
+ $this->table_prefix . 'privmsgs' => array(
+ 'message_subject' => array('STEXT_UNI', ''),
+ ),
+ $this->table_prefix . 'topics' => array(
+ 'topic_title' => array('STEXT_UNI', '', 'true_sort'),
+ 'topic_last_post_subject' => array('STEXT_UNI', ''),
+ ),
+ ),
+ 'drop_keys' => array(
+ $this->table_prefix . 'sessions' => array('session_forum_id'),
+ ),
+ 'add_index' => array(
+ $this->table_prefix . 'sessions' => array(
+ 'session_fid' => array('session_forum_id'),
+ ),
+ ),
+ );
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_3.php b/phpBB/includes/db/migration/data/3_0_3.php
new file mode 100644
index 0000000000..f989eea025
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_3.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_3 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_2_rc2');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_3_rc1.php b/phpBB/includes/db/migration/data/3_0_3_rc1.php
new file mode 100644
index 0000000000..737eab4bd3
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_3_rc1.php
@@ -0,0 +1,61 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_3_rc1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_2');
+ }
+
+ function update_schema()
+ {
+ return array(
+ 'add_columns' => array(
+ $this->table_prefix . 'styles_template' => array(
+ 'template_inherits_id' => array('UINT:4', 0),
+ 'template_inherit_path' => array('VCHAR', ''),
+ ),
+ $this->table_prefix . 'groups' => array(
+ 'group_max_recipients' => array('UINT', 0),
+ ),
+ ),
+ );
+ }
+
+ function update_data()
+ {
+ return array(
+ array('config.add', array('enable_queue_trigger', '0')),
+ 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('custom', array(array(&$this, 'correct_acp_email_permissions'))),
+ ));
+ }
+
+ function correct_acp_email_permissions()
+ {
+ $sql = 'UPDATE ' . $this->table_prefix . 'modules
+ SET module_auth = \'acl_a_email && cfg_email_enable\'
+ WHERE module_class = \'acp\'
+ AND module_basename = \'email\'';
+ $this->sql_query($sql);
+ }
+
+ function set_group_default_max_recipients()
+ {
+ // Set maximum number of recipients for the registered users, bots, guests group
+ $sql = 'UPDATE ' . GROUPS_TABLE . ' SET group_max_recipients = 5
+ WHERE ' . $this->db->sql_in_set('group_name', array('GUESTS', 'REGISTERED', 'REGISTERED_COPPA', 'BOTS'));
+ $this->sql_query($sql);
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_4.php b/phpBB/includes/db/migration/data/3_0_4.php
new file mode 100644
index 0000000000..cd34fda9ab
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_4.php
@@ -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_data_3_0_4 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_4_rc1');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ return array(
+ array('custom', array(array(&$this, 'rename_log_delete_topic'))),
+ );
+ }
+
+ function rename_log_delete_topic()
+ {
+ if ($db->sql_layer == 'oracle')
+ {
+ // log_operation is CLOB - but we can change this later
+ $sql = 'UPDATE ' . $this->table_prefix . "log
+ SET log_operation = 'LOG_DELETE_TOPIC'
+ WHERE log_operation LIKE 'LOG_TOPIC_DELETED'";
+ $this->sql_query($sql);
+ }
+ else
+ {
+ $sql = 'UPDATE ' . $this->table_prefix . "log
+ SET log_operation = 'LOG_DELETE_TOPIC'
+ WHERE log_operation = 'LOG_TOPIC_DELETED'";
+ $this->sql_query($sql);
+ }
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_4_rc1.php b/phpBB/includes/db/migration/data/3_0_4_rc1.php
new file mode 100644
index 0000000000..342f1fa910
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_4_rc1.php
@@ -0,0 +1,103 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_4_rc1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_3');
+ }
+
+ function update_schema()
+ {
+ return array(
+ 'add_columns' => array(
+ $this->table_prefix . 'profile_fields' => array(
+ 'field_show_profile' => array('BOOL', 0),
+ ),
+ ),
+ 'change_columns' => array(
+ $this->table_prefix . 'styles' => array(
+ 'style_id' => array('UINT', NULL, 'auto_increment'),
+ 'template_id' => array('UINT', 0),
+ 'theme_id' => array('UINT', 0),
+ 'imageset_id' => array('UINT', 0),
+ ),
+ $this->table_prefix . 'styles_imageset' => array(
+ 'imageset_id' => array('UINT', NULL, 'auto_increment'),
+ ),
+ $this->table_prefix . 'styles_imageset_data' => array(
+ 'image_id' => array('UINT', NULL, 'auto_increment'),
+ 'imageset_id' => array('UINT', 0),
+ ),
+ $this->table_prefix . 'styles_theme' => array(
+ 'theme_id' => array('UINT', NULL, 'auto_increment'),
+ ),
+ $this->table_prefix . 'styles_template' => array(
+ 'template_id' => array('UINT', NULL, 'auto_increment'),
+ ),
+ $this->table_prefix . 'styles_template_data' => array(
+ 'template_id' => array('UINT', 0),
+ ),
+ $this->table_prefix . 'forums' => array(
+ 'forum_style' => array('UINT', 0),
+ ),
+ $this->table_prefix . 'users' => array(
+ 'user_style' => array('UINT', 0),
+ ),
+ ),
+ );
+ }
+
+ function update_data()
+ {
+ return array(
+ array('custom', array(array(&$this, 'update_custom_profile_fields'))),
+ );
+ }
+
+ function update_custom_profile_fields()
+ {
+ // 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);
+
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $sql_ary = array(
+ 'field_required' => 0,
+ 'field_show_on_reg' => 0,
+ 'field_hide' => 0,
+ 'field_show_profile'=> 0,
+ );
+
+ if ($row['field_required'])
+ {
+ $sql_ary['field_required'] = $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1;
+ }
+ else if ($row['field_show_on_reg'])
+ {
+ $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1;
+ }
+ else if ($row['field_hide'])
+ {
+ // Only administrators and moderators can see this CPF, if the view is enabled, they can see it, otherwise just admins in the acp_users module
+ $sql_ary['field_hide'] = 1;
+ }
+ else
+ {
+ // equivelant to "none", which is the "Display in user control panel" option
+ $sql_ary['field_show_profile'] = 1;
+ }
+
+ $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);
+ }
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_5.php b/phpBB/includes/db/migration/data/3_0_5.php
new file mode 100644
index 0000000000..5671832a82
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_5.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_5 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_5_rc1part2');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_5_rc1.php b/phpBB/includes/db/migration/data/3_0_5_rc1.php
new file mode 100644
index 0000000000..9205f0d5f8
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_5_rc1.php
@@ -0,0 +1,119 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_5_rc1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_4');
+ }
+
+ function update_schema()
+ {
+ return array(
+ 'change_columns' => array(
+ $this->table_prefix . 'forums' => array(
+ 'forum_style' => array('UINT', 0),
+ ),
+ ),
+ );
+ }
+
+ function update_data()
+ {
+ $search_indexing_state = $this->config['search_indexing_state'];
+
+ 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('confirm_refresh', 1)),
+ array('config.add', array('max_num_search_keywords', 10)),
+ array('config.remove', array('search_indexing_state')),
+ array('config.add', array('search_indexing_state', $search_indexing_state, true)),
+ array('custom', array(array(&$this, 'hash_old_passwords'))),
+ array('custom', array(array(&$this, 'update_ichiro_bot'))),
+ );
+ }
+
+ function hash_old_passwords()
+ {
+ $sql = 'SELECT user_id, user_password
+ FROM ' . $this->table_prefix . 'users
+ WHERE user_pass_convert = 1';
+ $result = $this->sql_query($sql);
+
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ if (strlen($row['user_password']) == 32)
+ {
+ $sql_ary = array(
+ 'user_password' => phpbb_hash($row['user_password']),
+ );
+
+ $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);
+ }
+
+ function update_ichiro_bot()
+ {
+ // Adjust bot entry
+ $sql = 'UPDATE ' . $this->table_prefix . "bots
+ SET bot_agent = 'ichiro/'
+ WHERE bot_agent = 'ichiro/2'";
+ $this->sql_query($sql);
+ }
+
+ function remove_duplicate_auth_options()
+ {
+ // Before we are able to add a unique key to auth_option, we need to remove duplicate entries
+ $sql = 'SELECT auth_option
+ FROM ' . $this->table_prefix . 'acl_options
+ GROUP BY auth_option
+ HAVING COUNT(*) >= 2';
+ $result = $this->db->sql_query($sql);
+
+ $auth_options = array();
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $auth_options[] = $row['auth_option'];
+ }
+ $this->db->sql_freeresult($result);
+
+ // Remove specific auth options
+ if (!empty($auth_options))
+ {
+ foreach ($auth_options as $option)
+ {
+ // Select auth_option_ids... the largest id will be preserved
+ $sql = 'SELECT auth_option_id
+ FROM ' . ACL_OPTIONS_TABLE . "
+ 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);
+
+ // Skip first row, this is our original auth option we want to preserve
+ $row = $this->db->sql_fetchrow($result);
+
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ // Ok, remove this auth option...
+ $this->sql_query('DELETE FROM ' . ACL_OPTIONS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']);
+ $this->sql_query('DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']);
+ $this->sql_query('DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']);
+ $this->sql_query('DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_option_id = ' . $row['auth_option_id']);
+ }
+ $this->db->sql_freeresult($result);
+ }
+ }
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_5_rc1part2.php b/phpBB/includes/db/migration/data/3_0_5_rc1part2.php
new file mode 100644
index 0000000000..6be8ea9845
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_5_rc1part2.php
@@ -0,0 +1,34 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_5_rc1part2 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_5_rc1');
+ }
+
+ function update_schema()
+ {
+ return array(
+ 'drop_keys' => array(
+ ACL_OPTIONS_TABLE => array('auth_option'),
+ ),
+ 'add_unique_index' => array(
+ ACL_OPTIONS_TABLE => array(
+ 'auth_option' => array('auth_option'),
+ ),
+ ),
+ );
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_6.php b/phpBB/includes/db/migration/data/3_0_6.php
new file mode 100644
index 0000000000..c2cb59e62a
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_6.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_6 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_6_rc4');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_6_rc1.php b/phpBB/includes/db/migration/data/3_0_6_rc1.php
new file mode 100644
index 0000000000..eefdc1692d
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_6_rc1.php
@@ -0,0 +1,299 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_6_rc1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_5');
+ }
+
+ function update_schema()
+ {
+ return array(
+ 'add_columns' => array(
+ $this->table_prefix . 'confirm' => array(
+ 'attempts' => array('UINT', 0),
+ ),
+ $this->table_prefix . 'users' => array(
+ 'user_new' => array('BOOL', 1),
+ 'user_reminded' => array('TINT:4', 0),
+ 'user_reminded_time' => array('TIMESTAMP', 0),
+ ),
+ $this->table_prefix . 'groups' => array(
+ 'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'),
+ ),
+ $this->table_prefix . 'privmsgs' => array(
+ 'message_reported' => array('BOOL', 0),
+ ),
+ $this->table_prefix . 'reports' => array(
+ 'pm_id' => array('UINT', 0),
+ ),
+ $this->table_prefix . 'fields' => array(
+ 'field_show_on_vt' => array('BOOL', 0),
+ ),
+ $this->table_prefix . 'forums' => array(
+ 'forum_options' => array('UINT:20', 0),
+ ),
+ ),
+ 'change_columns' => array(
+ $this->table_prefix . 'users' => array(
+ 'user_options' => array('UINT:11', 230271),
+ ),
+ ),
+ 'add_index' => array(
+ $this->table_prefix . 'reports' => array(
+ 'post_id' => array('post_id'),
+ 'pm_id' => array('pm_id'),
+ ),
+ $this->table_prefix . 'posts' => array(
+ 'post_username' => array('post_username:255'),
+ ),
+ ),
+ );
+ }
+
+ function update_data()
+ {
+ return array(
+ array('config.add', array('captcha_plugin', 'phpbb_captcha_nogd')),
+ array('if', array(
+ ($this->config['captcha_gd']),
+ array('config.update', array('captcha_plugin', 'phpbb_captcha_gd')),
+ )),
+
+ array('config.add', array('feed_enable', 0)),
+ array('config.add', array('feed_limit', 10)),
+ array('config.add', array('feed_overall_forums', 1)),
+ array('config.add', array('feed_overall_forums_limit', 15)),
+ array('config.add', array('feed_overall_topics', 0)),
+ array('config.add', array('feed_overall_topics_limit', 15)),
+ array('config.add', array('feed_forum', 1)),
+ array('config.add', array('feed_topic', 1)),
+ array('config.add', array('feed_item_statistics', 1)),
+
+ array('config.add', array('smilies_per_page', 50)),
+ array('config.add', array('allow_pm_report', 1)),
+ array('config.add', array('min_post_chars', 1)),
+ array('config.add', array('allow_quick_reply', 1)),
+ array('config.add', array('new_member_post_limit', 0)),
+ array('config.add', array('new_member_group_default', 0)),
+ array('config.add', array('delete_time', $this->config['edit_time'])),
+
+ 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.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('module.add', array(
+ 'acp',
+ 'ACP_BOARD_CONFIGURATION',
+ array(
+ 'module_basename' => 'board',
+ 'modes' => array('feed'),
+ ),
+ )),
+ array('module.add', array(
+ 'acp',
+ 'ACP_CAT_USERS',
+ array(
+ 'module_basename' => 'users',
+ 'modes' => array('warnings'),
+ ),
+ )),
+ array('module.add', array(
+ 'acp',
+ 'ACP_SERVER_CONFIGURATION',
+ array(
+ 'module_basename' => 'send_statistics',
+ 'modes' => array('send_statistics'),
+ ),
+ )),
+ array('module.add', array(
+ 'acp',
+ 'ACP_FORUM_BASED_PERMISSIONS',
+ array(
+ 'module_basename' => 'permissions',
+ 'modes' => array('setting_forum_copy'),
+ ),
+ )),
+ array('module.add', array(
+ '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'),
+ ),
+ )),
+ array('custom', array(array(&$this, 'add_newly_registered_group'))),
+ array('custom', array(array(&$this, 'set_user_options_default'))),
+ );
+ }
+
+ function set_user_options_default()
+ {
+ // 229376 is the added value to enable all three signature options
+ $sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = user_options + 229376';
+ $this->sql_query($sql);
+ }
+
+ function add_newly_registered_group()
+ {
+ // Add newly_registered group... but check if it already exists (we always supported running the updater on any schema)
+ $sql = 'SELECT group_id
+ FROM ' . GROUPS_TABLE . "
+ WHERE group_name = 'NEWLY_REGISTERED'";
+ $result = $this->db->sql_query($sql);
+ $group_id = (int) $this->db->sql_fetchfield('group_id');
+ $this->db->sql_freeresult($result);
+
+ if (!$group_id)
+ {
+ $sql = 'INSERT INTO ' . GROUPS_TABLE . " (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5)";
+ $this->sql_query($sql);
+
+ $group_id = $this->db->sql_nextid();
+ }
+
+ // Insert new user role... at the end of the chain
+ $sql = 'SELECT role_id
+ FROM ' . ACL_ROLES_TABLE . "
+ WHERE role_name = 'ROLE_USER_NEW_MEMBER'
+ AND role_type = 'u_'";
+ $result = $this->db->sql_query($sql);
+ $u_role = (int) $this->db->sql_fetchfield('role_id');
+ $this->db->sql_freeresult($result);
+
+ if (!$u_role)
+ {
+ $sql = 'SELECT MAX(role_order) as max_order_id
+ FROM ' . ACL_ROLES_TABLE . "
+ WHERE role_type = 'u_'";
+ $result = $this->db->sql_query($sql);
+ $next_order_id = (int) $this->db->sql_fetchfield('max_order_id');
+ $this->db->sql_freeresult($result);
+
+ $next_order_id++;
+
+ $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NEW_MEMBER', 'ROLE_DESCRIPTION_USER_NEW_MEMBER', 'u_', $next_order_id)";
+ $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);
+
+ // 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
+ $sql = 'SELECT role_id
+ FROM ' . ACL_ROLES_TABLE . "
+ WHERE role_name = 'ROLE_FORUM_NEW_MEMBER'
+ AND role_type = 'f_'";
+ $result = $this->db->sql_query($sql);
+ $f_role = (int) $this->db->sql_fetchfield('role_id');
+ $this->db->sql_freeresult($result);
+
+ if (!$f_role)
+ {
+ $sql = 'SELECT MAX(role_order) as max_order_id
+ FROM ' . ACL_ROLES_TABLE . "
+ WHERE role_type = 'f_'";
+ $result = $this->db->sql_query($sql);
+ $next_order_id = (int) $this->db->sql_fetchfield('max_order_id');
+ $this->db->sql_freeresult($result);
+
+ $next_order_id++;
+
+ $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', $next_order_id)";
+ $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);
+ }
+ }
+
+ // 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)
+ $sql = 'SELECT 1
+ FROM ' . USERS_TABLE . '
+ WHERE user_new = 0';
+ $result = $this->db->sql_query_limit($sql, 1);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if (!$row)
+ {
+ $sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0';
+ $this->sql_query($sql);
+ }
+
+ // To mimick the old "feature" we will assign the forum role to every forum, regardless of the setting (this makes sure there are no "this does not work!!!! YUO!!!" posts...
+ // Check if the role is already assigned...
+ $sql = 'SELECT forum_id
+ FROM ' . ACL_GROUPS_TABLE . '
+ WHERE group_id = ' . $group_id . '
+ AND auth_role_id = ' . $f_role;
+ $result = $this->db->sql_query($sql);
+ $is_options = (int) $this->db->sql_fetchfield('forum_id');
+ $this->db->sql_freeresult($result);
+
+ // Not assigned at all... :/
+ if (!$is_options)
+ {
+ // Get postable forums
+ $sql = 'SELECT forum_id
+ FROM ' . FORUMS_TABLE . '
+ WHERE forum_type != ' . FORUM_LINK;
+ $result = $this->db->sql_query($sql);
+
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $this->sql_query('INSERT INTO ' . ACL_GROUPS_TABLE . ' (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (' . $group_id . ', ' . (int) $row['forum_id'] . ', 0, ' . $f_role . ', 0)');
+ }
+ $this->db->sql_freeresult($result);
+ }
+
+ // Clear permissions...
+ include_once($this->phpbb_root_path . 'includes/acp/auth.' . $this->phpEx);
+ $auth_admin = new auth_admin();
+ $auth_admin->acl_clear_prefetch();
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_6_rc2.php b/phpBB/includes/db/migration/data/3_0_6_rc2.php
new file mode 100644
index 0000000000..07b31a53b9
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_6_rc2.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_6_rc2 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_6_rc1');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_6_rc3.php b/phpBB/includes/db/migration/data/3_0_6_rc3.php
new file mode 100644
index 0000000000..c19a792bad
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_6_rc3.php
@@ -0,0 +1,38 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_6_rc3 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_6_rc2');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ return array(
+ array('custom', array(array(&$this, 'update_cp_fields'))),
+ );
+ }
+
+ function update_cp_fields()
+ {
+ // Update the Custom Profile Fields based on previous settings to the new format
+ $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . '
+ SET field_show_on_vt = 1
+ WHERE field_hide = 0
+ AND (field_required = 1 OR field_show_on_reg = 1 OR field_show_profile = 1)';
+ $this->sql_query($sql);
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_6_rc4.php b/phpBB/includes/db/migration/data/3_0_6_rc4.php
new file mode 100644
index 0000000000..c48b1ca394
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_6_rc4.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_6_rc4 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_6_rc3');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_7.php b/phpBB/includes/db/migration/data/3_0_7.php
new file mode 100644
index 0000000000..05781b7b49
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_7.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_7 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_7_rc2');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_7_pl1.php b/phpBB/includes/db/migration/data/3_0_7_pl1.php
new file mode 100644
index 0000000000..cee7a91a2e
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_7_pl1.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_7_pl1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_7');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_7_rc1.php b/phpBB/includes/db/migration/data/3_0_7_rc1.php
new file mode 100644
index 0000000000..b2d49cce63
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_7_rc1.php
@@ -0,0 +1,51 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_7_rc1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_6');
+ }
+
+ function update_schema()
+ {
+ return array(
+ 'drop_keys' => array(
+ $this->table_prefix . 'log' => array('log_time'),
+ ),
+ 'add_index' => array(
+ $this->table_prefix . 'topics_track' => array(
+ 'topic_id' => array('topic_id'),
+ ),
+ ),
+ );
+ }
+
+ function update_data()
+ {
+ return array(
+ array('config.add', array('feed_overall', 1)),
+ array('config.add', array('feed_http_auth', 0)),
+ array('config.add', array('feed_limit_post', $this->config['feed_limit'])),
+ array('config.add', array('feed_limit_topic', $this->config['feed_overall_topics_limit'])),
+ array('config.add', array('feed_topics_new', $this->config['feed_overall_topics'])),
+ array('config.add', array('feed_topics_active', $this->config['feed_overall_topics'])),
+ array('custom', array(array(&$this, 'delete_text_templates'))),
+ );
+ }
+
+ function delete_text_templates()
+ {
+ // Delete all text-templates from the template_data
+ $sql = 'DELETE FROM ' . STYLES_TEMPLATE_DATA_TABLE . '
+ WHERE template_filename ' . $this->db->sql_like_expression($this->db->any_char . '.txt');
+ $this->sql_query($sql);
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_7_rc2.php b/phpBB/includes/db/migration/data/3_0_7_rc2.php
new file mode 100644
index 0000000000..8a751328bf
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_7_rc2.php
@@ -0,0 +1,70 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_7_rc2 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_7_rc1');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ return array(
+ array('custom', array(array(&$this, 'update_email_hash'))),
+ );
+ }
+
+ function update_email_hash($start = 0)
+ {
+ $limit = 1000;
+
+ $sql = 'SELECT user_id, user_email, user_email_hash
+ FROM ' . USERS_TABLE . '
+ WHERE user_type <> ' . USER_IGNORE . "
+ AND user_email <> ''";
+ $result = $this->db->sql_query_limit($sql, $limit, $start);
+
+ $i = 0;
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $i++;
+
+ // Snapshot of the phpbb_email_hash() function
+ // We cannot call it directly because the auto updater updates the DB first. :/
+ $user_email_hash = sprintf('%u', crc32(strtolower($row['user_email']))) . strlen($row['user_email']);
+
+ if ($user_email_hash != $row['user_email_hash'])
+ {
+ $sql_ary = array(
+ 'user_email_hash' => $user_email_hash,
+ );
+
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
+ WHERE user_id = ' . (int) $row['user_id'];
+ $this->sql_query($sql);
+ }
+ }
+ $db->sql_freeresult($result);
+
+ if ($i < $limit)
+ {
+ // Completed
+ return false;
+ }
+
+ return $start + $limit;
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_8.php b/phpBB/includes/db/migration/data/3_0_8.php
new file mode 100644
index 0000000000..a714a3d2f6
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_8.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_8 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_8_rc1');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_8_rc1.php b/phpBB/includes/db/migration/data/3_0_8_rc1.php
new file mode 100644
index 0000000000..73838d9d29
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_8_rc1.php
@@ -0,0 +1,223 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_8_rc1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_7_pl1');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ 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(
+ 'acp',
+ 'ACP_MESSAGES',
+ array(
+ 'module_basename' => 'board',
+ 'modes' => array('post'),
+ ),
+ )),
+ array('config.add', array('load_unreads_search', 1)),
+ array('config.update_if_equals', array(600, 'queue_interval', 60)),
+ array('config.update_if_equals', 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 = $this->db->sql_query($sql);
+
+ $extension_groups_updated = array();
+ while ($lang_dir = $this->db->sql_fetchfield('lang_dir'))
+ {
+ $lang_dir = basename($lang_dir);
+
+ // The language strings we need are either in language/.../acp/attachments.php
+ // in the update package if we're updating to 3.0.8-RC1 or later,
+ // or they are in language/.../install.php when we're updating from 3.0.7-PL1 or earlier.
+ // 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",
+ );
+
+ foreach ($lang_files as $lang_file)
+ {
+ if (!file_exists($lang_file))
+ {
+ continue;
+ }
+
+ $lang = array();
+ include($lang_file);
+
+ foreach($lang as $lang_key => $lang_val)
+ {
+ if (isset($extension_groups_updated[$lang_key]) || strpos($lang_key, 'EXT_GROUP_') !== 0)
+ {
+ continue;
+ }
+
+ $sql_ary = array(
+ 'group_name' => substr($lang_key, 10), // Strip off 'EXT_GROUP_'
+ );
+
+ $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . '
+ 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;
+ }
+ }
+ }
+ $this->db->sql_freeresult($result);
+ }
+
+ 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\'';
+ $this->sql_query($sql);
+ }
+
+ 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 = '" . $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)
+ {
+ $bot_agent = 'bingbot/';
+ $bot_ip = '';
+ $sql = 'SELECT group_id, group_colour
+ FROM ' . GROUPS_TABLE . "
+ WHERE group_name = 'BOTS'";
+ $result = $this->db->sql_query($sql);
+ $group_row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if (!$group_row)
+ {
+ // default fallback, should never get here
+ $group_row['group_id'] = 6;
+ $group_row['group_colour'] = '9E8DA7';
+ }
+
+ if (!function_exists('user_add'))
+ {
+ include($this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx);
+ }
+
+ $user_row = array(
+ 'user_type' => USER_IGNORE,
+ 'group_id' => $group_row['group_id'],
+ 'username' => $bot_name,
+ 'user_regdate' => time(),
+ 'user_password' => '',
+ 'user_colour' => $group_row['group_colour'],
+ 'user_email' => '',
+ 'user_lang' => $this->config['default_lang'],
+ 'user_style' => $this->config['default_style'],
+ 'user_timezone' => 0,
+ 'user_dateformat' => $this->config['default_dateformat'],
+ 'user_allow_massemail' => 0,
+ );
+
+ $user_id = user_add($user_row);
+
+ $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,
+ 'bot_agent' => (string) $bot_agent,
+ 'bot_ip' => (string) $bot_ip,
+ ));
+
+ $this->sql_query($sql);
+ }
+ }
+
+ 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();
+
+ $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 = $this->db->sql_build_query('SELECT', $sql_array);
+ $result = $this->db->sql_query_limit($sql, $batch_size);
+
+ $topic_ids = array();
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $topic_ids[] = (int) $row['topic_id'];
+
+ $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id'];
+ }
+ $this->db->sql_freeresult($result);
+
+ if (!empty($topic_ids))
+ {
+ $sql = 'DELETE FROM ' . TOPICS_TABLE . '
+ WHERE ' . $this->db->sql_in_set('topic_id', $topic_ids);
+ $this->db->sql_query($sql);
+
+ // Sync the forums we have deleted shadow topics from.
+ sync('forum', 'forum_id', $sync_forum_ids, true, true);
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_9.php b/phpBB/includes/db/migration/data/3_0_9.php
new file mode 100644
index 0000000000..4b2c08a256
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_9.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_9 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_9_rc4');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_9_rc1.php b/phpBB/includes/db/migration/data/3_0_9_rc1.php
new file mode 100644
index 0000000000..98d3a26481
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_9_rc1.php
@@ -0,0 +1,108 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_9_rc1 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_8');
+ }
+
+ function update_schema()
+ {
+ return array(
+ 'add_tables' => array(
+ $this->table_prefix . 'login_attempts' => array(
+ 'COLUMNS' => array(
+ // this column was removed from the database updater
+ // after 3.0.9-RC3 was released. It might still exist
+ // in 3.0.9-RCX installations and has to be dropped in
+ // 3.0.12 after the db_tools class is capable of properly
+ // removing a primary key.
+ // 'attempt_id' => array('UINT', NULL, 'auto_increment'),
+ 'attempt_ip' => array('VCHAR:40', ''),
+ 'attempt_browser' => array('VCHAR:150', ''),
+ 'attempt_forwarded_for' => array('VCHAR:255', ''),
+ 'attempt_time' => array('TIMESTAMP', 0),
+ 'user_id' => array('UINT', 0),
+ 'username' => array('VCHAR_UNI:255', 0),
+ 'username_clean' => array('VCHAR_CI', 0),
+ ),
+ //'PRIMARY_KEY' => 'attempt_id',
+ 'KEYS' => array(
+ 'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')),
+ 'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')),
+ 'att_time' => array('INDEX', array('attempt_time')),
+ 'user_id' => array('INDEX', 'user_id'),
+ ),
+ ),
+ ),
+ 'change_columns' => array(
+ $this->table_prefix . 'bbcode' => array(
+ 'bbcode_id' => array('USINT', 0),
+ ),
+ ),
+ );
+ }
+
+ function update_data()
+ {
+ return array(
+ array('config.add', array('ip_login_limit_max', 50)),
+ array('config.add', array('ip_login_limit_time', 21600)),
+ array('config.add', array('ip_login_limit_use_forwarded', 0)),
+ array('custom', array(array(&$this, 'update_file_extension_group_names'))),
+ array('custom', array(array(&$this, 'fix_firebird_qa_captcha'))),
+ );
+ }
+
+ function update_file_extension_group_names()
+ {
+ // Update file extension group names to use language strings, again.
+ $sql = 'SELECT group_id, group_name
+ FROM ' . EXTENSION_GROUPS_TABLE . '
+ WHERE group_name ' . $this->db->sql_like_expression('EXT_GROUP_' . $this->db->any_char);
+ $result = $this->db->sql_query($sql);
+
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $sql_ary = array(
+ 'group_name' => substr($row['group_name'], 10), // Strip off 'EXT_GROUP_'
+ );
+
+ $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . '
+ SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . '
+ WHERE group_id = ' . $row['group_id'];
+ $this->sql_query($sql);
+ }
+ $this->db->sql_freeresult($result);
+ }
+
+ function fix_firebird_qa_captcha()
+ {
+ // Recover from potentially broken Q&A CAPTCHA table on firebird
+ // Q&A CAPTCHA was uninstallable, so it's safe to remove these
+ // without data loss
+ if ($this->db_tools->sql_layer == 'firebird')
+ {
+ $tables = array(
+ $this->table_prefix . 'captcha_questions',
+ $this->table_prefix . 'captcha_answers',
+ $this->table_prefix . 'qa_confirm',
+ );
+ foreach ($tables as $table)
+ {
+ if ($this->db_tools->sql_table_exists($table))
+ {
+ $this->db_tools->sql_table_drop($table);
+ }
+ }
+ }
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_9_rc2.php b/phpBB/includes/db/migration/data/3_0_9_rc2.php
new file mode 100644
index 0000000000..589047670a
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_9_rc2.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_9_rc2 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_9_rc1');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_9_rc3.php b/phpBB/includes/db/migration/data/3_0_9_rc3.php
new file mode 100644
index 0000000000..06061cbcb6
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_9_rc3.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_9_rc3 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_9_rc2');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}
diff --git a/phpBB/includes/db/migration/data/3_0_9_rc4.php b/phpBB/includes/db/migration/data/3_0_9_rc4.php
new file mode 100644
index 0000000000..04b3ae4b39
--- /dev/null
+++ b/phpBB/includes/db/migration/data/3_0_9_rc4.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+class phpbb_db_migration_data_3_0_9_rc4 extends phpbb_db_migration
+{
+ function depends_on()
+ {
+ return array('phpbb_db_migration_data_3_0_9_rc3');
+ }
+
+ function update_schema()
+ {
+ return array();
+ }
+
+ function update_data()
+ {
+ }
+}