aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/install_update.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/install/install_update.php')
-rw-r--r--phpBB/install/install_update.php80
1 files changed, 74 insertions, 6 deletions
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php
index bf1912076f..3a7cbaf37b 100644
--- a/phpBB/install/install_update.php
+++ b/phpBB/install/install_update.php
@@ -82,7 +82,7 @@ class install_update extends module
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
- // Special options for conflicts
+ // Special options for conflicts/modified files
define('MERGE_NO_MERGE_NEW', 1);
define('MERGE_NO_MERGE_MOD', 2);
define('MERGE_NEW_FILE', 3);
@@ -476,11 +476,23 @@ class install_update extends module
$this->page_title = 'STAGE_UPDATE_FILES';
$s_hidden_fields = '';
- foreach (request_var('conflict', array('' => 0)) as $filename => $merge_option)
+ $conflicts = request_var('conflict', array('' => 0));
+ $modified = request_var('modified', array('' => 0));
+
+ foreach ($conflicts as $filename => $merge_option)
{
$s_hidden_fields .= '<input type="hidden" name="conflict[' . htmlspecialchars($filename) . ']" value="' . $merge_option . '" />';
}
+ foreach ($modified as $filename => $merge_option)
+ {
+ if (!$merge_option)
+ {
+ continue;
+ }
+ $s_hidden_fields .= '<input type="hidden" name="modified[' . htmlspecialchars($filename) . ']" value="' . $merge_option . '" />';
+ }
+
$no_update = request_var('no_update', array(0 => ''));
foreach ($no_update as $index => $filename)
@@ -645,6 +657,7 @@ class install_update extends module
$update_list = $cache->get('_update_list');
$conflicts = request_var('conflict', array('' => 0));
+ $modified = request_var('modified', array('' => 0));
if ($update_list === false)
{
@@ -672,6 +685,28 @@ class install_update extends module
$conflicts = $new_conflicts;
}
+ // Build list for modifications
+ if (sizeof($modified))
+ {
+ $modified_filenames = array();
+ foreach ($update_list['modified'] as $files)
+ {
+ $modified_filenames[] = $files['filename'];
+ }
+
+ $new_modified = array();
+ foreach ($modified as $filename => $diff_method)
+ {
+ if (in_array($filename, $modified_filenames))
+ {
+ $new_modified[$filename] = $diff_method;
+ }
+ }
+
+ $modified = $new_modified;
+ }
+
+ // Check number of conflicting files, they need to be equal. For modified files the number can differ
if (sizeof($update_list['conflict']) != sizeof($conflicts))
{
trigger_error($user->lang['MERGE_SELECT_ERROR'], E_USER_ERROR);
@@ -729,10 +764,25 @@ class install_update extends module
case 'modified':
- $diff = $this->return_diff($this->old_location . $original_filename, $phpbb_root_path . $file_struct['filename'], $this->new_location . $original_filename);
+ $option = (isset($modified[$file_struct['filename']])) ? $modified[$file_struct['filename']] : 0;
- $contents = implode("\n", $diff->merged_output());
- unset($diff);
+ switch ($option)
+ {
+ case MERGE_NO_MERGE_NEW:
+ $contents = file_get_contents($this->new_location . $original_filename);
+ break;
+
+ case MERGE_NO_MERGE_MOD:
+ $contents = file_get_contents($phpbb_root_path . $file_struct['filename']);
+ break;
+
+ 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_output());
+ unset($diff);
+ break;
+ }
if ($update_mode == 'download')
{
@@ -921,7 +971,25 @@ class install_update extends module
break;
case 'modified':
- $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $original_file, $this->new_location . $file);
+ $option = request_var('op', 0);
+
+ switch ($option)
+ {
+ case MERGE_NO_MERGE_NEW:
+ case MERGE_NO_MERGE_MOD:
+
+ $diff = $this->return_diff(array(), ($option == MERGE_NO_MERGE_NEW) ? $this->new_location . $original_file : $phpbb_root_path . $file);
+
+ $template->assign_var('S_DIFF_NEW_FILE', true);
+ $diff_mode = 'inline';
+ $this->page_title = 'VIEWING_FILE_CONTENTS';
+
+ break;
+
+ default:
+ $diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $original_file, $this->new_location . $file);
+ break;
+ }
break;
case 'not_modified':