From c616b2b3368bc72e8b7d83bda2fabfbccb9099e5 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 15 Sep 2009 19:01:42 +0000 Subject: fix coppa setting in convertor (Bug #50735) - at the same time increase target phpBB version number for the phpBB2 convertor and convertor version number. ;) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10148 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/convertors/convert_phpbb20.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index f4fc466ac7..5a6603883b 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -31,8 +31,8 @@ unset($dbpasswd); */ $convertor_data = array( 'forum_name' => 'phpBB 2.0.x', - 'version' => '1.0.2', - 'phpbb_version' => '3.0.4', + 'version' => '1.0.3', + 'phpbb_version' => '3.0.6', 'author' => 'phpBB Group', 'dbms' => $dbms, 'dbhost' => $dbhost, @@ -129,7 +129,7 @@ $config_schema = array( 'board_timezone' => 'board_timezone', 'allow_privmsg' => 'not(privmsg_disable)', 'gzip_compress' => 'gzip_compress', - 'coppa_enable' => 'is_empty(coppa_mail)', + 'coppa_enable' => '!is_empty(coppa_mail)', 'coppa_fax' => 'coppa_fax', 'coppa_mail' => 'coppa_mail', 'record_online_users' => 'record_online_users', -- cgit v1.2.1 From 38c4bcad55ce1e8203e5507b6db2700120688aae Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 18 Sep 2009 18:18:54 +0000 Subject: Ok, after 20+ hours i think i fixed all grave issues with the updater - smaller memory footprint - better checks for already updated files - even less conflicts - fixed automatic conflict resolving after successful merges - no more conflicts for $Id$ changes - fixed skip_whitespace_changes bug where code blocks were added to diff_op_add whereby the previous or next diff_op_copy already had the change - correctly display merged files in diff view (previously it happened that the old file was used for comparision, although the new file was different/newer/merged) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10163 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/install_update.php | 196 +++++++++++++++++++++------------------ 1 file changed, 106 insertions(+), 90 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index ad72652e97..3c16a2e82b 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -687,7 +687,7 @@ class install_update extends module default: $diff = $this->return_diff($this->old_location . $original_filename, $phpbb_root_path . $file_struct['filename'], $this->new_location . $original_filename); - $contents = implode("\n", $diff->merged_new_output()); + $contents = implode("\n", $diff->merged_output()); unset($diff); break; } @@ -1104,24 +1104,6 @@ class install_update extends module break; -/* - $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $file, $this->new_location . $original_file); - - $tmp = array( - 'file1' => array(), - 'file2' => ($option == MERGE_NEW_FILE) ? implode("\n", $diff->merged_new_output()) : implode("\n", $diff->merged_orig_output()), - ); - - $diff = new diff($tmp['file1'], $tmp['file2']); - - unset($tmp); - - $template->assign_var('S_DIFF_NEW_FILE', true); - $diff_mode = 'inline'; - $this->page_title = 'VIEWING_FILE_CONTENTS'; - - break; -*/ // Merge differences and use new phpBB code for conflicted blocks case MERGE_NEW_FILE: case MERGE_MOD_FILE: @@ -1175,6 +1157,7 @@ class install_update extends module default: $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $original_file, $this->new_location . $file); + $diff = $this->return_diff($phpbb_root_path . $file, $diff->merged_output()); break; } break; @@ -1362,6 +1345,9 @@ class install_update extends module $update_ary['original'] = $original_file; } + // we only want to know if the files are successfully merged and newlines could result in errors (duplicate addition of lines and such things) + // Therefore we check for empty diffs with two methods, preserving newlines and not preserving them (which mostly works best, therefore the first option) + // On a successfull update the new location file exists but the old one does not exist. // Check for this circumstance, the new file need to be up-to-date with the current file then... if (!file_exists($this->old_location . $original_file) && file_exists($this->new_location . $original_file) && file_exists($phpbb_root_path . $file)) @@ -1401,104 +1387,134 @@ class install_update extends module trigger_error($user->lang['INCOMPLETE_UPDATE_FILES'], E_USER_ERROR); } - $tmp = array( - 'file1' => file_get_contents($this->old_location . $original_file), - 'file2' => file_get_contents($phpbb_root_path . $file), - ); + $preserve_cr_ary = array(false, true); + + foreach ($preserve_cr_ary as $preserve_cr) + { + $tmp = array( + 'file1' => file_get_contents($this->old_location . $original_file), + 'file2' => file_get_contents($phpbb_root_path . $file), + ); + + // We need to diff the contents here to make sure the file is really the one we expect + $diff = new diff($tmp['file1'], $tmp['file2'], $preserve_cr); + $empty_1 = $diff->is_empty(); + + unset($tmp, $diff); + + $tmp = array( + 'file1' => file_get_contents($this->new_location . $original_file), + 'file2' => file_get_contents($phpbb_root_path . $file), + ); - // We need to diff the contents here to make sure the file is really the one we expect - $diff = new diff($tmp['file1'], $tmp['file2'], false); - $empty_1 = $diff->is_empty(); + $diff = new diff($tmp['file1'], $tmp['file2'], $preserve_cr); + $empty_2 = $diff->is_empty(); - unset($tmp, $diff); + unset($tmp, $diff); - $tmp = array( - 'file1' => file_get_contents($this->new_location . $original_file), - 'file2' => file_get_contents($phpbb_root_path . $file), - ); + // If the file is not modified we are finished here... + if ($empty_1) + { + // Further check if it is already up to date - it could happen that non-modified files + // slip through + if ($empty_2) + { + $update_list['up_to_date'][] = $update_ary; + return; + } - // We need to diff the contents here to make sure the file is really the one we expect - $diff = new diff($tmp['file1'], $tmp['file2'], false); - $empty_2 = $diff->is_empty(); + $update_list['not_modified'][] = $update_ary; + return; + } - unset($tmp, $diff); + // If the file had been modified then we need to check if it is already up to date - // If the file is not modified we are finished here... - if ($empty_1) - { - // Further check if it is already up to date - it could happen that non-modified files - // slip through + // if there are no differences we have an up-to-date file... if ($empty_2) { $update_list['up_to_date'][] = $update_ary; return; } - - $update_list['not_modified'][] = $update_ary; - return; } - // If the file had been modified then we need to check if it is already up to date + $conflicts = false; - // if there are no differences we have an up-to-date file... - if ($empty_2) + foreach ($preserve_cr_ary as $preserve_cr) { - $update_list['up_to_date'][] = $update_ary; - return; - } + // if the file is modified we try to make sure a merge succeed + $tmp = array( + 'orig' => file_get_contents($this->old_location . $original_file), + 'final1' => file_get_contents($phpbb_root_path . $file), + 'final2' => file_get_contents($this->new_location . $original_file), + ); - // if the file is modified we try to make sure a merge succeed - $tmp = array( - 'file1' => file_get_contents($this->old_location . $original_file), - 'file2' => file_get_contents($phpbb_root_path . $file), - 'file3' => file_get_contents($this->new_location . $original_file), - ); + $diff = new diff3($tmp['orig'], $tmp['final1'], $tmp['final2'], $preserve_cr); + unset($tmp); - $diff = new diff3($tmp['file1'], $tmp['file2'], $tmp['file3'], false); + if (!$diff->get_num_conflicts()) + { + $tmp = array( + 'file1' => file_get_contents($phpbb_root_path . $file), + 'file2' => implode("\n", $diff->merged_output()), + ); - unset($tmp); + // now compare the merged output with the original file to see if the modified file is up to date + $diff2 = new diff($tmp['file1'], $tmp['file2'], $preserve_cr); + $empty = $diff2->is_empty(); - if ($diff->get_num_conflicts()) - { - $update_ary['conflicts'] = $diff->get_num_conflicts(); + unset($diff, $diff2); - // There is one special case... users having merged with a conflicting file... we need to check this - $tmp = array( - 'file1' => file_get_contents($phpbb_root_path . $file), - 'file2' => implode("\n", $diff->merged_orig_output()), - ); + if ($empty) + { + $update_list['up_to_date'][] = $update_ary; + return; + } + } + else + { + // There is one special case... users having merged with a conflicting file... we need to check this + $tmp = array( + 'file1' => file_get_contents($phpbb_root_path . $file), + 'file2' => implode("\n", $diff->merged_new_output()), + ); - $diff = new diff($tmp['file1'], $tmp['file2'], false); - $empty = $diff->is_empty(); + $diff2 = new diff($tmp['file1'], $tmp['file2'], $preserve_cr); + $empty = $diff2->is_empty(); - if ($empty) - { - unset($update_ary['conflicts']); - unset($diff); - $update_list['up_to_date'][] = $update_ary; - return; - } + if (!$empty) + { + unset($tmp, $diff2); - $update_list['conflict'][] = $update_ary; - unset($diff); + // We check if the user merged with his output + $tmp = array( + 'file1' => file_get_contents($phpbb_root_path . $file), + 'file2' => implode("\n", $diff->merged_orig_output()), + ); - return; - } + $diff2 = new diff($tmp['file1'], $tmp['file2'], $preserve_cr); + $empty = $diff2->is_empty(); + } - $tmp = array( - 'file1' => file_get_contents($phpbb_root_path . $file), - 'file2' => implode("\n", $diff->merged_new_output()), - ); + if (!$empty) + { + $conflicts = $diff->get_num_conflicts(); + } - // now compare the merged output with the original file to see if the modified file is up to date - $diff = new diff($tmp['file1'], $tmp['file2'], false); - $empty = $diff->is_empty(); + unset($diff, $diff2); - if ($empty) - { - unset($diff); + if ($empty) + { + // A conflict got resolved... + $update_list['up_to_date'][] = $update_ary; + return; + } + } + } - $update_list['up_to_date'][] = $update_ary; + if ($conflicts !== false) + { + $update_ary['conflicts'] = $conflicts; + $update_list['conflict'][] = $update_ary; return; } @@ -1650,7 +1666,7 @@ class install_update extends module /** * Wrapper for returning a diff object */ - function &return_diff() + function return_diff() { $args = func_get_args(); $three_way_diff = (func_num_args() > 2) ? true : false; -- cgit v1.2.1 From 7a244e1d2bd62f87d678c754b0890fb7ac379673 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 20 Sep 2009 16:18:41 +0000 Subject: if preserve_cr is true and the file generated no conflict but is obviously not "empty" we tag it as modified because preserve_cr is the default mode for showing modifications (else the user gets a resolvable conflict and may wonder why ;)) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10167 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/install_update.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'phpBB/install') diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 3c16a2e82b..ab7ec35705 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -1469,6 +1469,13 @@ class install_update extends module $update_list['up_to_date'][] = $update_ary; return; } + + // If we preserve cr tag it as modified because the conflict would not show in this mode anyway + if ($preserve_cr) + { + $update_list['modified'][] = $update_ary; + return; + } } else { -- cgit v1.2.1 From 54c22ae52a0e18232cac8fed342ea52f2e2a793d Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 24 Sep 2009 08:53:17 +0000 Subject: remove log_time index (was not used at all) At the same time the database updater now supports checking for existing indexes. The db tools will not have this in 3.0.6 (the db tools have a function to retrieve all indexes) and i need to test the updater on all DBMS today... git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10183 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 131 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 126 insertions(+), 5 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 41983400fc..d6f9348b29 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -$updates_to_version = '3.0.6-RC1'; +$updates_to_version = '3.0.6-RC2'; // Enter any version to update from to test updates. The version within the db will not be updated. $debug_from_version = false; @@ -868,9 +868,6 @@ function database_update_info() ), ), 'add_index' => array( - LOG_TABLE => array( - 'log_time' => array('log_time'), - ), REPORTS_TABLE => array( 'post_id' => array('post_id'), 'pm_id' => array('pm_id'), @@ -880,6 +877,12 @@ function database_update_info() ), ), ), + // Changes from 3.0.6-RC1 to 3.0.6-RC2 + '3.0.6-RC1' => array( + 'drop_keys' => array( + LOG_TABLE => array('log_time'), + ), + ), ); } @@ -1506,6 +1509,16 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; + + // Changes from 3.0.6-RC1 to 3.0.6-RC2 + case '3.0.6-RC1': + + // We check if there is an index for log_time within the logs table + + + // If so, we remove it + + break; } } @@ -1902,7 +1915,8 @@ class updater_db_tools { if ($column_exists) { - $sqlite_data[$table]['change_columns'][] = $result; + continue; +// $sqlite_data[$table]['change_columns'][] = $result; } else { @@ -1924,6 +1938,11 @@ class updater_db_tools { foreach ($indexes as $index_name) { + if (!$this->sql_index_exists($table, $index_name)) + { + continue; + } + $result = $this->sql_index_drop($table, $index_name); if ($this->return_statements) @@ -1984,6 +2003,11 @@ class updater_db_tools { foreach ($index_array as $index_name => $column) { + if ($this->sql_index_exists($table, $index_name)) + { + continue; + } + $result = $this->sql_create_unique_index($table, $index_name, $column); if ($this->return_statements) @@ -2001,6 +2025,11 @@ class updater_db_tools { foreach ($index_array as $index_name => $column) { + if ($this->sql_index_exists($table, $index_name)) + { + continue; + } + $result = $this->sql_create_index($table, $index_name, $column); if ($this->return_statements) @@ -2308,6 +2337,98 @@ class updater_db_tools } } + /** + * Check if a specified index exists in table + * + * @param string $table_name Table to check the index at + * @param string $index_name The index name to check + * + * @return bool True if index exists, else false + */ + function sql_index_exists($table_name, $index_name) + { + if ($this->sql_layer == 'mssql') + { + $sql = "EXEC sp_statistics '$table_name'"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['TYPE'] == 3) + { + if (strtolower($row['INDEX_NAME']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + } + $this->db->sql_freeresult($result); + + return false; + } + + switch ($this->sql_layer) + { + case 'firebird': + $sql = "SELECT LOWER(RDB\$INDEX_NAME) as index_name + FROM RDB\$INDICES + WHERE RDB\$RELATION_NAME = " . strtoupper($table_name) . " + AND RDB\$UNIQUE_FLAG IS NULL + AND RDB\$FOREIGN_KEY IS NULL"; + $col = 'index_name'; + break; + + case 'postgres': + $sql = "SELECT ic.relname as index_name + FROM pg_class bc, pg_class ic, pg_index i + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (bc.relname = '" . $table_name . "') + AND (i.indisunique != 't') + AND (i.indisprimary != 't')"; + $col = 'index_name'; + break; + + case 'mysql_40': + case 'mysql_41': + $sql = 'SHOW KEYS + FROM ' . $table_name; + $col = 'Key_name'; + break; + + case 'oracle': + $sql = "SELECT index_name + FROM user_indexes + WHERE table_name = '" . $table_name . "' + AND generated = 'N'"; + break; + + case 'sqlite': + $sql = "PRAGMA index_info('" . $table_name . "');"; + $col = 'name'; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && !$row['Non_unique']) + { + continue; + } + + if (strtolower($row[$col]) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + /** * Private method for performing sql statements (either execute them or return them) * @access private -- cgit v1.2.1 From 023760c8b2402418310a3717db8349cac0342e42 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 24 Sep 2009 15:36:05 +0000 Subject: I think i need to check other DBMS more often. :/ - fix index check for sqlite, firebird and oracle - add check for unique index - fix changing default value for column in mssql (add constraint) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10185 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 170 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 162 insertions(+), 8 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index d6f9348b29..ee4d45c57c 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2003,7 +2003,7 @@ class updater_db_tools { foreach ($index_array as $index_name => $column) { - if ($this->sql_index_exists($table, $index_name)) + if ($this->sql_unique_index_exists($table, $index_name)) { continue; } @@ -2338,7 +2338,7 @@ class updater_db_tools } /** - * Check if a specified index exists in table + * Check if a specified index exists in table. Does not return PRIMARY KEY and UNIQUE indexes. * * @param string $table_name Table to check the index at * @param string $index_name The index name to check @@ -2373,7 +2373,7 @@ class updater_db_tools case 'firebird': $sql = "SELECT LOWER(RDB\$INDEX_NAME) as index_name FROM RDB\$INDICES - WHERE RDB\$RELATION_NAME = " . strtoupper($table_name) . " + WHERE RDB\$RELATION_NAME = '" . strtoupper($table_name) . "' AND RDB\$UNIQUE_FLAG IS NULL AND RDB\$FOREIGN_KEY IS NULL"; $col = 'index_name'; @@ -2400,12 +2400,14 @@ class updater_db_tools case 'oracle': $sql = "SELECT index_name FROM user_indexes - WHERE table_name = '" . $table_name . "' - AND generated = 'N'"; + WHERE table_name = '" . strtoupper($table_name) . "' + AND generated = 'N' + AND uniqueness = 'NONUNIQUE'"; + $col = 'index_name'; break; case 'sqlite': - $sql = "PRAGMA index_info('" . $table_name . "');"; + $sql = "PRAGMA index_list('" . $table_name . "');"; $col = 'name'; break; } @@ -2418,6 +2420,135 @@ class updater_db_tools continue; } + // These DBMS prefix index name with the table name + switch ($this->sql_layer) + { + case 'firebird': + case 'oracle': + case 'postgres': + case 'sqlite': + $row[$col] = substr($row[$col], strlen($table_name) + 1); + break; + } + + if (strtolower($row[$col]) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * Check if a specified UNIQUE index exists in table. + * + * @param string $table_name Table to check the index at + * @param string $index_name The index name to check + * + * @return bool True if index exists, else false + */ + function sql_unique_index_exists($table_name, $index_name) + { + if ($this->sql_layer == 'mssql') + { + $sql = "EXEC sp_statistics '$table_name'"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // Usually NON_UNIQUE is the column we want to check, but we allow for both + if ($row['TYPE'] == 3) + { + if (strtolower($row['INDEX_NAME']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + } + $this->db->sql_freeresult($result); + return false; + } + + switch ($this->sql_layer) + { + case 'firebird': + $sql = "SELECT LOWER(RDB\$INDEX_NAME) as index_name + FROM RDB\$INDICES + WHERE RDB\$RELATION_NAME = '" . strtoupper($table_name) . "' + AND RDB\$UNIQUE_FLAG IS NOT NULL + AND RDB\$FOREIGN_KEY IS NULL"; + $col = 'index_name'; + break; + + case 'postgres': + $sql = "SELECT ic.relname as index_name, i.indisunique + FROM pg_class bc, pg_class ic, pg_index i + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (bc.relname = '" . $table_name . "') + AND (i.indisprimary != 't')"; + $col = 'index_name'; + break; + + case 'mysql_40': + case 'mysql_41': + $sql = 'SHOW KEYS + FROM ' . $table_name; + $col = 'Key_name'; + break; + + case 'oracle': + $sql = "SELECT index_name, table_owner + FROM user_indexes + WHERE table_name = '" . strtoupper($table_name) . "' + AND generated = 'N' + AND uniqueness = 'UNIQUE' + AND index_name LIKE 'U_%'"; + $col = 'index_name'; + break; + + case 'sqlite': + $sql = "PRAGMA index_list('" . $table_name . "') WHERE unique = 1;"; + $col = 'name'; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && ($row['Non_unique'] || $row[$col] == 'PRIMARY')) + { + continue; + } + + if ($this->sql_layer == 'sqlite' && !$row['unique']) + { + continue; + } + + if ($this->sql_layer == 'postgres' && $row['indisunique'] != 't') + { + continue; + } + + // These DBMS prefix index name with the table name + switch ($this->sql_layer) + { + case 'oracle': + $row[$col] = substr($row[$col], strlen('U_' . $row['table_owner']) + 1); + break; + + case 'firebird': + case 'postgres': + case 'sqlite': + $row[$col] = substr($row[$col], strlen($table_name) + 1); + break; + } + if (strtolower($row[$col]) == strtolower($index_name)) { $this->db->sql_freeresult($result); @@ -2562,11 +2693,13 @@ class updater_db_tools // For hexadecimal values do not use single quotes if (strpos($column_data[1], '0x') === 0) { - $sql_default .= 'DEFAULT (' . $column_data[1] . ') '; + $return_array['default'] = 'DEFAULT (' . $column_data[1] . ') '; + $sql_default .= $return_array['default']; } else { - $sql_default .= 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; + $return_array['default'] = 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; + $sql_default .= $return_array['default']; } } @@ -3086,6 +3219,27 @@ class updater_db_tools case 'mssql': $statements[] = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql']; + + if (!empty($column_data['default'])) + { + // Using TRANSACT-SQL for this statement because we do not want to have colliding data if statements are executed at a later stage + $statements[] = "DECLARE @drop_default_name VARCHAR(100), @cmd VARCHAR(1000) + SET @drop_default_name = + (SELECT so.name FROM sysobjects so + JOIN sysconstraints sc ON so.id = sc.constid + WHERE object_name(so.parent_obj) = '{$table_name}' + AND so.xtype = 'D' + AND sc.colid = (SELECT colid FROM syscolumns + WHERE id = object_id('{$table_name}') + AND name = '{$column_name}')) + IF @drop_default_name <> '' + BEGIN + SET @cmd = 'ALTER TABLE [{$table_name}] DROP CONSTRAINT [' + @drop_default_name + ']' + EXEC(@cmd) + END + SET @cmd = 'ALTER TABLE [{$table_name}] ADD CONSTRAINT [DF_{$table_name}_{$column_name}_1] {$column_data['default']} FOR [{$column_name}]' + EXEC(@cmd)"; + } break; case 'mysql_40': -- cgit v1.2.1 From 3e0bf1f8a4c5a7c6cb39ccb52ea37f49b658c15f Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 25 Sep 2009 09:41:49 +0000 Subject: prepare for RC2 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10187 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 8 +------- phpBB/install/schemas/schema_data.sql | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index ee4d45c57c..7ef76535d3 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1510,14 +1510,8 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; - // Changes from 3.0.6-RC1 to 3.0.6-RC2 + // No changes from 3.0.6-RC1 to 3.0.6-RC2 case '3.0.6-RC1': - - // We check if there is an index for log_time within the logs table - - - // If so, we remove it - break; } } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 5c653afc41..18bd8d8e9a 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -239,7 +239,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.6-RC1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.6-RC2'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); -- cgit v1.2.1