Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 18 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| abstract_requirements_module | |
0.00% |
0 / 18 |
|
0.00% |
0 / 2 |
72 | |
0.00% |
0 / 1 |
| run | |
0.00% |
0 / 17 |
|
0.00% |
0 / 1 |
56 | |||
| get_step_count | |
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\requirements; |
| 15 | |
| 16 | use phpbb\install\exception\user_interaction_required_exception; |
| 17 | use phpbb\install\module_base; |
| 18 | |
| 19 | /** |
| 20 | * Base class for requirements installer module |
| 21 | */ |
| 22 | abstract class abstract_requirements_module extends module_base |
| 23 | { |
| 24 | public function run() |
| 25 | { |
| 26 | $tests_passed = true; |
| 27 | foreach ($this->task_collection as $name => $task) |
| 28 | { |
| 29 | // Check if we can run the task |
| 30 | if (!$task->is_essential() && !$task->check_requirements()) |
| 31 | { |
| 32 | continue; |
| 33 | } |
| 34 | |
| 35 | if ($this->allow_progress_bar) |
| 36 | { |
| 37 | $this->install_config->increment_current_task_progress(); |
| 38 | } |
| 39 | |
| 40 | $test_result = $task->run(); |
| 41 | $tests_passed = ($tests_passed) ? $test_result : false; |
| 42 | } |
| 43 | |
| 44 | // Module finished, so clear task progress |
| 45 | $this->install_config->set_finished_task(0); |
| 46 | |
| 47 | // Check if tests have failed |
| 48 | if (!$tests_passed) |
| 49 | { |
| 50 | // If requirements are not met, exit form installer |
| 51 | // Set up UI for retesting |
| 52 | $this->iohandler->add_user_form_group('', array( |
| 53 | 'install' => array( |
| 54 | 'label' => 'RETEST_REQUIREMENTS', |
| 55 | 'type' => 'submit', |
| 56 | ), |
| 57 | )); |
| 58 | |
| 59 | // Send the response and quit |
| 60 | throw new user_interaction_required_exception(); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * {@inheritdoc} |
| 66 | */ |
| 67 | public function get_step_count() |
| 68 | { |
| 69 | return 0; |
| 70 | } |
| 71 | } |