mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Merge pull request #4161 from CHItA/ticket/14312
[ticket/14312] Enable running database update only * CHItA/ticket/14312: [ticket/14312] Allow updating without having the update directory [ticket/14312] Push migration error messages to the user
This commit is contained in:
commit
f258aebc59
4 changed files with 40 additions and 15 deletions
|
@ -15,6 +15,7 @@ services:
|
||||||
arguments:
|
arguments:
|
||||||
- '@installer.helper.container_factory'
|
- '@installer.helper.container_factory'
|
||||||
- '@filesystem'
|
- '@filesystem'
|
||||||
|
- '@installer.helper.config'
|
||||||
- '@installer.helper.iohandler'
|
- '@installer.helper.iohandler'
|
||||||
- '@installer.helper.update_helper'
|
- '@installer.helper.update_helper'
|
||||||
- '%core.root_path%'
|
- '%core.root_path%'
|
||||||
|
|
|
@ -57,22 +57,35 @@ class obtain_update_settings extends task_base
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if ($this->installer_config->get('disable_filesystem_update', false))
|
||||||
|
{
|
||||||
|
$options[] = array(
|
||||||
|
'value' => 'db_only',
|
||||||
|
'label' => 'UPDATE_TYPE_DB_ONLY',
|
||||||
|
'selected' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$options = array(
|
||||||
|
array(
|
||||||
|
'value' => 'all',
|
||||||
|
'label' => 'UPDATE_TYPE_ALL',
|
||||||
|
'selected' => true,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'value' => 'db_only',
|
||||||
|
'label' => 'UPDATE_TYPE_DB_ONLY',
|
||||||
|
'selected' => false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$this->iohandler->add_user_form_group('UPDATE_TYPE', array(
|
$this->iohandler->add_user_form_group('UPDATE_TYPE', array(
|
||||||
'update_type' => array(
|
'update_type' => array(
|
||||||
'label' => 'UPDATE_TYPE',
|
'label' => 'UPDATE_TYPE',
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
'options' => array(
|
'options' => $options,
|
||||||
array(
|
|
||||||
'value' => 'all',
|
|
||||||
'label' => 'UPDATE_TYPE_ALL',
|
|
||||||
'selected' => true,
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'value' => 'db_only',
|
|
||||||
'label' => 'UPDATE_TYPE_DB_ONLY',
|
|
||||||
'selected' => false,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
'submit_update' => array(
|
'submit_update' => array(
|
||||||
'label' => 'SUBMIT',
|
'label' => 'SUBMIT',
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
namespace phpbb\install\module\requirements\task;
|
namespace phpbb\install\module\requirements\task;
|
||||||
|
|
||||||
use phpbb\filesystem\filesystem;
|
use phpbb\filesystem\filesystem;
|
||||||
|
use phpbb\install\helper\config;
|
||||||
use phpbb\install\helper\container_factory;
|
use phpbb\install\helper\container_factory;
|
||||||
use phpbb\install\helper\iohandler\iohandler_interface;
|
use phpbb\install\helper\iohandler\iohandler_interface;
|
||||||
use phpbb\install\helper\update_helper;
|
use phpbb\install\helper\update_helper;
|
||||||
|
@ -34,6 +35,11 @@ class check_update extends task_base
|
||||||
*/
|
*/
|
||||||
protected $filesystem;
|
protected $filesystem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var config
|
||||||
|
*/
|
||||||
|
protected $installer_config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var iohandler_interface
|
* @var iohandler_interface
|
||||||
*/
|
*/
|
||||||
|
@ -69,14 +75,16 @@ class check_update extends task_base
|
||||||
*
|
*
|
||||||
* @param container_factory $container
|
* @param container_factory $container
|
||||||
* @param filesystem $filesystem
|
* @param filesystem $filesystem
|
||||||
|
* @param config $config
|
||||||
* @param iohandler_interface $iohandler
|
* @param iohandler_interface $iohandler
|
||||||
* @param update_helper $update_helper
|
* @param update_helper $update_helper
|
||||||
* @param string $phpbb_root_path
|
* @param string $phpbb_root_path
|
||||||
* @param string $php_ext
|
* @param string $php_ext
|
||||||
*/
|
*/
|
||||||
public function __construct(container_factory $container, filesystem $filesystem, iohandler_interface $iohandler, update_helper $update_helper, $phpbb_root_path, $php_ext)
|
public function __construct(container_factory $container, filesystem $filesystem, config $config, iohandler_interface $iohandler, update_helper $update_helper, $phpbb_root_path, $php_ext)
|
||||||
{
|
{
|
||||||
$this->filesystem = $filesystem;
|
$this->filesystem = $filesystem;
|
||||||
|
$this->installer_config = $config;
|
||||||
$this->iohandler = $iohandler;
|
$this->iohandler = $iohandler;
|
||||||
$this->update_helper = $update_helper;
|
$this->update_helper = $update_helper;
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
@ -117,8 +125,10 @@ class check_update extends task_base
|
||||||
$this->iohandler->add_error_message('UPDATE_FILES_NOT_FOUND');
|
$this->iohandler->add_error_message('UPDATE_FILES_NOT_FOUND');
|
||||||
$this->set_test_passed(false);
|
$this->set_test_passed(false);
|
||||||
|
|
||||||
// If there are no update files, we can't check the version
|
// If there are no update files, we can't check the version etc
|
||||||
return false;
|
// However, we can let the users run migrations if they really want to...
|
||||||
|
$this->installer_config->set('disable_filesystem_update', true);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recover version numbers
|
// Recover version numbers
|
||||||
|
|
|
@ -158,6 +158,7 @@ class update extends task_base
|
||||||
array_unshift($msg, $e->getMessage());
|
array_unshift($msg, $e->getMessage());
|
||||||
|
|
||||||
$this->iohandler->add_error_message($msg);
|
$this->iohandler->add_error_message($msg);
|
||||||
|
$this->iohandler->send_response();
|
||||||
throw new user_interaction_required_exception();
|
throw new user_interaction_required_exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue