aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-03-02 01:09:11 +0100
committerNils Adermann <naderman@naderman.de>2010-03-02 01:09:11 +0100
commit35a62ed0085df6d767f38d6fbd0e02b8f0fbfc40 (patch)
tree098e3b3e043f6c3e31c9c922287f76e5ec726e03 /phpBB/install
parent3b46681652ad0c235ccdcafc449c3d759335df17 (diff)
parent05b5dc316779f67641e17859d5c69f296b24288d (diff)
downloadforums-35a62ed0085df6d767f38d6fbd0e02b8f0fbfc40.tar
forums-35a62ed0085df6d767f38d6fbd0e02b8f0fbfc40.tar.gz
forums-35a62ed0085df6d767f38d6fbd0e02b8f0fbfc40.tar.bz2
forums-35a62ed0085df6d767f38d6fbd0e02b8f0fbfc40.tar.xz
forums-35a62ed0085df6d767f38d6fbd0e02b8f0fbfc40.zip
Merge commit 'release-3.0.7-RC2'
Diffstat (limited to 'phpBB/install')
-rw-r--r--phpBB/install/convertors/convert_phpbb20.php11
-rw-r--r--phpBB/install/database_update.php47
-rw-r--r--phpBB/install/install_update.php105
-rw-r--r--phpBB/install/schemas/schema_data.sql4
4 files changed, 138 insertions, 29 deletions
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 5a6603883b..1d6b79bbec 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -32,7 +32,7 @@ unset($dbpasswd);
$convertor_data = array(
'forum_name' => 'phpBB 2.0.x',
'version' => '1.0.3',
- 'phpbb_version' => '3.0.6',
+ 'phpbb_version' => '3.0.7',
'author' => '<a href="http://www.phpbb.com/">phpBB Group</a>',
'dbms' => $dbms,
'dbhost' => $dbhost,
@@ -78,6 +78,15 @@ $tables = array(
*
* 'table_format' can take the value 'file' to indicate a config file. In this case array_name
* is set to indicate the name of the array the config values are stored in
+* Example of using a file:
+* $config_schema = array(
+* 'table_format' => 'file',
+* 'filename' => 'NAME OF FILE', // If the file is not in the root directory, the path needs to be added with no leading slash
+* 'array_name' => 'NAME OF ARRAY', // Only used if the configuration file stores the setting in an array.
+* 'settings' => array(
+* 'board_email' => 'SUPPORT_EMAIL', // target config name => source target name
+* )
+* );
* 'table_format' can be an array if the values are stored in a table which is an assosciative array
* (as per phpBB 2.0.x)
* If left empty, values are assumed to be stored in a table where each config setting is
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 1d58276b10..9bb09747da 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -8,7 +8,7 @@
*
*/
-$updates_to_version = '3.0.7-RC1';
+$updates_to_version = '3.0.7-RC2';
// Enter any version to update from to test updates. The version within the db will not be updated.
$debug_from_version = false;
@@ -906,6 +906,11 @@ function database_update_info()
),
),
),
+
+ // 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(),
);
}
@@ -1597,6 +1602,46 @@ function change_database_data(&$no_updates, $version)
$no_updates = false;
break;
+
+ // 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
+ FROM ' . USERS_TABLE . '
+ WHERE user_type <> ' . USER_IGNORE . "
+ AND user_email <> ''";
+ $result = $db->sql_query($sql);
+
+ $i = 0;
+ while ($row = $db->sql_fetchrow($result))
+ {
+ // 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 ' . $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);
+
+ $no_updates = false;
+
+ break;
+
+ // No changes from 3.0.7-RC2 to 3.0.7
+ case '3.0.7-RC2':
+ break;
}
}
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php
index 9f5a428029..a5e54a354a 100644
--- a/phpBB/install/install_update.php
+++ b/phpBB/install/install_update.php
@@ -240,6 +240,7 @@ class install_update extends module
// Make sure the update list is destroyed.
$cache->destroy('_update_list');
$cache->destroy('_diff_files');
+ $cache->destroy('_expected_files');
break;
case 'version_check':
@@ -312,7 +313,14 @@ class install_update extends module
case 'file_check':
- // Make sure the previous file collection is no longer valid...
+ // retrieve info on what changes should have already been made to the files.
+ $expected_files = $cache->get('_expected_files');
+ if (!$expected_files)
+ {
+ $expected_files = array();
+ }
+
+ // Now make sure the previous file collection is no longer valid...
$cache->destroy('_diff_files');
$this->page_title = 'STAGE_FILE_CHECK';
@@ -349,7 +357,7 @@ class install_update extends module
if ($get_new_list)
{
- $this->get_update_structure($update_list);
+ $this->get_update_structure($update_list, $expected_files);
$cache->put('_update_list', $update_list);
// Refresh the page if we are still not finished...
@@ -384,6 +392,8 @@ class install_update extends module
);
}
+ $new_expected_files = array();
+
// Now assign the list to the template
foreach ($update_list as $status => $filelist)
{
@@ -419,29 +429,38 @@ class install_update extends module
$diff_url = append_sid($this->p_master->module_url, "mode=$mode&amp;sub=file_check&amp;action=diff&amp;status=$status&amp;file=" . urlencode($file_struct['filename']));
- $template->assign_block_vars($status, array(
- 'STATUS' => $status,
+ if (isset($file_struct['as_expected']) && $file_struct['as_expected'])
+ {
+ $new_expected_files[$file_struct['filename']] = $expected_files[$file_struct['filename']];
+ }
+ else
+ {
+ $template->assign_block_vars($status, array(
+ 'STATUS' => $status,
- 'FILENAME' => $filename,
- 'DIR_PART' => $dir_part,
- 'FILE_PART' => $file_part,
- 'NUM_CONFLICTS' => (isset($file_struct['conflicts'])) ? $file_struct['conflicts'] : 0,
+ 'FILENAME' => $filename,
+ 'DIR_PART' => $dir_part,
+ 'FILE_PART' => $file_part,
+ 'NUM_CONFLICTS' => (isset($file_struct['conflicts'])) ? $file_struct['conflicts'] : 0,
- 'S_CUSTOM' => ($file_struct['custom']) ? true : false,
- 'S_BINARY' => $s_binary,
- 'CUSTOM_ORIGINAL' => ($file_struct['custom']) ? $file_struct['original'] : '',
+ 'S_CUSTOM' => ($file_struct['custom']) ? true : false,
+ 'S_BINARY' => $s_binary,
+ 'CUSTOM_ORIGINAL' => ($file_struct['custom']) ? $file_struct['original'] : '',
- 'U_SHOW_DIFF' => $diff_url,
- 'L_SHOW_DIFF' => ($status != 'up_to_date') ? $user->lang['SHOW_DIFF_' . strtoupper($status)] : '',
+ 'U_SHOW_DIFF' => $diff_url,
+ 'L_SHOW_DIFF' => ($status != 'up_to_date') ? $user->lang['SHOW_DIFF_' . strtoupper($status)] : '',
- 'U_VIEW_MOD_FILE' => $diff_url . '&amp;op=' . MERGE_MOD_FILE,
- 'U_VIEW_NEW_FILE' => $diff_url . '&amp;op=' . MERGE_NEW_FILE,
- 'U_VIEW_NO_MERGE_MOD' => $diff_url . '&amp;op=' . MERGE_NO_MERGE_MOD,
- 'U_VIEW_NO_MERGE_NEW' => $diff_url . '&amp;op=' . MERGE_NO_MERGE_NEW,
- ));
+ 'U_VIEW_MOD_FILE' => $diff_url . '&amp;op=' . MERGE_MOD_FILE,
+ 'U_VIEW_NEW_FILE' => $diff_url . '&amp;op=' . MERGE_NEW_FILE,
+ 'U_VIEW_NO_MERGE_MOD' => $diff_url . '&amp;op=' . MERGE_NO_MERGE_MOD,
+ 'U_VIEW_NO_MERGE_NEW' => $diff_url . '&amp;op=' . MERGE_NO_MERGE_NEW,
+ ));
+ }
}
}
+ $cache->put('_expected_files', $new_expected_files);
+
$all_up_to_date = true;
foreach ($update_list as $status => $filelist)
{
@@ -617,6 +636,7 @@ class install_update extends module
// Before we do anything, let us diff the files and store the raw file information "somewhere"
$get_files = false;
$file_list = $cache->get('_diff_files');
+ $expected_files = $cache->get('_expected_files');
if ($file_list === false || $file_list['status'] != -1)
{
@@ -632,6 +652,11 @@ class install_update extends module
);
}
+ if (!isset($expected_files) || $expected_files === false)
+ {
+ $expected_files = array();
+ }
+
$processed = 0;
foreach ($update_list as $status => $files)
{
@@ -645,6 +670,7 @@ class install_update extends module
// Skip this file if the user selected to not update it
if (in_array($file_struct['filename'], $no_update))
{
+ $expected_files[$file_struct['filename']] = false;
continue;
}
@@ -676,6 +702,15 @@ class install_update extends module
return;
}
+ if (file_exists($phpbb_root_path . $file_struct['filename']))
+ {
+ $contents = file_get_contents($phpbb_root_path . $file_struct['filename']);
+ if (isset($expected_files[$file_struct['filename']]) && md5($contents) == $expected_files[$file_struct['filename']])
+ {
+ continue;
+ }
+ }
+
$original_filename = ($file_struct['custom']) ? $file_struct['original'] : $file_struct['filename'];
switch ($status)
@@ -702,6 +737,7 @@ class install_update extends module
break;
}
+ $expected_files[$file_struct['filename']] = md5($contents);
$file_list[$file_struct['filename']] = '_file_' . md5($file_struct['filename']);
$cache->put($file_list[$file_struct['filename']], base64_encode($contents));
@@ -747,6 +783,7 @@ class install_update extends module
break;
}
+ $expected_files[$file_struct['filename']] = md5($contents);
$file_list[$file_struct['filename']] = '_file_' . md5($file_struct['filename']);
$cache->put($file_list[$file_struct['filename']], base64_encode($contents));
@@ -757,6 +794,7 @@ class install_update extends module
}
}
}
+ $cache->put('_expected_files', $expected_files);
}
$file_list['status'] = -1;
@@ -1217,7 +1255,7 @@ class install_update extends module
/**
* Collect all file status infos we need for the update by diffing all files
*/
- function get_update_structure(&$update_list)
+ function get_update_structure(&$update_list, $expected_files)
{
global $phpbb_root_path, $phpEx, $user;
@@ -1303,7 +1341,7 @@ class install_update extends module
else
{
// not modified?
- $this->make_update_diff($update_list, $file, $file);
+ $this->make_update_diff($update_list, $file, $file, $expected_files);
}
$num_bytes_processed += (file_exists($this->new_location . $file)) ? filesize($this->new_location . $file) : 100 * 1024;
@@ -1344,17 +1382,34 @@ class install_update extends module
/**
* Compare files for storage in update_list
*/
- function make_update_diff(&$update_list, $original_file, $file, $custom = false)
+ function make_update_diff(&$update_list, $original_file, $file, $expected_files, $custom = false)
{
global $phpbb_root_path, $user;
- $update_ary = array('filename' => $file, 'custom' => $custom);
+ $update_ary = array('filename' => $file, 'custom' => $custom, 'as_expected' => false);
if ($custom)
{
$update_ary['original'] = $original_file;
}
+ if (file_exists($phpbb_root_path . $file))
+ {
+ $content = file_get_contents($phpbb_root_path . $file);
+
+ if (isset($expected_files[$file]) && // the user already selected what to do with this file
+ ($expected_files[$file] === false || // the user wanted this file to stay the same, so just assume it's alright
+ $expected_files[$file] === md5($content)))
+ {
+ // the file contains what it was supposed to contain after the merge
+ $update_ary['as_expected'] = true;
+ $update_ary['was_ignored'] = ($expected_files[$file] === false);
+ $update_list['up_to_date'][] = $update_ary;
+
+ return;
+ }
+ }
+
// 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)
@@ -1364,7 +1419,7 @@ class install_update extends module
{
$tmp = array(
'file1' => file_get_contents($this->new_location . $original_file),
- 'file2' => file_get_contents($phpbb_root_path . $file),
+ 'file2' => $content,
);
// We need to diff the contents here to make sure the file is really the one we expect
@@ -1403,7 +1458,7 @@ class install_update extends module
{
$tmp = array(
'file1' => file_get_contents($this->old_location . $original_file),
- 'file2' => file_get_contents($phpbb_root_path . $file),
+ 'file2' => $content,
);
// We need to diff the contents here to make sure the file is really the one we expect
@@ -1414,7 +1469,7 @@ class install_update extends module
$tmp = array(
'file1' => file_get_contents($this->new_location . $original_file),
- 'file2' => file_get_contents($phpbb_root_path . $file),
+ 'file2' => $content,
);
$diff = new diff($tmp['file1'], $tmp['file2'], $preserve_cr);
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 572905becb..61c11701b9 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -241,7 +241,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.7-RC1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.7-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');
@@ -828,4 +828,4 @@ INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'mp3');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogg');
INSERT INTO phpbb_extensions (group_id, extension) VALUES (9, 'ogm');
-# POSTGRES COMMIT # \ No newline at end of file
+# POSTGRES COMMIT #