From 5a429ee61e54f78da1120395c05d9fb5a2af7d04 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 1 Feb 2010 01:14:06 +0000 Subject: Change version numbers to 3.0.7 and 3.0.8-dev in preparation for development on next release git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10468 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index c7205de89d..4efc52088f 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -$updates_to_version = '3.0.7-dev'; +$updates_to_version = '3.0.8-dev'; // Enter any version to update from to test updates. The version within the db will not be updated. $debug_from_version = false; -- cgit v1.2.1 From 1802b9ff9286a7fc24493e71b3432816cbdbfcd8 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 11 Feb 2010 00:02:51 +0000 Subject: Support for Microsoft's Native SQL Server Driver for PHP - Patch by Chris Pucci at Microsoft [Bug #57055] If you are using SQL Server, please try to test this new dbal so we can safely include it in 3.0.8. If you want to try it on a current phpBB version you can apply the latest version of the patch to your board which you can find attached to the bug tracker ticket (look in the comments for the latest version, the one in the ticket itself is outdated): http://www.phpbb.com/bugs/phpbb3/ticket.php?ticket_id=57055 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10489 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 51 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 4 deletions(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 4efc52088f..055fa78995 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1743,7 +1743,37 @@ class updater_db_tools 'VCHAR_CI' => '[varchar] (255)', 'VARBINARY' => '[varchar] (255)', ), - + + 'mssqlnative' => array( + 'INT:' => '[int]', + 'BINT' => '[float]', + 'UINT' => '[int]', + 'UINT:' => '[int]', + 'TINT:' => '[int]', + 'USINT' => '[int]', + 'BOOL' => '[int]', + 'VCHAR' => '[varchar] (255)', + 'VCHAR:' => '[varchar] (%d)', + 'CHAR:' => '[char] (%d)', + 'XSTEXT' => '[varchar] (1000)', + 'STEXT' => '[varchar] (3000)', + 'TEXT' => '[varchar] (8000)', + 'MTEXT' => '[text]', + 'XSTEXT_UNI'=> '[varchar] (100)', + 'STEXT_UNI' => '[varchar] (255)', + 'TEXT_UNI' => '[varchar] (4000)', + 'MTEXT_UNI' => '[text]', + 'TIMESTAMP' => '[int]', + 'DECIMAL' => '[float]', + 'DECIMAL:' => '[float]', + 'PDECIMAL' => '[float]', + 'PDECIMAL:' => '[float]', + 'VCHAR_UNI' => '[varchar] (255)', + 'VCHAR_UNI:'=> '[varchar] (%d)', + 'VCHAR_CI' => '[varchar] (255)', + 'VARBINARY' => '[varchar] (255)', + ), + 'oracle' => array( 'INT:' => 'number(%d)', 'BINT' => 'number(20)', @@ -1845,7 +1875,7 @@ class updater_db_tools * A list of supported DBMS. We change this class to support more DBMS, the DBMS itself only need to follow some rules. * @var array */ - var $supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); + var $supported_dbms = array('firebird', 'mssql', 'mssqlnative', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); /** * This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array). @@ -1890,6 +1920,10 @@ class updater_db_tools case 'mssql_odbc': $this->sql_layer = 'mssql'; break; + + case 'mssqlnative': + $this->sql_layer = 'mssqlnative'; + break; default: $this->sql_layer = $this->db->sql_layer; @@ -2322,6 +2356,7 @@ class updater_db_tools // same deal with PostgreSQL, we must perform more complex operations than // we technically could case 'mssql': + case 'mssqlnative': $sql = "SELECT c.name FROM syscolumns c LEFT JOIN sysobjects o ON c.id = o.id @@ -2425,7 +2460,7 @@ class updater_db_tools */ function sql_index_exists($table_name, $index_name) { - if ($this->sql_layer == 'mssql') + if ($this->sql_layer == 'mssql' || $this->sql_layer == 'mssqlnative') { $sql = "EXEC sp_statistics '$table_name'"; $result = $this->db->sql_query($sql); @@ -2530,7 +2565,7 @@ class updater_db_tools */ function sql_unique_index_exists($table_name, $index_name) { - if ($this->sql_layer == 'mssql') + if ($this->sql_layer == 'mssql' || $this->sql_layer == 'mssqlnative') { $sql = "EXEC sp_statistics '$table_name'"; $result = $this->db->sql_query($sql); @@ -2769,6 +2804,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': $sql .= " {$column_type} "; $sql_default = " {$column_type} "; @@ -2918,6 +2954,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': // Does not support AFTER, only through temporary table $statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; break; @@ -3042,6 +3079,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': $statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; break; @@ -3136,6 +3174,7 @@ class updater_db_tools switch ($this->sql_layer) { case 'mssql': + case 'mssqlnative': $statements[] = 'DROP INDEX ' . $table_name . '.' . $index_name; break; @@ -3172,6 +3211,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': $sql = "ALTER TABLE [{$table_name}] WITH NOCHECK ADD "; $sql .= "CONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED ("; $sql .= '[' . implode("],\n\t\t[", $column) . ']'; @@ -3265,6 +3305,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': $statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; break; } @@ -3294,6 +3335,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': $statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; break; } @@ -3326,6 +3368,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': $statements[] = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql']; if (!empty($column_data['default'])) -- cgit v1.2.1 From 68cac354aac9df3866944685186733c4d7305aee Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 17 Feb 2010 12:58:52 +0000 Subject: Add 3.0.7-RC1 to the updater. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10497 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 055fa78995..909c390a9e 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -906,6 +906,9 @@ function database_update_info() ), ), ), + + // No changes from 3.0.7-RC1 to 3.0.7 + '3.0.7-RC1' => array(), ); } @@ -1597,6 +1600,10 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; + + // No changes from 3.0.7-RC1 to 3.0.7 + case '3.0.7-RC1': + break; } } -- cgit v1.2.1 From 30b83896a1718400307de7d531c16a152c0f6668 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 18 Feb 2010 01:17:30 +0000 Subject: Fix Bug #57755 - Make user_email_hash() function independent from system's architecture. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10499 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 909c390a9e..29d82be987 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1603,6 +1603,34 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.7-RC1 to 3.0.7 case '3.0.7-RC1': + + $sql = 'SELECT user_id, user_email, user_email_hash + FROM ' . USERS_TABLE . ' + WHERE user_type <> ' . USER_IGNORE . " + AND user_email <> ''"; + $result = $db->sql_query($sql); + + $i = 0; + while ($row = $db->sql_fetchrow($result)) + { + $user_email_hash = phpbb_email_hash($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 ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . (int) $row['user_id']; + __sql($sql, $errored, $error_ary, ($i % 100 == 0)); + + ++$i; + } + } + $db->sql_freeresult($result); + break; } } -- cgit v1.2.1 From c02fedb6c7a80da0be5bd84fe512b3ba6df9f9ee Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 18 Feb 2010 02:01:32 +0000 Subject: Revising r10499, #57755 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10503 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 29d82be987..5cb2cd28cc 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1601,7 +1601,7 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; - // No changes from 3.0.7-RC1 to 3.0.7 + // Changes from 3.0.7-RC1 to 3.0.7 case '3.0.7-RC1': $sql = 'SELECT user_id, user_email, user_email_hash @@ -1624,13 +1624,15 @@ function change_database_data(&$no_updates, $version) $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . (int) $row['user_id']; - __sql($sql, $errored, $error_ary, ($i % 100 == 0)); + _sql($sql, $errored, $error_ary, ($i % 100 == 0)); ++$i; } } $db->sql_freeresult($result); + $no_updates = false; + break; } } -- cgit v1.2.1 From 576722cead7f2de34db3e5a853662bca0e0601da Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 18 Feb 2010 02:06:20 +0000 Subject: Adding 3.0.7-RC2 to database updater git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10504 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 5cb2cd28cc..4db78331bd 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -907,8 +907,10 @@ function database_update_info() ), ), - // No changes from 3.0.7-RC1 to 3.0.7 + // No changes from 3.0.7-RC1 to 3.0.7-RC2 '3.0.7-RC1' => array(), + // No changes from 3.0.7-RC2 to 3.0.7 + '3.0.7-RC2' => array(), ); } @@ -1601,7 +1603,7 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; - // Changes from 3.0.7-RC1 to 3.0.7 + // Changes from 3.0.7-RC1 to 3.0.7-RC2 case '3.0.7-RC1': $sql = 'SELECT user_id, user_email, user_email_hash @@ -1634,6 +1636,10 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; + + // No changes from 3.0.7-RC2 to 3.0.7 + case '3.0.7-RC2': + break; } } -- cgit v1.2.1 From e8f01ff74b58d9d73ff3c32507d843b8b14d92e5 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 22 Feb 2010 19:33:27 +0000 Subject: We have to use a 'snapshot' of the function there, because it might not be available yet. - Bug #57755 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10520 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 4db78331bd..df8aadfdb2 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1615,7 +1615,9 @@ function change_database_data(&$no_updates, $version) $i = 0; while ($row = $db->sql_fetchrow($result)) { - $user_email_hash = phpbb_email_hash($row['user_email']); + // 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']) { -- cgit v1.2.1 From 58dc5a191c0203ea6d98c37df26b0830b3bf8203 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 11 Apr 2010 20:42:49 +0200 Subject: [ticket/7717] Localise default extension groups for attachments PHPBB3-7717 --- phpBB/install/database_update.php | 41 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 7af0c86314..47d261dc46 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -913,6 +913,8 @@ function database_update_info() '3.0.7-RC2' => array(), // No changes from 3.0.7 to 3.0.7-PL1 '3.0.7' => array(), + // No changes from 3.0.7-PL1 to 3.0.8-RC1 + '3.0.7-PL1' => array(), ); } @@ -923,7 +925,7 @@ function database_update_info() *****************************************************************************/ function change_database_data(&$no_updates, $version) { - global $db, $errored, $error_ary, $config, $phpbb_root_path, $phpEx; + global $db, $errored, $error_ary, $config, $phpbb_root_path, $phpEx, $user; switch ($version) { @@ -1648,6 +1650,43 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.7 to 3.0.7-PL1 case '3.0.7': break; + + // Changes from 3.0.7-PL1 to 3.0.8-RC1 + case '3.0.7-PL1': + $user->add_lang('acp/attachments'); + $extension_groups = array( + $user->lang['EXT_GROUP_ARCHIVES'] => 'ARCHIVES', + $user->lang['EXT_GROUP_DOCUMENTS'] => 'DOCUMENTS', + $user->lang['EXT_GROUP_DOWNLOADABLE_FILES'] => 'DOWNLOADABLE_FILES', + $user->lang['EXT_GROUP_FLASH_FILES'] => 'FLASH_FILES', + $user->lang['EXT_GROUP_IMAGES'] => 'IMAGES', + $user->lang['EXT_GROUP_PLAIN_TEXT'] => 'PLAIN_TEXT', + $user->lang['EXT_GROUP_QUICKTIME_MEDIA'] => 'QUICKTIME_MEDIA', + $user->lang['EXT_GROUP_REAL_MEDIA'] => 'REAL_MEDIA', + $user->lang['EXT_GROUP_WINDOWS_MEDIA'] => 'WINDOWS_MEDIA', + ); + + $sql = 'SELECT group_id, group_name + FROM ' . EXTENSION_GROUPS_TABLE; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (isset($extension_groups[$row['group_name']])) + { + $sql_ary = array( + 'group_name' => $extension_groups[$row['group_name']], + ); + $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE group_id = ' . (int) $row['group_id']; + _sql($sql, $errored, $error_ary); + } + } + $db->sql_freeresult($result); + + + $no_updates = false; + break; } } -- cgit v1.2.1 From 160d1bfd07ce016e34b52588bcbf4c7c71bd7fb0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 May 2010 13:03:56 +0200 Subject: [ticket/9578] ACP Posting tab is missing "Post settings" module. PHPBB3-9578 --- phpBB/install/database_update.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 47d261dc46..917a5401e5 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1684,6 +1684,19 @@ function change_database_data(&$no_updates, $version) } $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); $no_updates = false; break; -- cgit v1.2.1 From 4637709f0a3701bdc3b44efeb08c919f73a3cb1e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 May 2010 13:13:53 +0200 Subject: [ticket/9628] _add_module 'after'-parameter does not work correctly. The modules were grouped by left_id so num_modules is always one (hopefully), but the number of rows is the actual value we'd like to know. Removing the GROUP BY resolves the issue. PHPBB3-9628 --- phpBB/install/database_update.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 47d261dc46..145b6b50ae 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -685,7 +685,6 @@ function _add_modules($modules_to_install) WHERE module_class = '" . $db->sql_escape($module_data['class']) . "' AND parent_id = {$parent_id} AND left_id BETWEEN {$first_left_id} AND {$module_row['left_id']} - GROUP BY left_id ORDER BY left_id"; $result = $db->sql_query($sql); $steps = (int) $db->sql_fetchfield('num_modules'); -- cgit v1.2.1 From 38fc35a497e375797afdce6bc3cba952b9ed5344 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 4 Apr 2010 18:50:23 +0200 Subject: [ticket/9167] Detect and remove any dead left over shadow topics on update. PHPBB3-9167 --- phpBB/install/database_update.php | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 47d261dc46..7b27363125 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1684,6 +1684,51 @@ function change_database_data(&$no_updates, $version) } $db->sql_freeresult($result); + // 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', + ), + ), + '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']; + + $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + + if (!empty($topic_ids)) + { + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + } + while (sizeof($topic_ids) == $batch_size); + + // Sync the forums we have deleted shadow topics from. + sync('forum', 'forum_id', $sync_forum_ids, true, true); $no_updates = false; break; -- cgit v1.2.1 From d00f2ec1832f6c391a1526a1263d45ed98d17e23 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sat, 3 Jul 2010 22:12:25 -0500 Subject: [ticket/9690] Add forthcoming Bing Bot to list of recognized bots Microsoft will rename MSN Bot to Bing Bot later this year, and change its user agent. This updates phpBB to be aware of Bing Bot PHPBB3-9690 --- phpBB/install/database_update.php | 52 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 47d261dc46..708abcb64d 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1685,6 +1685,58 @@ function change_database_data(&$no_updates, $version) $db->sql_freeresult($result); + // add Bing Bot + $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); + + 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($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $bot_name = 'Bing [Bot]'; + $bot_agent = 'bingbot/'; + $bot_ip = ''; + + $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' => $config['default_lang'], + 'user_style' => $config['default_style'], + 'user_timezone' => 0, + 'user_dateformat' => $config['default_dateformat'], + 'user_allow_massemail' => 0, + ); + + $user_id = user_add($user_row); + + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $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, + )); + + _sql($sql, $errored, $error_ary); + // end Bing Bot addition + $no_updates = false; break; } -- cgit v1.2.1 From e5d5d581727ce61e653fdfc9a30effb69799aac5 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 23 Jul 2010 12:48:01 +0200 Subject: [ticket/9091] Extract IPv4 address from addresses mapped into IPv6. PHPBB3-9091 --- phpBB/install/database_update.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 83bbbf4577..4524dd20bf 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -119,6 +119,7 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false); unset($dbpasswd); $user->ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : ''; +$user->ip = (stripos($user->ip, '::ffff:') === 0) ? substr($user->ip, 7) : $user->ip; $sql = "SELECT config_value FROM " . CONFIG_TABLE . " -- cgit v1.2.1 From b83163634f98de0e76e5332c1e4511dbc1483e56 Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 21 Aug 2010 01:26:23 +0800 Subject: [ticket/9613] Fix missing database part for unread posts search load switch. A record for load_unreads_search parameter had to be added to CONFIG_TABLE. PHPBB3-9613 --- phpBB/install/database_update.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index fec09f89db..a5457c722f 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1795,6 +1795,9 @@ function change_database_data(&$no_updates, $version) // Sync the forums we have deleted shadow topics from. sync('forum', 'forum_id', $sync_forum_ids, true, true); + // Unread posts search load switch + set_config('load_unreads_search', '1'); + $no_updates = false; break; } -- cgit v1.2.1 From bb191a1d696994c1d27bbd0457457cf538dff7ee Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 2 Sep 2010 19:38:34 +0200 Subject: [ticket/8944] Add index length to CREATE INDEX for MySQL4 in database_update Fixes following SQL error when updating the database to 3.0.6. BLOB column 'post_username' used in key specification without a key length PHPBB3-8944 --- phpBB/install/database_update.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index fec09f89db..019469b061 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -880,7 +880,7 @@ function database_update_info() 'pm_id' => array('pm_id'), ), POSTS_TABLE => array( - 'post_username' => array('post_username'), + 'post_username' => array('post_username:255'), ), ), ), @@ -2141,7 +2141,7 @@ class updater_db_tools * drop_columns: Removing/Dropping columns * add_primary_keys: adding primary keys * add_unique_index: adding an unique index - * add_index: adding an index + * add_index: adding an index (can be column:index_size if you need to provide size) * * The values are in this format: * {TABLE NAME} => array( @@ -3520,6 +3520,12 @@ class updater_db_tools { $statements = array(); + // remove index length unless MySQL4 + if ('mysql_40' != $this->sql_layer) + { + $column = preg_replace('#:.*$#', '', $column); + } + switch ($this->sql_layer) { case 'firebird': @@ -3530,6 +3536,16 @@ class updater_db_tools break; case 'mysql_40': + // add index size to definition as required by MySQL4 + foreach ($column as $i => $col) + { + if (false !== strpos($col, ':')) + { + list($col, $index_size) = explode(':', $col); + $column[$i] = "$col($index_size)"; + } + } + // no break case 'mysql_41': $statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; break; -- cgit v1.2.1 From b9afa26280bcb2aa6d11f8b15faec4aad23dced8 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 21 Oct 2010 10:22:03 +0200 Subject: [ticket/9807] Update existing module permissions in database PHPBB3-9807 --- phpBB/install/database_update.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 019469b061..ce0e9a6480 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1697,6 +1697,14 @@ function change_database_data(&$no_updates, $version) _add_modules($modules_to_install); + // update + $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); + // add Bing Bot $sql = 'SELECT group_id, group_colour FROM ' . GROUPS_TABLE . " -- cgit v1.2.1 From f7e37dae867ef28295f00bbe2d27ebf065a8a3fd Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 8 Nov 2010 01:16:37 +0100 Subject: [ticket/9885] Fix extension group name updater. Loop through all languages. Fix a regression introduced by 58dc5a191c0203ea6d98c37df26b0830b3bf8203. The problem is that $user->add_lang() includes language strings from the board root folder instead of the update folder. Because the database updater is run first, the root folder files have not been upgrade yet. Thus, the language strings we're looking for cannot be found. Since the language strings we are looking for have been moved from the install.php language file to acp/attachments.php it should be possible to always find them in either file. When there is an acp/attachments.php file in the update package, it can also be used. We now also loop through all the installed languages as well, because the board could have been installed in a language other than the admin's current language. PHPBB3-9885 PHPBB3-7717 --- phpBB/install/database_update.php | 70 +++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 24 deletions(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index e65237266b..7443185935 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -925,7 +925,7 @@ function database_update_info() *****************************************************************************/ function change_database_data(&$no_updates, $version) { - global $db, $errored, $error_ary, $config, $phpbb_root_path, $phpEx, $user; + global $db, $errored, $error_ary, $config, $phpbb_root_path, $phpEx; switch ($version) { @@ -1653,33 +1653,55 @@ function change_database_data(&$no_updates, $version) // Changes from 3.0.7-PL1 to 3.0.8-RC1 case '3.0.7-PL1': - $user->add_lang('acp/attachments'); - $extension_groups = array( - $user->lang['EXT_GROUP_ARCHIVES'] => 'ARCHIVES', - $user->lang['EXT_GROUP_DOCUMENTS'] => 'DOCUMENTS', - $user->lang['EXT_GROUP_DOWNLOADABLE_FILES'] => 'DOWNLOADABLE_FILES', - $user->lang['EXT_GROUP_FLASH_FILES'] => 'FLASH_FILES', - $user->lang['EXT_GROUP_IMAGES'] => 'IMAGES', - $user->lang['EXT_GROUP_PLAIN_TEXT'] => 'PLAIN_TEXT', - $user->lang['EXT_GROUP_QUICKTIME_MEDIA'] => 'QUICKTIME_MEDIA', - $user->lang['EXT_GROUP_REAL_MEDIA'] => 'REAL_MEDIA', - $user->lang['EXT_GROUP_WINDOWS_MEDIA'] => 'WINDOWS_MEDIA', - ); - - $sql = 'SELECT group_id, group_name - FROM ' . EXTENSION_GROUPS_TABLE; + // Update file extension group names to use language strings. + $sql = 'SELECT lang_dir + FROM ' . LANG_TABLE; $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $extension_groups_updated = array(); + while ($lang_dir = $db->sql_fetchfield('lang_dir')) { - if (isset($extension_groups[$row['group_name']])) + $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( + "{$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", + ); + + foreach ($lang_files as $lang_file) { - $sql_ary = array( - 'group_name' => $extension_groups[$row['group_name']], - ); - $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE group_id = ' . (int) $row['group_id']; - _sql($sql, $errored, $error_ary); + 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 ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE group_name = '" . $db->sql_escape($lang_val) . "'"; + _sql($sql, $errored, $error_ary); + + $extension_groups_updated[$lang_key] = true; + } } } $db->sql_freeresult($result); -- cgit v1.2.1 From 794c0f6b68e678b1384fd5d7627d9a81dfb04568 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 7 Nov 2010 22:48:52 +0100 Subject: [develop-olympus] Bumping version number for 3.0.8-RC1. --- phpBB/install/database_update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index e65237266b..86b83bb542 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -$updates_to_version = '3.0.8-dev'; +$updates_to_version = '3.0.8-RC1'; // Enter any version to update from to test updates. The version within the db will not be updated. $debug_from_version = false; @@ -3754,4 +3754,4 @@ class updater_db_tools } } -?> \ No newline at end of file +?> -- cgit v1.2.1 From b88f35caef616a3bded1193c67f7b84086644ff5 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 8 Nov 2010 23:22:06 +0100 Subject: [ticket/9888] Update fails when Bing [Bot] was already added to the users table Added a check whether the user already exists before we try to add it. PHPBB3-9888 --- phpBB/install/database_update.php | 91 ++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 40 deletions(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index e65237266b..b3ae38a7b6 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1707,55 +1707,66 @@ function change_database_data(&$no_updates, $version) _sql($sql, $errored, $error_ary); // add Bing Bot - $sql = 'SELECT group_id, group_colour - FROM ' . GROUPS_TABLE . " - WHERE group_name = '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); - $group_row = $db->sql_fetchrow($result); + $bing_already_added = (bool) $db->sql_fetchfield('user_id'); $db->sql_freeresult($result); - if (!$group_row) + if (!$bing_already_added) { - // default fallback, should never get here - $group_row['group_id'] = 6; - $group_row['group_colour'] = '9E8DA7'; - } + $bot_agent = 'bingbot/'; + $bot_ip = ''; + $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); - if (!function_exists('user_add')) - { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - } + if (!$group_row) + { + // default fallback, should never get here + $group_row['group_id'] = 6; + $group_row['group_colour'] = '9E8DA7'; + } - $bot_name = 'Bing [Bot]'; - $bot_agent = 'bingbot/'; - $bot_ip = ''; - - $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' => $config['default_lang'], - 'user_style' => $config['default_style'], - 'user_timezone' => 0, - 'user_dateformat' => $config['default_dateformat'], - 'user_allow_massemail' => 0, - ); + if (!function_exists('user_add')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } - $user_id = user_add($user_row); + $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' => $config['default_lang'], + 'user_style' => $config['default_style'], + 'user_timezone' => 0, + 'user_dateformat' => $config['default_dateformat'], + 'user_allow_massemail' => 0, + ); - $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $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, - )); + $user_id = user_add($user_row); - _sql($sql, $errored, $error_ary); + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $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, + )); + + _sql($sql, $errored, $error_ary); + } // end Bing Bot addition // Delete shadow topics pointing to not existing topics -- cgit v1.2.1 From d722eeb64b0a8906ae62e814156de3582c16b820 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 8 Nov 2010 23:03:20 +0100 Subject: [ticket/9886] Update fails on PostgreSQL because of an error in _add_module PHPBB3-9886 --- phpBB/install/database_update.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index e65237266b..fd7591268d 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -685,8 +685,7 @@ function _add_modules($modules_to_install) FROM ' . MODULES_TABLE . " WHERE module_class = '" . $db->sql_escape($module_data['class']) . "' AND parent_id = {$parent_id} - AND left_id BETWEEN {$first_left_id} AND {$module_row['left_id']} - ORDER BY left_id"; + AND left_id BETWEEN {$first_left_id} AND {$module_row['left_id']}"; $result = $db->sql_query($sql); $steps = (int) $db->sql_fetchfield('num_modules'); $db->sql_freeresult($result); -- cgit v1.2.1 From c9c19874d6de1af67d4240ff85618dd16ee57b29 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 9 Nov 2010 21:03:29 +0100 Subject: [ticket/9884] Reduce queue interval to 60 seconds, email package size to 20 PHPBB3-9884 --- phpBB/install/database_update.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 46b74c884c..8d67d2353d 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1840,6 +1840,17 @@ function change_database_data(&$no_updates, $version) // Unread posts search load switch set_config('load_unreads_search', '1'); + // Reduce queue interval to 60 seconds, email package size to 20 + if ($config['queue_interval'] == 600) + { + set_config('queue_interval', '60'); + } + + if ($config['email_package_size'] == 50) + { + set_config('email_package_size', '20'); + } + $no_updates = false; break; } -- cgit v1.2.1 From 9d55794e33c32a94f3630a2708c288c7b8ea6eef Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 10 Nov 2010 17:56:05 +0100 Subject: [ticket/9891] Updater drops language-selection after database-update PHPBB3-9891 --- phpBB/install/database_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 95f7cdae87..01e8ef7658 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -477,7 +477,7 @@ else

