aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-07-09 11:33:14 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-07-09 11:33:14 +0000
commit179c77ccddcd8bd4df2f29d05b460c6365396d49 (patch)
tree872b58682c59b2e3400fe841e541b5a8c9455db7
parentc923e4191a28026a21c0ebb0dd2120c258d96229 (diff)
downloadforums-179c77ccddcd8bd4df2f29d05b460c6365396d49.tar
forums-179c77ccddcd8bd4df2f29d05b460c6365396d49.tar.gz
forums-179c77ccddcd8bd4df2f29d05b460c6365396d49.tar.bz2
forums-179c77ccddcd8bd4df2f29d05b460c6365396d49.tar.xz
forums-179c77ccddcd8bd4df2f29d05b460c6365396d49.zip
- 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
-rw-r--r--phpBB/adm/style/install_update.html28
-rw-r--r--phpBB/adm/style/install_update_diff.html7
-rw-r--r--phpBB/docs/CHANGELOG.html3
-rw-r--r--phpBB/includes/functions_module.php8
-rw-r--r--phpBB/install/install_update.php80
-rwxr-xr-xphpBB/language/en/install.php3
6 files changed, 117 insertions, 12 deletions
diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html
index 6b361ec3f1..c9a8e4e6c1 100644
--- a/phpBB/adm/style/install_update.html
+++ b/phpBB/adm/style/install_update.html
@@ -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' -->&nbsp;<!-- 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 -->&nbsp;<!-- 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 -->&nbsp;<!-- 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 -->
diff --git a/phpBB/adm/style/install_update_diff.html b/phpBB/adm/style/install_update_diff.html
index 54242d94b4..799ca34292 100644
--- a/phpBB/adm/style/install_update_diff.html
+++ b/phpBB/adm/style/install_update_diff.html
@@ -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 -->
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index bb1ace4c49..1b4cbf8f91 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -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 &quotdate&quot; based on users language (Bug #12787)</li>
+ <li>[Fix] Display custom profile field &quot;date&quot; 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>
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index 1010de643b..073dfa60ad 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -127,10 +127,14 @@ 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))
{
- $add_files[] = 'mods/' . substr(basename($file), 0, -(strlen($phpEx) + 1));
+ foreach ($info_files as $file)
+ {
+ $add_files[] = 'mods/' . substr(basename($file), 0, -(strlen($phpEx) + 1));
+ }
}
if (sizeof($add_files))
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':
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 180157d5e0..8fd95bc0ae 100755
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -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',