Remove "mibew_root" variable from configs

This commit is contained in:
Dmitriy Simushev 2014-07-10 14:18:11 +00:00
parent 5688f81904
commit b5e502c647
4 changed files with 6 additions and 51 deletions

View File

@ -2,9 +2,6 @@
# your own settings! # your own settings!
# Application path on server
mibew_root: /mibew
# MySQL Database parameters # MySQL Database parameters
database: database:
host: "" host: ""

View File

@ -89,7 +89,7 @@ class InstallController extends AbstractController
} }
$installer = $this->getInstaller(); $installer = $this->getInstaller();
if (!$installer->checkRequirements($request->getBasePath())) { if (!$installer->checkRequirements()) {
return $this->renderError( return $this->renderError(
'install_err', 'install_err',
array('error' => $installer->getErrors()) array('error' => $installer->getErrors())

View File

@ -109,12 +109,9 @@ class Installer
* {@link Installer::getLog()} method. Also the list of all errors can be * {@link Installer::getLog()} method. Also the list of all errors can be
* got using {@link \Mibew\Installer::getErrors()}. * got using {@link \Mibew\Installer::getErrors()}.
* *
* @param string $real_base_path Real base path of the Mibew instance. For
* example if one tries to install Mibew to http://example.com/foo/mibew/
* the argument should be equal to "foo/mibew".
* @return boolean True if all reqirements are satisfied and false otherwise * @return boolean True if all reqirements are satisfied and false otherwise
*/ */
public function checkRequirements($real_base_path) public function checkRequirements()
{ {
if (!$this->checkPhpVersion()) { if (!$this->checkPhpVersion()) {
return false; return false;
@ -125,15 +122,6 @@ class Installer
array(format_version_id($this->getPhpVersionId())) array(format_version_id($this->getPhpVersionId()))
); );
if (!$this->checkMibewRoot($real_base_path)) {
return false;
}
$this->log[] = getlocal(
'Application path is {0}',
array($real_base_path)
);
return true; return true;
} }
@ -444,30 +432,6 @@ class Installer
return true; return true;
} }
/**
* Checks if $mibewroot param in system configs is correct or not.
*
* @param string $real_base_path Real base path of the Mibew instance.
* @return boolean True if the $mibewroot param in config is correct and
* false otherwise.
*/
protected function checkMibewRoot($real_base_path)
{
if ($real_base_path != MIBEW_WEB_ROOT) {
$this->errors[] = getlocal(
"Please, check file {0}<br/>Wrong value of \"mibew_root\" variable, should be \"{1}\"",
array(
$real_base_path . "/configs/config.yml",
$real_base_path
)
);
return false;
}
return true;
}
/** /**
* Checks database connection. * Checks database connection.
* *

View File

@ -34,19 +34,13 @@ require_once(MIBEW_FS_ROOT . '/vendor/autoload.php');
require_once(MIBEW_FS_ROOT . '/libs/common/configurations.php'); require_once(MIBEW_FS_ROOT . '/libs/common/configurations.php');
$configs = load_system_configs(); $configs = load_system_configs();
// Sanitize path to application and remove extra slashes
$mibewroot = join(
"/",
array_map(
"rawurlencode",
preg_split('/\//', preg_replace('/\/+$/', '', preg_replace('/\/{2,}/', '/', '/' . $configs['mibew_root'])))
)
);
/** /**
* Base URL of the Mibew installation * Base URL of the Mibew installation
*/ */
define('MIBEW_WEB_ROOT', $mibewroot); define(
'MIBEW_WEB_ROOT',
\Symfony\Component\HttpFoundation\Request::createFromGlobals()->getBasePath()
);
// Include system constants file // Include system constants file
require_once(MIBEW_FS_ROOT . '/libs/common/constants.php'); require_once(MIBEW_FS_ROOT . '/libs/common/constants.php');