-

" class="button1">

+

" class="button1">

Date: Fri, 19 Nov 2010 11:36:14 +0100 Subject: [prep-release-3.0.8] Incrementing version number to 3.0.8 and update changelog --- phpBB/install/database_update.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 01e8ef7658..0ec9f24190 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -$updates_to_version = '3.0.8-RC1'; +$updates_to_version = '3.0.8'; // Enter any version to update from to test updates. The version within the db will not be updated. $debug_from_version = false; @@ -914,6 +914,8 @@ function database_update_info() '3.0.7' => array(), // No changes from 3.0.7-PL1 to 3.0.8-RC1 '3.0.7-PL1' => array(), + // No changes from 3.0.8-RC1 to 3.0.8 + '3.0.8-RC1' => array(), ); } @@ -1672,7 +1674,7 @@ function change_database_data(&$no_updates, $version) "{$phpbb_root_path}language/$lang_dir/install.$phpEx", "{$phpbb_root_path}language/$lang_dir/acp/attachments.$phpEx", ); - + foreach ($lang_files as $lang_file) { if (!file_exists($lang_file)) @@ -1852,6 +1854,10 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; + + // No changes from 3.0.8-RC1 to 3.0.8 + case '3.0.8-RC1': + break; } } @@ -1998,7 +2004,7 @@ class updater_db_tools 'VCHAR_CI' => '[varchar] (255)', 'VARBINARY' => '[varchar] (255)', ), - + 'mssqlnative' => array( 'INT:' => '[int]', 'BINT' => '[float]', @@ -2028,7 +2034,7 @@ class updater_db_tools 'VCHAR_CI' => '[varchar] (255)', 'VARBINARY' => '[varchar] (255)', ), - + 'oracle' => array( 'INT:' => 'number(%d)', 'BINT' => 'number(20)', @@ -2175,7 +2181,7 @@ class updater_db_tools case 'mssql_odbc': $this->sql_layer = 'mssql'; break; - + case 'mssqlnative': $this->sql_layer = 'mssqlnative'; break; -- cgit v1.2.1