Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 43 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
obtain_update_settings | |
0.00% |
0 / 43 |
|
0.00% |
0 / 4 |
72 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
run | |
0.00% |
0 / 38 |
|
0.00% |
0 / 1 |
30 | |||
get_step_count | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
get_task_lang_name | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * |
4 | * This file is part of the phpBB Forum Software package. |
5 | * |
6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
7 | * @license GNU General Public License, version 2 (GPL-2.0) |
8 | * |
9 | * For full copyright and license information, please see |
10 | * the docs/CREDITS.txt file. |
11 | * |
12 | */ |
13 | |
14 | namespace phpbb\install\module\obtain_data\task; |
15 | |
16 | use phpbb\install\exception\user_interaction_required_exception; |
17 | use phpbb\install\helper\config; |
18 | use phpbb\install\helper\iohandler\iohandler_interface; |
19 | use phpbb\install\task_base; |
20 | |
21 | class obtain_update_settings extends task_base |
22 | { |
23 | /** |
24 | * @var config |
25 | */ |
26 | protected $installer_config; |
27 | |
28 | /** |
29 | * @var iohandler_interface |
30 | */ |
31 | protected $iohandler; |
32 | |
33 | /** |
34 | * Constructor |
35 | * |
36 | * @param config $installer_config |
37 | * @param iohandler_interface $iohandler |
38 | */ |
39 | public function __construct(config $installer_config, iohandler_interface $iohandler) |
40 | { |
41 | $this->installer_config = $installer_config; |
42 | $this->iohandler = $iohandler; |
43 | |
44 | parent::__construct(true); |
45 | } |
46 | |
47 | /** |
48 | * {@inheritdoc} |
49 | */ |
50 | public function run() |
51 | { |
52 | // Check if data is sent |
53 | if ($this->iohandler->get_input('submit_update', false)) |
54 | { |
55 | $update_files = $this->iohandler->get_input('update_type', 'all') === 'all'; |
56 | |
57 | if ($this->installer_config->get('disable_filesystem_update', false) && $update_files) |
58 | { |
59 | $this->iohandler->add_error_message('UPDATE_FILES_NOT_FOUND'); |
60 | |
61 | throw new user_interaction_required_exception(); |
62 | } |
63 | |
64 | $this->installer_config->set('do_update_files', $update_files); |
65 | } |
66 | else |
67 | { |
68 | if ($this->installer_config->get('disable_filesystem_update', false)) |
69 | { |
70 | $options = array( |
71 | array( |
72 | 'value' => 'db_only', |
73 | 'label' => 'UPDATE_TYPE_DB_ONLY', |
74 | 'selected' => true, |
75 | ), |
76 | ); |
77 | } |
78 | else |
79 | { |
80 | $options = array( |
81 | array( |
82 | 'value' => 'all', |
83 | 'label' => 'UPDATE_TYPE_ALL', |
84 | 'selected' => true, |
85 | ), |
86 | array( |
87 | 'value' => 'db_only', |
88 | 'label' => 'UPDATE_TYPE_DB_ONLY', |
89 | 'selected' => false, |
90 | ), |
91 | ); |
92 | } |
93 | |
94 | $this->iohandler->add_user_form_group('UPDATE_TYPE', array( |
95 | 'update_type' => array( |
96 | 'label' => 'UPDATE_TYPE', |
97 | 'type' => 'radio', |
98 | 'options' => $options, |
99 | ), |
100 | 'submit_update' => array( |
101 | 'label' => 'SUBMIT', |
102 | 'type' => 'submit', |
103 | ), |
104 | )); |
105 | |
106 | throw new user_interaction_required_exception(); |
107 | } |
108 | } |
109 | |
110 | /** |
111 | * {@inheritdoc} |
112 | */ |
113 | public static function get_step_count() |
114 | { |
115 | return 0; |
116 | } |
117 | |
118 | /** |
119 | * {@inheritdoc} |
120 | */ |
121 | public function get_task_lang_name() |
122 | { |
123 | return ''; |
124 | } |
125 | } |