mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-22 00:21:02 +01:00
Merge pull request #4949 from marc1706/ticket/15353
[ticket/15353] Make sure users can continue update after merging file diff
This commit is contained in:
commit
1a1a2dc046
@ -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 -->
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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),
|
||||
),
|
||||
));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user