mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 05:48:51 +00:00
Merge branch '3.2.x'
* 3.2.x: [ticket/15293] Prevent continuing to database update on incomplete file update
This commit is contained in:
commit
ca260d41e5
6 changed files with 59 additions and 15 deletions
|
@ -18,10 +18,11 @@
|
||||||
<!-- BEGIN options -->
|
<!-- BEGIN options -->
|
||||||
<!-- IF options.S_LEGEND -->
|
<!-- IF options.S_LEGEND -->
|
||||||
<!-- IF not options.S_FIRST_ROW -->
|
<!-- IF not options.S_FIRST_ROW -->
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<!-- ENDIF -->
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{options.LEGEND}</legend>
|
<!-- ENDIF -->
|
||||||
|
<legend>{options.LEGEND}</legend>
|
||||||
<!-- ELSE -->
|
<!-- ELSE -->
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
<fieldset class="submit-buttons">
|
<fieldset class="submit-buttons">
|
||||||
<legend>{L_SUBMIT}</legend>
|
<legend>{L_SUBMIT}</legend>
|
||||||
<!-- BEGIN submit_buttons -->
|
<!-- BEGIN submit_buttons -->
|
||||||
<input class="button1" type="submit" name="{submit_buttons.KEY}" value="{submit_buttons.TITLE}" />
|
<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 --> />
|
||||||
<!-- END submit_buttons -->
|
<!-- END submit_buttons -->
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
|
@ -186,6 +186,7 @@ class ajax_iohandler extends iohandler_base
|
||||||
$tpl_ary['TITLE'] = $this->language->lang($input_options['label']);
|
$tpl_ary['TITLE'] = $this->language->lang($input_options['label']);
|
||||||
$tpl_ary['KEY'] = $input_name;
|
$tpl_ary['KEY'] = $input_name;
|
||||||
$tpl_ary['S_EXPLAIN'] = false;
|
$tpl_ary['S_EXPLAIN'] = false;
|
||||||
|
$tpl_ary['DISABLED'] = isset($input_options['disabled']) ? $input_options['disabled'] : false;
|
||||||
|
|
||||||
if (isset($input_options['default']))
|
if (isset($input_options['default']))
|
||||||
{
|
{
|
||||||
|
@ -219,6 +220,11 @@ class ajax_iohandler extends iohandler_base
|
||||||
|
|
||||||
$this->template->assign_var('S_NOT_ONLY_BUTTON_FORM', $not_button_form);
|
$this->template->assign_var('S_NOT_ONLY_BUTTON_FORM', $not_button_form);
|
||||||
|
|
||||||
|
if (!$not_button_form)
|
||||||
|
{
|
||||||
|
$this->template->destroy_block_vars('options');
|
||||||
|
}
|
||||||
|
|
||||||
$this->template->set_filenames(array(
|
$this->template->set_filenames(array(
|
||||||
'form_install' => 'installer_form.html',
|
'form_install' => 'installer_form.html',
|
||||||
));
|
));
|
||||||
|
|
|
@ -78,16 +78,23 @@ class download_updated_files extends task_base
|
||||||
}
|
}
|
||||||
else if ($this->iohandler->get_input('update_recheck_files_submit', false))
|
else if ($this->iohandler->get_input('update_recheck_files_submit', false))
|
||||||
{
|
{
|
||||||
|
$this->installer_config->set('file_updater_elem_progress', '');
|
||||||
|
$this->installer_config->set('update_files', array());
|
||||||
throw new jump_to_restart_point_exception('check_update_files');
|
throw new jump_to_restart_point_exception('check_update_files');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Render download box
|
$file_update_info = $this->installer_config->get('update_files', array());
|
||||||
$this->iohandler->add_download_link(
|
|
||||||
'phpbb_installer_update_file_download',
|
if (count($file_update_info) > 0)
|
||||||
'DOWNLOAD_UPDATE_METHOD',
|
{
|
||||||
'DOWNLOAD_UPDATE_METHOD_EXPLAIN'
|
// Render download box
|
||||||
);
|
$this->iohandler->add_download_link(
|
||||||
|
'phpbb_installer_update_file_download',
|
||||||
|
'DOWNLOAD_UPDATE_METHOD',
|
||||||
|
'DOWNLOAD_UPDATE_METHOD_EXPLAIN'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Add form to continue update
|
// Add form to continue update
|
||||||
$this->iohandler->add_user_form_group('UPDATE_CONTINUE_UPDATE_PROCESS', array(
|
$this->iohandler->add_user_form_group('UPDATE_CONTINUE_UPDATE_PROCESS', array(
|
||||||
|
@ -96,8 +103,9 @@ class download_updated_files extends task_base
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
),
|
),
|
||||||
'database_update_submit' => array(
|
'database_update_submit' => array(
|
||||||
'label' => 'UPDATE_CONTINUE_UPDATE_PROCESS',
|
'label' => 'UPDATE_CONTINUE_UPDATE_PROCESS',
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
|
'disabled' => count($file_update_info) > 0,
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,29 @@ class file_check extends task_base
|
||||||
$file_update_info = array();
|
$file_update_info = array();
|
||||||
$file_update_info['update_without_diff'] = array_diff($update_info['binary'], $update_info['deleted']);
|
$file_update_info['update_without_diff'] = array_diff($update_info['binary'], $update_info['deleted']);
|
||||||
|
|
||||||
|
foreach ($file_update_info['update_without_diff'] as $key => $binary_file)
|
||||||
|
{
|
||||||
|
$new_file = $new_path . $binary_file;
|
||||||
|
$file = $this->phpbb_root_path . $binary_file;
|
||||||
|
|
||||||
|
if (!$this->filesystem->exists($file))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (md5_file($file) === md5_file($new_file))
|
||||||
|
{
|
||||||
|
// File already up to date
|
||||||
|
unset($file_update_info['update_without_diff'][$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove update without diff info if empty
|
||||||
|
if (count($file_update_info['update_without_diff']) < 1)
|
||||||
|
{
|
||||||
|
unset($file_update_info['update_without_diff']);
|
||||||
|
}
|
||||||
|
|
||||||
// Filter out files that are already deleted
|
// Filter out files that are already deleted
|
||||||
$file_update_info['delete'] = array_filter(
|
$file_update_info['delete'] = array_filter(
|
||||||
$update_info['deleted'],
|
$update_info['deleted'],
|
||||||
|
@ -111,6 +134,12 @@ class file_check extends task_base
|
||||||
return file_exists($root_path . $filename);
|
return file_exists($root_path . $filename);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Remove files to delete list if empty
|
||||||
|
if (count($file_update_info['delete']) < 1)
|
||||||
|
{
|
||||||
|
unset($file_update_info['delete']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$progress_count = $this->installer_config->get('file_check_progress_count', 0);
|
$progress_count = $this->installer_config->get('file_check_progress_count', 0);
|
||||||
|
|
|
@ -129,9 +129,9 @@ class show_file_status extends task_base
|
||||||
|
|
||||||
// Add form to continue update
|
// Add form to continue update
|
||||||
$this->iohandler->add_user_form_group('UPDATE_CONTINUE_FILE_UPDATE', array(
|
$this->iohandler->add_user_form_group('UPDATE_CONTINUE_FILE_UPDATE', array(
|
||||||
'submit_continue_file_update' => array(
|
'submit_continue_file_update' => array(
|
||||||
'label' => 'UPDATE_CONTINUE_FILE_UPDATE',
|
'label' => 'UPDATE_CONTINUE_FILE_UPDATE',
|
||||||
'type' => 'submit',
|
'type' => 'submit',
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue