mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
- do not include if there are no files fetched with glob()
- allow options for merged files on update (merge, new file, old file) git-svn-id: file:///svn/phpbb/trunk@7848 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
c923e4191a
commit
179c77ccdd
6 changed files with 117 additions and 12 deletions
|
@ -185,10 +185,34 @@
|
|||
<br /><span>{L_NUM_CONFLICTS}: {files.NUM_CONFLICTS}</span>
|
||||
<!-- ENDIF -->
|
||||
</dt>
|
||||
<dd style="margin-left: 60%;"><!-- IF not files.S_BINARY -->[ <a href="{files.U_SHOW_DIFF}" onclick="popup('{files.U_SHOW_DIFF}', 700, 500); return false;">{files.L_SHOW_DIFF}</a> ]<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --></dd>
|
||||
<dd style="margin-left: 60%;"><!-- IF files.STATUS eq 'modified' --> <!-- ELSE --><!-- IF not files.S_BINARY -->[ <a href="{files.U_SHOW_DIFF}" onclick="popup('{files.U_SHOW_DIFF}', 700, 500); return false;">{files.L_SHOW_DIFF}</a> ]<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --><!-- ENDIF --></dd>
|
||||
<!-- IF files.S_CUSTOM -->
|
||||
<dd style="margin-left: 60%;"><label><input type="checkbox" name="no_update[]" value="{files.FILENAME}" class="radio" /> {L_DO_NOT_UPDATE}</label></dd>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF files.STATUS eq 'modified' -->
|
||||
</dl>
|
||||
<dl>
|
||||
<dt style="width: 60%"><label><input type="radio" class="radio" name="modified[{files.FILENAME}]" value="0" checked="checked" /> {L_MERGE_MODIFICATIONS_OPTION}</label></dt>
|
||||
<dd style="margin-left: 60%;"><!-- IF not files.S_BINARY -->[ <a href="{files.U_SHOW_DIFF}" onclick="popup('{files.U_SHOW_DIFF}', 700, 500); return false;">{files.L_SHOW_DIFF}</a> ]<!-- ELSE -->{L_BINARY_FILE}<!-- ENDIF --></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt style="width: 60%"><label><input type="radio" class="radio" name="modified[{files.FILENAME}]" value="1" /> {L_MERGE_NO_MERGE_NEW_OPTION}</label></dt>
|
||||
<dd style="margin-left: 60%;"><!-- IF not files.S_BINARY -->[<a href="{files.U_VIEW_NO_MERGE_NEW}" onclick="popup('{files.U_VIEW_NO_MERGE_NEW}', 700, 500); return false;">{L_SHOW_DIFF_FINAL}</a>]<!-- ELSE --> <!-- ENDIF --></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt style="width: 60%"><label><input type="radio" class="radio" name="modified[{files.FILENAME}]" value="2" /> {L_MERGE_NO_MERGE_MOD_OPTION}</label></dt>
|
||||
<dd style="margin-left: 60%;"><!-- IF not files.S_BINARY -->[<a href="{files.U_VIEW_NO_MERGE_MOD}" onclick="popup('{files.U_VIEW_NO_MERGE_MOD}', 700, 500); return false;">{L_SHOW_DIFF_FINAL}</a>]<!-- ELSE --> <!-- ENDIF --></dd>
|
||||
</dl>
|
||||
<!-- IF not files.S_LAST_ROW -->
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend><img src="{T_IMAGE_PATH}file_{files.STATUS}.gif" alt="{files.L_STATUS}" /></legend>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF files.STATUS eq 'conflict' -->
|
||||
</dl>
|
||||
<dl>
|
||||
|
@ -218,7 +242,7 @@
|
|||
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
<!-- IF files.STATUS neq 'conflict' --></dl><!-- ENDIF -->
|
||||
<!-- IF files.STATUS neq 'conflict' and files.STATUS neq 'modified' --></dl><!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
<!-- END files -->
|
||||
|
||||
|
|
|
@ -42,11 +42,16 @@ function resize_panel()
|
|||
width: 99%;
|
||||
}
|
||||
|
||||
#diff_content {
|
||||
padding: 30px 10px 10px;
|
||||
}
|
||||
|
||||
<!-- IF DIFF_MODE neq 'side_by_side' and DIFF_MODE neq 'raw' -->
|
||||
div#codepanel {
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
height: 350px;
|
||||
display: inline-block;
|
||||
}
|
||||
<!-- ELSE -->
|
||||
div#codepanel {
|
||||
|
@ -230,7 +235,7 @@ table.hrdiff caption span {
|
|||
<div id="acp">
|
||||
<div class="panel" id="codepanel">
|
||||
<span class="corners-top"><span></span></span>
|
||||
<div id="content">
|
||||
<div id="diff_content">
|
||||
<div id="main">
|
||||
|
||||
<!-- IF S_DIFF_CONFLICT_FILE -->
|
||||
|
|
|
@ -188,6 +188,7 @@ p a {
|
|||
<ul class="menu">
|
||||
<li>[Fix] Parse error in MCP ban (Bug #13109)</li>
|
||||
<li>[Fix] Correctly hide online status in the profile (Bug #13059)</li>
|
||||
<li>[Feature] Let the user choose how to update modified files (merging, using new file or using old file) within automatic updater</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
@ -209,7 +210,7 @@ p a {
|
|||
<li>[Fix] Correct approval of posts in global announcements (Bug #12699)</li>
|
||||
<li>[Sec] Do not allow setup spiders/robots to post, even if permissions are given. We see no reason why this should be possible. (Thanks to Frank Rizzo for convincing us regarding this)</li>
|
||||
<li>[Sec] Do not display the last active column within the memberlist if u_viewonline permission is not given (Bug #12797)</li>
|
||||
<li>[Fix] Display custom profile field "date" based on users language (Bug #12787)</li>
|
||||
<li>[Fix] Display custom profile field "date" based on users language (Bug #12787)</li>
|
||||
<li>[Fix] Allow adding of help language files within subdirectories (Bug #12783)</li>
|
||||
<li>[Fix] Correctly apply smileys on posting having # within their emotion code</li>
|
||||
<li>[Fix] Correctly convert smileys having double quotes within their emotion code (Bug #12731)</li>
|
||||
|
|
|
@ -127,11 +127,15 @@ class p_master
|
|||
if (file_exists($user->lang_path . 'mods'))
|
||||
{
|
||||
$add_files = array();
|
||||
$info_files = glob($user->lang_path . 'mods/info_' . strtolower($this->p_class) . '_*.' . $phpEx, GLOB_NOSORT);
|
||||
|
||||
foreach (glob($user->lang_path . 'mods/info_' . strtolower($this->p_class) . '_*.' . $phpEx, GLOB_NOSORT) as $file)
|
||||
if ($info_files !== false && sizeof($info_files))
|
||||
{
|
||||
foreach ($info_files as $file)
|
||||
{
|
||||
$add_files[] = 'mods/' . substr(basename($file), 0, -(strlen($phpEx) + 1));
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof($add_files))
|
||||
{
|
||||
|
|
|
@ -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':
|
||||
|
||||
$option = (isset($modified[$file_struct['filename']])) ? $modified[$file_struct['filename']] : 0;
|
||||
|
||||
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,8 +971,26 @@ class install_update extends module
|
|||
break;
|
||||
|
||||
case 'modified':
|
||||
$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':
|
||||
case 'new_conflict':
|
||||
|
|
|
@ -421,6 +421,9 @@ $lang = array_merge($lang, array(
|
|||
'LOGIN_UPDATE_EXPLAIN' => 'In order to update your installation you need to login first.',
|
||||
|
||||
'MAPPING_FILE_STRUCTURE' => 'To ease the upload here are the file locations which map your phpBB installation.',
|
||||
|
||||
'MERGE_MODIFICATIONS_OPTION' => 'Merge modifications',
|
||||
|
||||
'MERGE_NO_MERGE_NEW_OPTION' => 'Do not merge - use new file',
|
||||
'MERGE_NO_MERGE_MOD_OPTION' => 'Do not merge - use currently installed file',
|
||||
'MERGE_MOD_FILE_OPTION' => 'Merge differences and use modified code within conflicting block',
|
||||
|
|
Loading…
Add table
Reference in a new issue