check some permission before starting install process
This commit is contained in:
0
cache/.gitkeep
vendored
Normal file → Executable file
0
cache/.gitkeep
vendored
Normal file → Executable file
0
cache/.htaccess
vendored
Normal file → Executable file
0
cache/.htaccess
vendored
Normal file → Executable file
@@ -53,6 +53,8 @@ class Install extends ContainerAwareCommand
|
||||
''
|
||||
));
|
||||
|
||||
$this->checkPermission($output);
|
||||
|
||||
do {
|
||||
$connectionInfo = $this->getConnectionInfo($input, $output);
|
||||
} while(false === $connection = $this->tryConnection($connectionInfo, $output));
|
||||
@@ -82,6 +84,50 @@ class Install extends ContainerAwareCommand
|
||||
));
|
||||
}
|
||||
|
||||
protected function checkPermission(OutputInterface $output)
|
||||
{
|
||||
$output->writeln(array(
|
||||
"Checking some permissions"
|
||||
));
|
||||
|
||||
$confDir = THELIA_ROOT . "local/config";
|
||||
$cacheDir = THELIA_ROOT . "cache";
|
||||
$logDir = THELIA_ROOT . "log";
|
||||
|
||||
$conf = is_writable($confDir);
|
||||
$cache = is_writable($cacheDir);
|
||||
$log = is_writable($logDir);
|
||||
|
||||
$output->writeln(array(
|
||||
sprintf(
|
||||
"<info>config directory(%s)...</info> %s",
|
||||
$confDir,
|
||||
$conf ? "<info>Ok</info>" : "<error>Fail</error>"
|
||||
),
|
||||
sprintf(
|
||||
"<info>cache directory(%s)...</info> %s"
|
||||
,$cacheDir,
|
||||
$cache ? "<info>Ok</info>" : "<error>Fail</error>"
|
||||
),
|
||||
sprintf(
|
||||
"<info>log directory(%s)...</info> %s",
|
||||
$logDir,
|
||||
$log ? "<info>Ok</info>" : "<error>Fail</error>"
|
||||
),
|
||||
));
|
||||
|
||||
if ($conf === false || $cache === false || $log === false) {
|
||||
$output->writeln(array(
|
||||
"",
|
||||
"<error>Please put correct permission and reload install process</error>"
|
||||
));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function createConfigFile($connectionInfo)
|
||||
{
|
||||
$fs = new Filesystem();
|
||||
|
||||
@@ -118,18 +118,20 @@ class Thelia extends Kernel
|
||||
$loader->load("config.xml");
|
||||
$loader->load("routing.xml");
|
||||
$loader->load("action.xml");
|
||||
if (defined("THELIA_INSTALL_MODE") === false) {
|
||||
$modules = \Thelia\Model\ModuleQuery::getActivated();
|
||||
|
||||
$modules = \Thelia\Model\ModuleQuery::getActivated();
|
||||
foreach ($modules as $module) {
|
||||
|
||||
foreach ($modules as $module) {
|
||||
|
||||
try {
|
||||
$loader = new XmlFileLoader($container, new FileLocator(THELIA_MODULE_DIR . "/" . ucfirst($module->getCode()) . "/Config"));
|
||||
$loader->load("config.xml");
|
||||
} catch(\InvalidArgumentException $e) {
|
||||
try {
|
||||
$loader = new XmlFileLoader($container, new FileLocator(THELIA_MODULE_DIR . "/" . ucfirst($module->getCode()) . "/Config"));
|
||||
$loader->load("config.xml");
|
||||
} catch(\InvalidArgumentException $e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
database:
|
||||
connection:
|
||||
driver: %DRIVER%
|
||||
user: %USERNAME%
|
||||
password: %PASSWORD%
|
||||
dsn: %DSN%
|
||||
0
log/.htaccess
Normal file → Executable file
0
log/.htaccess
Normal file → Executable file
Reference in New Issue
Block a user