1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 11:13:59 +02:00

- Allow download of conflicting file for later reference in automatic updater

- Default difference view is now 'inline' instead of 'side by side'
- Added new option for merging differences to conflicting files in automatic updater


git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9252 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2009-01-12 16:58:47 +00:00
parent 507d8b0385
commit 189e7cdf45
6 changed files with 231 additions and 132 deletions

View File

@@ -371,14 +371,14 @@ class install_update extends module
continue;
}
$template->assign_block_vars('files', array(
/* $template->assign_block_vars('files', array(
'S_STATUS' => true,
'STATUS' => $status,
'L_STATUS' => $user->lang['STATUS_' . strtoupper($status)],
'TITLE' => $user->lang['FILES_' . strtoupper($status)],
'EXPLAIN' => $user->lang['FILES_' . strtoupper($status) . '_EXPLAIN'],
)
);
);*/
foreach ($filelist as $file_struct)
{
@@ -398,7 +398,7 @@ class install_update extends module
$diff_url = append_sid($this->p_master->module_url, "mode=$mode&sub=file_check&action=diff&status=$status&file=" . urlencode($file_struct['filename']));
$template->assign_block_vars('files', array(
$template->assign_block_vars($status, array(
'STATUS' => $status,
'FILENAME' => $filename,
@@ -685,7 +685,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_output());
$contents = implode("\n", $diff->merged_new_output());
unset($diff);
break;
}
@@ -1053,7 +1053,7 @@ class install_update extends module
$status = request_var('status', '');
$file = request_var('file', '');
$diff_mode = request_var('diff_mode', 'side_by_side');
$diff_mode = request_var('diff_mode', 'inline');
// First of all make sure the file is within our file update list with the correct status
$found_entry = array();
@@ -1097,9 +1097,7 @@ class install_update extends module
break;
case MERGE_NEW_FILE:
case MERGE_MOD_FILE:
/*
$diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $file, $this->new_location . $original_file);
$tmp = array(
@@ -1116,17 +1114,37 @@ class install_update extends module
$this->page_title = 'VIEWING_FILE_CONTENTS';
break;
default:
*/
// Merge differences and use new phpBB code for conflicted blocks
case MERGE_NEW_FILE:
case MERGE_MOD_FILE:
$diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $file, $this->new_location . $original_file);
$template->assign_vars(array(
'S_DIFF_CONFLICT_FILE' => true,
'NUM_CONFLICTS' => $diff->merged_output(false, false, false, true))
'NUM_CONFLICTS' => $diff->get_num_conflicts())
);
$diff = $this->return_diff($phpbb_root_path . $file, $diff->merged_output());
$diff = $this->return_diff($phpbb_root_path . $file, ($option == MERGE_NEW_FILE) ? $diff->merged_new_output() : $diff->merged_orig_output());
break;
// Download conflict file
default:
$diff = $this->return_diff($this->old_location . $original_file, $phpbb_root_path . $file, $this->new_location . $original_file);
header('Pragma: no-cache');
header("Content-Type: application/octetstream; name=\"$file\"");
header("Content-disposition: attachment; filename=$file");
@set_time_limit(0);
echo implode("\n", $diff->get_conflicts_content());
flush();
exit;
break;
}
@@ -1433,9 +1451,9 @@ class install_update extends module
unset($tmp);
if ($diff->merged_output(false, false, false, true))
if ($diff->get_num_conflicts())
{
$update_ary['conflicts'] = $diff->_conflicting_blocks;
$update_ary['conflicts'] = $diff->get_num_conflicts();
// There is one special case... users having merged with a conflicting file... we need to check this
$tmp = array(
@@ -1462,7 +1480,7 @@ class install_update extends module
$tmp = array(
'file1' => file_get_contents($phpbb_root_path . $file),
'file2' => implode("\n", $diff->merged_output()),
'file2' => implode("\n", $diff->merged_new_output()),
);
// now compare the merged output with the original file to see if the modified file is up to date
@@ -1648,4 +1666,4 @@ class install_update extends module
}
}
?>
?>