diff options
author | Mate Bartus <mate.bartus@gmail.com> | 2015-07-21 14:42:15 +0200 |
---|---|---|
committer | Mate Bartus <mate.bartus@gmail.com> | 2015-07-21 14:42:15 +0200 |
commit | b2b9fb1df2e6d37c8a327b7b6c380f19e1ff6496 (patch) | |
tree | f279a46f8da3f4320ac157d8e909f042cf33edea /phpBB | |
parent | 0488c49116f77de55da3ddf36aa2b08f6a5fd085 (diff) | |
download | forums-b2b9fb1df2e6d37c8a327b7b6c380f19e1ff6496.tar forums-b2b9fb1df2e6d37c8a327b7b6c380f19e1ff6496.tar.gz forums-b2b9fb1df2e6d37c8a327b7b6c380f19e1ff6496.tar.bz2 forums-b2b9fb1df2e6d37c8a327b7b6c380f19e1ff6496.tar.xz forums-b2b9fb1df2e6d37c8a327b7b6c380f19e1ff6496.zip |
[ticket/13740] Fix CS and docblocks
PHPBB3-13740
Diffstat (limited to 'phpBB')
10 files changed, 36 insertions, 62 deletions
diff --git a/phpBB/phpbb/install/console/command/install/install.php b/phpBB/phpbb/install/console/command/install/install.php index e9b4192ded..81ad1039f6 100644 --- a/phpBB/phpbb/install/console/command/install/install.php +++ b/phpBB/phpbb/install/console/command/install/install.php @@ -110,13 +110,15 @@ class install extends \phpbb\console\command\command if ($this->install_helper->is_phpbb_installed()) { $iohandler->add_error_message('PHPBB_ALREADY_INSTALLED'); + + return 1; } if (!is_file($config_file)) { $iohandler->add_error_message(array('MISSING_FILE', array($config_file))); - return; + return 1; } try @@ -127,7 +129,7 @@ class install extends \phpbb\console\command\command { $iohandler->add_error_message('INVALID_YAML_FILE'); - return; + return 1; } $processor = new Processor(); @@ -141,7 +143,7 @@ class install extends \phpbb\console\command\command { $iohandler->add_error_message('INVALID_CONFIGURATION', $e->getMessage()); - return; + return 1; } $this->register_configuration($iohandler, $config); @@ -153,7 +155,7 @@ class install extends \phpbb\console\command\command catch (installer_exception $e) { $iohandler->add_error_message($e->getMessage()); - return; + return 1; } } diff --git a/phpBB/phpbb/install/controller/install.php b/phpBB/phpbb/install/controller/install.php index 5cd42fcb84..b3103c8284 100644 --- a/phpBB/phpbb/install/controller/install.php +++ b/phpBB/phpbb/install/controller/install.php @@ -109,6 +109,11 @@ class install */ public function handle() { + if ($this->install_helper->is_phpbb_installed()) + { + throw new http_exception(404, 'PAGE_NOT_FOUND'); + } + $this->template->assign_vars(array( 'U_ACTION' => $this->controller_helper->route('phpbb_installer_install'), )); @@ -131,11 +136,6 @@ class install /** @var \phpbb\install\helper\iohandler\iohandler_interface $iohandler */ $iohandler = $this->iohandler_factory->get(); - if ($this->install_helper->is_phpbb_installed()) - { - throw new http_exception(404, 'PAGE_NOT_FOUND'); - } - // Set active navigation stage if (isset($nav_data['active']) && is_array($nav_data['active'])) { diff --git a/phpBB/phpbb/install/exception/cannot_build_container_exception.php b/phpBB/phpbb/install/exception/cannot_build_container_exception.php index 11be507bc9..6cf12b008b 100644 --- a/phpBB/phpbb/install/exception/cannot_build_container_exception.php +++ b/phpBB/phpbb/install/exception/cannot_build_container_exception.php @@ -14,7 +14,7 @@ namespace phpbb\install\exception; /** - * This exception should be thrown when + * Thrown when the container cannot be built */ class cannot_build_container_exception extends installer_exception { diff --git a/phpBB/phpbb/install/exception/installer_config_not_writable_exception.php b/phpBB/phpbb/install/exception/installer_config_not_writable_exception.php index 3f3b03f178..51864c5dca 100644 --- a/phpBB/phpbb/install/exception/installer_config_not_writable_exception.php +++ b/phpBB/phpbb/install/exception/installer_config_not_writable_exception.php @@ -14,7 +14,7 @@ namespace phpbb\install\exception; /** - * Exception for the event when installer config is not writable to disk + * Thrown when installer config is not writable to disk */ class installer_config_not_writable_exception extends installer_exception { diff --git a/phpBB/phpbb/install/exception/invalid_dbms_exception.php b/phpBB/phpbb/install/exception/invalid_dbms_exception.php index ccb35bc237..38de5f613a 100644 --- a/phpBB/phpbb/install/exception/invalid_dbms_exception.php +++ b/phpBB/phpbb/install/exception/invalid_dbms_exception.php @@ -14,7 +14,7 @@ namespace phpbb\install\exception; /** - * This exception should be thrown when + * Thrown when an unavailable DBMS has been selected */ class invalid_dbms_exception extends installer_exception { diff --git a/phpBB/phpbb/install/exception/invalid_service_name_exception.php b/phpBB/phpbb/install/exception/invalid_service_name_exception.php deleted file mode 100644 index dff4873f3c..0000000000 --- a/phpBB/phpbb/install/exception/invalid_service_name_exception.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -/** - * - * This file is part of the phpBB Forum Software package. - * - * @copyright (c) phpBB Limited <https://www.phpbb.com> - * @license GNU General Public License, version 2 (GPL-2.0) - * - * For full copyright and license information, please see - * the docs/CREDITS.txt file. - * - */ - -namespace phpbb\install\exception; - -class invalid_service_name_exception extends installer_exception -{ - -} diff --git a/phpBB/phpbb/install/exception/resource_limit_reached_exception.php b/phpBB/phpbb/install/exception/resource_limit_reached_exception.php index 0b841747e6..025e09fbd3 100644 --- a/phpBB/phpbb/install/exception/resource_limit_reached_exception.php +++ b/phpBB/phpbb/install/exception/resource_limit_reached_exception.php @@ -13,6 +13,9 @@ namespace phpbb\install\exception; +/** + * Thrown when the installer is out of memory or time + */ class resource_limit_reached_exception extends installer_exception { diff --git a/phpBB/phpbb/install/helper/container_factory.php b/phpBB/phpbb/install/helper/container_factory.php index 255f8f428e..eb44b470b7 100644 --- a/phpBB/phpbb/install/helper/container_factory.php +++ b/phpBB/phpbb/install/helper/container_factory.php @@ -93,9 +93,26 @@ class container_factory * @param string $param_name * * @return mixed + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built */ public function get_parameter($param_name) { + // Check if container was built, if not try to build it + if ($this->container === null) + { + // Check whether container can be built + // We need config.php for that so let's check if it has been set up yet + if (filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) + { + $this->build_container(); + } + else + { + throw new cannot_build_container_exception(); + } + } + return $this->container->getParameter($param_name); } diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php index 85cb2ca753..ce1112c7a1 100644 --- a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php @@ -96,10 +96,6 @@ class ajax_iohandler extends iohandler_base */ public function add_user_form_group($title, $form) { - // - // This code is pretty ugly... but works - // - $this->template->assign_var('S_FORM_ELEM_COUNT', sizeof($form)); $this->template->assign_block_vars('options', array( @@ -166,8 +162,8 @@ class ajax_iohandler extends iohandler_base $json_data = json_encode($json_data_array); // Try to push content to the browser - print (str_pad(' ', 4096) . "\n"); - print ($json_data . "\n\n"); + print(str_pad(' ', 4096) . "\n"); + print($json_data . "\n\n"); flush(); } diff --git a/phpBB/phpbb/install/installer.php b/phpBB/phpbb/install/installer.php index 695632472a..0e19129247 100644 --- a/phpBB/phpbb/install/installer.php +++ b/phpBB/phpbb/install/installer.php @@ -15,7 +15,6 @@ namespace phpbb\install; use phpbb\di\ordered_service_collection; use phpbb\install\exception\installer_config_not_writable_exception; -use phpbb\install\exception\invalid_service_name_exception; use phpbb\install\exception\resource_limit_reached_exception; use phpbb\install\exception\user_interaction_required_exception; use phpbb\install\helper\config; @@ -94,9 +93,6 @@ class installer // Variable used to check if the install process have been finished $install_finished = false; - // Flag used by exception handling, whether or not we need to flush output buffer once again - $flush_messages = false; - // We are installing something, so the introduction stage can go now... $this->install_config->set_finished_navigation_stage(array('install', 0, 'introduction')); $this->iohandler->set_finished_stage_menu(array('install', 0, 'introduction')); @@ -184,22 +180,6 @@ class installer { // Do nothing } - catch (invalid_service_name_exception $e) - { - $params = $e->get_parameters(); - - if (!empty($params)) - { - array_unshift($params, $e->getMessage()); - } - else - { - $params = $e->getMessage(); - } - - $this->iohandler->add_error_message($params); - $flush_messages = true; - } if ($install_finished) { @@ -211,11 +191,6 @@ class installer $this->iohandler->request_refresh(); } - if ($flush_messages) - { - $this->iohandler->send_response(); - } - // Save install progress try { |