diff --git a/core/lib/Thelia/Command/Install.php b/core/lib/Thelia/Command/Install.php index 03b7fda48..6423d861a 100755 --- a/core/lib/Thelia/Command/Install.php +++ b/core/lib/Thelia/Command/Install.php @@ -28,6 +28,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; use Thelia\Command\ContainerAwareCommand; +use Thelia\Install\CheckPermission; use Thelia\Install\Database; /** @@ -82,6 +83,9 @@ class Install extends ContainerAwareCommand '', 'Welcome to Thelia install process', 'You need information about your database configuration (host, username, password, database name, etc)', + '', + 'Caution : You are installing Thelia in cli mode, we verify some information, but this information are only available for the cli php sapi', + 'This informations can be different in your apache or cgi php.ini files', '' )); @@ -136,40 +140,35 @@ class Install extends ContainerAwareCommand "Checking some permissions" )); - $confDir = THELIA_ROOT . "local/config"; - $cacheDir = THELIA_ROOT . "cache"; - $logDir = THELIA_ROOT . "log"; + $permissions = new CheckPermission(false, $this->getContainer()->get('thelia.translator')); + $isValid = $permissions->exec(); - $conf = is_writable($confDir); - $cache = is_writable($cacheDir); - $log = is_writable($logDir); + foreach($permissions->getValidationMessages() as $item => $data) { + if($data['status']) { + $output->writeln(array( + sprintf("%s ... %s", + $data['text'], + "Ok") + ) + ); + } else { + $output->writeln(array( + sprintf("%s %s", + $data['text'], + sprintf("%s", $data["hint"]) + ) + )); + } - $output->writeln(array( - sprintf( - "config directory(%s)... %s", - $confDir, - $conf ? "Ok" : "Fail" - ), - sprintf( - "cache directory(%s)... %s" - ,$cacheDir, - $cache ? "Ok" : "Fail" - ), - sprintf( - "log directory(%s)... %s", - $logDir, - $log ? "Ok" : "Fail" - ), - )); - - if ($conf === false || $cache === false || $log === false) { - $output->writeln(array( - "", - "Please put correct permission and reload install process" - )); - exit; } + if(false === $isValid) { + $output->writeln(array( + "", + "Please put correct permissions and reload install process" + )); + exit; + } } /** diff --git a/core/lib/Thelia/Install/CheckPermission.php b/core/lib/Thelia/Install/CheckPermission.php index 15317211b..8b3d7d70b 100644 --- a/core/lib/Thelia/Install/CheckPermission.php +++ b/core/lib/Thelia/Install/CheckPermission.php @@ -56,7 +56,7 @@ class CheckPermission extends BaseInstall /** @var array Minimum server configuration necessary */ protected $minServerConfigurationNecessary = array( - 'memory_limit' => 134217728, + 'memory_limit' => 157286400, 'post_max_size' => 20971520, 'upload_max_filesize' => 2097152 ); @@ -216,7 +216,7 @@ class CheckPermission extends BaseInstall protected function getI18nDirectoryHint($directory) { if ($this->translator !== null) { - $sentence = 'chmod 777 %directory% on your server with admin rights could help'; + $sentence = 'chmod 777 %directory% on your server with admin rights could help'; $translatedText = $this->translator->trans( $sentence, array( @@ -246,9 +246,9 @@ class CheckPermission extends BaseInstall protected function getI18nConfigText($key, $expectedValue, $currentValue, $isValid) { if ($isValid) { - $sentence = 'Your %key% server configuration (currently %currentValue%) is well enough to run Thelia2 (%expectedValue% needed)'; + $sentence = 'Your %key% server configuration (currently %currentValue%) is well enough to run Thelia2 (%expectedValue% needed)'; } else { - $sentence = 'Your %key% server configuration (currently %currentValue%) is not sufficient enough in order to run Thelia2 (%expectedValue% needed)'; + $sentence = 'Your %key% server configuration (currently %currentValue%) is not sufficient enough in order to run Thelia2 (%expectedValue% needed)'; } $translatedText = $this->translator->trans( @@ -271,7 +271,7 @@ class CheckPermission extends BaseInstall */ protected function getI18nConfigHint() { - $sentence = 'Modifying this value on your server php.ini file with admin rights could help'; + $sentence = 'Modifying this value on your server php.ini file with admin rights could help'; $translatedText = $this->translator->trans( $sentence, array(), @@ -294,9 +294,9 @@ class CheckPermission extends BaseInstall { if ($this->translator !== null) { if ($isValid) { - $sentence = 'Your PHP version %currentValue% is well enough to run Thelia2 (%expectedValue% needed)'; + $sentence = 'Your PHP version %currentValue% is well enough to run Thelia2 (%expectedValue% needed)'; } else { - $sentence = 'Your PHP version %currentValue% is not sufficient enough to run Thelia2 (%expectedValue% needed)'; + $sentence = 'Your PHP version %currentValue% is not sufficient enough to run Thelia2 (%expectedValue% needed)'; } $translatedText = $this->translator->trans( @@ -343,6 +343,10 @@ class CheckPermission extends BaseInstall { $serverValueInBytes = $this->returnBytes(ini_get($key)); + if($serverValueInBytes == -1) { + return true; + } + return ($serverValueInBytes >= $necessaryValueInBytes); }