From fc6020b2c8f133052b82dd49337fbb3f2f480ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 23 Feb 2016 16:41:38 +0100 Subject: Enhance requirements in InstallCommand --- src/Wallabag/CoreBundle/Command/InstallCommand.php | 39 +++++++++++----------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 84bd51fa..f1111cce 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -26,6 +26,14 @@ class InstallCommand extends ContainerAwareCommand */ protected $defaultOutput; + /** + * @var array + */ + protected $requirements = [ + 'pcre', + 'DOM', + ]; + protected function configure() { $this @@ -65,27 +73,18 @@ class InstallCommand extends ContainerAwareCommand $fulfilled = true; - $label = 'PCRE'; - if (extension_loaded('pcre')) { - $status = 'OK!'; - $help = ''; - } else { - $fulfilled = false; - $status = 'ERROR!'; - $help = 'You should enabled PCRE extension'; - } - $rows[] = array($label, $status, $help); - - $label = 'DOM'; - if (extension_loaded('DOM')) { - $status = 'OK!'; - $help = ''; - } else { - $fulfilled = false; - $status = 'ERROR!'; - $help = 'You should enabled DOM extension'; + foreach ($this->requirements as $requirement) { + $label = ''.strtoupper($requirement).''; + if (extension_loaded($requirement)) { + $status = 'OK!'; + $help = ''; + } else { + $fulfilled = false; + $status = 'ERROR!'; + $help = 'You should enabled '.$requirement.' extension'; + } + $rows[] = array($label, $status, $help); } - $rows[] = array($label, $status, $help); $table = new Table($this->defaultOutput); $table -- cgit v1.2.3 From db847ca0b75728602f1800fe61829965493fa73c Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 23 Feb 2016 19:06:37 +0100 Subject: add composer extensions check & function_exists checks --- src/Wallabag/CoreBundle/Command/InstallCommand.php | 30 +++++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index f1111cce..114b8726 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -29,9 +29,11 @@ class InstallCommand extends ContainerAwareCommand /** * @var array */ - protected $requirements = [ - 'pcre', - 'DOM', + protected $functionExists = [ + 'tidy_parse_string', + 'curl_exec', + 'curl_multi_init', + 'gettext', ]; protected function configure() @@ -73,16 +75,30 @@ class InstallCommand extends ContainerAwareCommand $fulfilled = true; - foreach ($this->requirements as $requirement) { - $label = ''.strtoupper($requirement).''; - if (extension_loaded($requirement)) { + $label = 'PDO Drivers'; + if (extension_loaded('pdo_sqlite') || extension_loaded('pdo_mysql') || extension_loaded('pdo_pgsql')) { + $status = 'OK!'; + $help = ''; + } else { + $fulfilled = false; + $status = 'ERROR!'; + $help = 'Needs one of sqlite, mysql or pgsql PDO drivers'; + } + + $rows[] = array($label, $status, $help); + + foreach ($this->functionExists as $functionRequired) { + $label = ''.$functionRequired.''; + + if (function_exists($functionRequired)) { $status = 'OK!'; $help = ''; } else { $fulfilled = false; $status = 'ERROR!'; - $help = 'You should enabled '.$requirement.' extension'; + $help = 'You need the '.$requirement.' function activated'; } + $rows[] = array($label, $status, $help); } -- cgit v1.2.3 From 0a7e695975af4dc6fe3c8b22ab9323b725d8da6d Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 23 Feb 2016 23:29:25 +0100 Subject: remove unused functions & clean composer.json --- src/Wallabag/CoreBundle/Command/InstallCommand.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 114b8726..9383628c 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -30,10 +30,8 @@ class InstallCommand extends ContainerAwareCommand * @var array */ protected $functionExists = [ - 'tidy_parse_string', 'curl_exec', 'curl_multi_init', - 'gettext', ]; protected function configure() -- cgit v1.2.3