aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMáté Bartus <mate.bartus@gmail.com>2017-11-15 21:44:53 +0100
committerMáté Bartus <mate.bartus@gmail.com>2017-11-15 21:44:53 +0100
commit1a1a2dc0466f6283c5c3a4c6a0ed4ca7c84b4777 (patch)
treeb830298e992483edc0b1274eeef17563b01b8514
parent44d5bde61604979ea6f89951e78edf352f8a9bb5 (diff)
parentf57e3778470ad7df2e69b839fd329e53eb524481 (diff)
downloadforums-1a1a2dc0466f6283c5c3a4c6a0ed4ca7c84b4777.tar
forums-1a1a2dc0466f6283c5c3a4c6a0ed4ca7c84b4777.tar.gz
forums-1a1a2dc0466f6283c5c3a4c6a0ed4ca7c84b4777.tar.bz2
forums-1a1a2dc0466f6283c5c3a4c6a0ed4ca7c84b4777.tar.xz
forums-1a1a2dc0466f6283c5c3a4c6a0ed4ca7c84b4777.zip
Merge pull request #4949 from marc1706/ticket/15353
[ticket/15353] Make sure users can continue update after merging file diff
-rw-r--r--phpBB/adm/style/installer_form.html7
-rw-r--r--phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php6
-rw-r--r--phpBB/phpbb/install/module/update_filesystem/task/diff_files.php43
-rw-r--r--phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php7
4 files changed, 49 insertions, 14 deletions
diff --git a/phpBB/adm/style/installer_form.html b/phpBB/adm/style/installer_form.html
index a38f33c7c2..592d361d1e 100644
--- a/phpBB/adm/style/installer_form.html
+++ b/phpBB/adm/style/installer_form.html
@@ -1,3 +1,4 @@
+<!-- IF FORM_TITLE --><h1>{FORM_TITLE}</h1><!-- ENDIF -->
<form id="<!-- IF FORM_ID -->{FORM_ID}<!-- ELSE -->install_install<!-- ENDIF -->" method="POST" action="{U_ACTION}">
<!-- IF .options -->
<!-- IF S_NOT_ONLY_BUTTON_FORM -->
@@ -8,9 +9,9 @@
<!-- IF options.S_LEGEND -->
<!-- IF not options.S_FIRST_ROW -->
</fieldset>
-
- <fieldset>
<!-- ENDIF -->
+ <fieldset>
+
<legend>{options.LEGEND}</legend>
<!-- ELSE -->
<dl>
@@ -49,7 +50,7 @@
<fieldset class="submit-buttons">
<legend>{L_SUBMIT}</legend>
<!-- BEGIN submit_buttons -->
- <input class="button1<!-- IF submit_buttons.DISABLED --> disabled<!-- ENDIF -->" type="submit" name="{submit_buttons.KEY}" value="{submit_buttons.TITLE}"<!-- IF submit_buttons.DISABLED --> disabled="disabled"<!-- ENDIF --> />
+ <input class="<!-- IF not submit_buttons.IS_SECONDARY -->button1<!-- ELSE -->button2<!-- ENDIF --><!-- IF submit_buttons.DISABLED --> disabled<!-- ENDIF -->" type="submit" name="{submit_buttons.KEY}" value="{submit_buttons.TITLE}"<!-- IF submit_buttons.DISABLED --> disabled="disabled"<!-- ENDIF --> />
<!-- END submit_buttons -->
</fieldset>
<!-- ENDIF -->
diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php
index bce0149890..dd584eff30 100644
--- a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php
+++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php
@@ -187,6 +187,7 @@ class ajax_iohandler extends iohandler_base
$tpl_ary['KEY'] = $input_name;
$tpl_ary['S_EXPLAIN'] = false;
$tpl_ary['DISABLED'] = isset($input_options['disabled']) ? $input_options['disabled'] : false;
+ $tpl_ary['IS_SECONDARY'] = isset($input_options['is_secondary']) ? $input_options['is_secondary'] : false;
if (isset($input_options['default']))
{
@@ -218,6 +219,11 @@ class ajax_iohandler extends iohandler_base
$this->template->assign_block_vars($block_name, $tpl_ary);
}
+ if (isset($form['database_update_submit']) && !$form['database_update_submit']['disabled'])
+ {
+ $this->template->assign_var('FORM_TITLE', $this->language->lang('UPDATE_CONTINUE_UPDATE_PROCESS'));
+ }
+
$this->template->assign_var('S_NOT_ONLY_BUTTON_FORM', $not_button_form);
if (!$not_button_form)
diff --git a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php
index 1792a3b723..8151a24f2d 100644
--- a/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php
+++ b/phpBB/phpbb/install/module/update_filesystem/task/diff_files.php
@@ -103,8 +103,8 @@ class diff_files extends task_base
$old_path = $this->update_helper->get_path_to_old_update_files();
$new_path = $this->update_helper->get_path_to_new_update_files();
- $files_to_diff = $this->installer_config->get('update_files', array());
- $files_to_diff = $files_to_diff['update_with_diff'];
+ $update_files = $this->installer_config->get('update_files', array());
+ $files_to_diff = $update_files['update_with_diff'];
// Set progress bar
$this->iohandler->set_task_count(count($files_to_diff), true);
@@ -154,7 +154,6 @@ class diff_files extends task_base
}
$diff = new \diff3($file_contents[0], $file_contents[1], $file_contents[2]);
- unset($file_contents);
// Handle conflicts
if ($diff->get_num_conflicts() !== 0)
@@ -162,12 +161,20 @@ class diff_files extends task_base
$merge_conflicts[] = $filename;
}
- // Save merged output
- $this->cache->put(
- '_file_' . md5($filename),
- base64_encode(implode("\n", $diff->merged_output()))
- );
+ if ($diff->merged_output() !== $file_contents[1])
+ {
+ // Save merged output
+ $this->cache->put(
+ '_file_' . md5($filename),
+ base64_encode(implode("\n", $diff->merged_output()))
+ );
+ }
+ else
+ {
+ unset($update_files['update_with_diff'][$key]);
+ }
+ unset($file_contents);
unset($diff);
}
else
@@ -199,6 +206,16 @@ class diff_files extends task_base
$this->installer_config->set('merge_conflict_list', $merge_conflicts);
$this->installer_config->set('file_diff_update_count', $progress_count);
+ foreach ($update_files as $type => $files)
+ {
+ if (empty($files))
+ {
+ unset($update_files[$type]);
+ }
+ }
+
+ $this->installer_config->set('update_files', $update_files);
+
// Request refresh
throw new resource_limit_reached_exception();
}
@@ -206,6 +223,16 @@ class diff_files extends task_base
$this->iohandler->finish_progress('ALL_FILES_DIFFED');
$this->installer_config->set('merge_conflict_list', $merge_conflicts);
+
+ foreach ($update_files as $type => $files)
+ {
+ if (empty($files))
+ {
+ unset($update_files[$type]);
+ }
+ }
+
+ $this->installer_config->set('update_files', $update_files);
}
/**
diff --git a/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php
index 21aa93b7ea..0b83e9a79d 100644
--- a/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php
+++ b/phpBB/phpbb/install/module/update_filesystem/task/download_updated_files.php
@@ -99,13 +99,14 @@ class download_updated_files extends task_base
// Add form to continue update
$this->iohandler->add_user_form_group('UPDATE_CONTINUE_UPDATE_PROCESS', array(
'update_recheck_files_submit' => array(
- 'label' => 'UPDATE_RECHECK_UPDATE_FILES',
- 'type' => 'submit',
+ 'label' => 'UPDATE_RECHECK_UPDATE_FILES',
+ 'type' => 'submit',
+ 'is_secondary' => empty($file_update_info),
),
'database_update_submit' => array(
'label' => 'UPDATE_CONTINUE_UPDATE_PROCESS',
'type' => 'submit',
- 'disabled' => count($file_update_info) > 0,
+ 'disabled' => !empty($file_update_info),
),
));