[ticket/14039] Fix ACP link generation

PHPBB3-14039
This commit is contained in:
Mate Bartus 2015-10-18 19:27:50 +02:00
parent 56093d1c82
commit ed442198d1
2 changed files with 12 additions and 17 deletions

View file

@ -86,6 +86,7 @@ services:
abstract: true abstract: true
arguments: arguments:
- @installer.helper.config - @installer.helper.config
- @path_helper
installer.install.module_collection: installer.install.module_collection:
class: phpbb\di\ordered_service_collection class: phpbb\di\ordered_service_collection

View file

@ -21,6 +21,7 @@ use phpbb\install\exception\user_interaction_required_exception;
use phpbb\install\helper\config; use phpbb\install\helper\config;
use phpbb\install\helper\iohandler\cli_iohandler; use phpbb\install\helper\iohandler\cli_iohandler;
use phpbb\install\helper\iohandler\iohandler_interface; use phpbb\install\helper\iohandler\iohandler_interface;
use phpbb\path_helper;
class installer class installer
{ {
@ -39,6 +40,11 @@ class installer
*/ */
protected $iohandler; protected $iohandler;
/**
* @var string
*/
protected $web_root;
/** /**
* Stores the number of steps that a given module has * Stores the number of steps that a given module has
* *
@ -49,12 +55,14 @@ class installer
/** /**
* Constructor * Constructor
* *
* @param config $config Installer config handler * @param config $config Installer config handler
* @param path_helper $path_helper Path helper
*/ */
public function __construct(config $config) public function __construct(config $config, path_helper $path_helper)
{ {
$this->install_config = $config; $this->install_config = $config;
$this->installer_modules = null; $this->installer_modules = null;
$this->web_root = $path_helper->get_web_root_path();
} }
/** /**
@ -183,21 +191,7 @@ class installer
else else
{ {
global $SID; global $SID;
$acp_url = $this->web_root . '/adm/index.php' . $SID;
// Construct ACP url
$acp_url = $protocol = $this->install_config->get('server_protocol');
$acp_url .= $this->install_config->get('server_name');
$port = $this->install_config->get('server_port');
if (!((strpos($protocol, 'https:') === 0 && $port === 443)
|| (strpos($protocol, 'http:') === 0 && $port === 80)))
{
$acp_url .= ':' . $port;
}
$acp_url .= $this->install_config->get('script_path');
$acp_url .= '/adm/index.php' . $SID;
$this->iohandler->add_success_message('INSTALLER_FINISHED', array( $this->iohandler->add_success_message('INSTALLER_FINISHED', array(
'ACP_LINK', 'ACP_LINK',
$acp_url, $acp_url,