aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2016-02-23 19:06:37 +0100
committerThomas Citharel <tcit@tcit.fr>2016-02-23 19:06:37 +0100
commitdb847ca0b75728602f1800fe61829965493fa73c (patch)
tree1bbc8071fa7c724940e2af84b4ac3dcb1667e5d2
parentfc6020b2c8f133052b82dd49337fbb3f2f480ebf (diff)
downloadwallabag-db847ca0b75728602f1800fe61829965493fa73c.tar.gz
wallabag-db847ca0b75728602f1800fe61829965493fa73c.tar.zst
wallabag-db847ca0b75728602f1800fe61829965493fa73c.zip
add composer extensions check & function_exists checks
-rw-r--r--composer.json18
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php30
2 files changed, 40 insertions, 8 deletions
diff --git a/composer.json b/composer.json
index fe6880aa..0a016049 100644
--- a/composer.json
+++ b/composer.json
@@ -66,7 +66,23 @@
66 "paragonie/random_compat": "~1.0", 66 "paragonie/random_compat": "~1.0",
67 "craue/config-bundle": "~1.4", 67 "craue/config-bundle": "~1.4",
68 "mnapoli/piwik-twig-extension": "^1.0", 68 "mnapoli/piwik-twig-extension": "^1.0",
69 "lexik/maintenance-bundle": "~2.1" 69 "lexik/maintenance-bundle": "~2.1",
70 "ext-pcre": "*",
71 "ext-DOM": "*",
72 "ext-curl": "*",
73 "ext-gd": "*",
74 "ext-session": "*",
75 "ext-Ctype": "*",
76 "ext-hash": "*",
77 "ext-simplexml": "*",
78 "ext-json": "*",
79 "ext-mbstring": "*",
80 "ext-xml": "*",
81 "ext-tidy": "*",
82 "ext-iconv": "*",
83 "ext-gettext": "*",
84 "ext-tokenizer": "*",
85 "ext-PDO": "*"
70 }, 86 },
71 "require-dev": { 87 "require-dev": {
72 "doctrine/doctrine-fixtures-bundle": "~2.2", 88 "doctrine/doctrine-fixtures-bundle": "~2.2",
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
29 /** 29 /**
30 * @var array 30 * @var array
31 */ 31 */
32 protected $requirements = [ 32 protected $functionExists = [
33 'pcre', 33 'tidy_parse_string',
34 'DOM', 34 'curl_exec',
35 'curl_multi_init',
36 'gettext',
35 ]; 37 ];
36 38
37 protected function configure() 39 protected function configure()
@@ -73,16 +75,30 @@ class InstallCommand extends ContainerAwareCommand
73 75
74 $fulfilled = true; 76 $fulfilled = true;
75 77
76 foreach ($this->requirements as $requirement) { 78 $label = '<comment>PDO Drivers</comment>';
77 $label = '<comment>'.strtoupper($requirement).'</comment>'; 79 if (extension_loaded('pdo_sqlite') || extension_loaded('pdo_mysql') || extension_loaded('pdo_pgsql')) {
78 if (extension_loaded($requirement)) { 80 $status = '<info>OK!</info>';
81 $help = '';
82 } else {
83 $fulfilled = false;
84 $status = '<error>ERROR!</error>';
85 $help = 'Needs one of sqlite, mysql or pgsql PDO drivers';
86 }
87
88 $rows[] = array($label, $status, $help);
89
90 foreach ($this->functionExists as $functionRequired) {
91 $label = '<comment>'.$functionRequired.'</comment>';
92
93 if (function_exists($functionRequired)) {
79 $status = '<info>OK!</info>'; 94 $status = '<info>OK!</info>';
80 $help = ''; 95 $help = '';
81 } else { 96 } else {
82 $fulfilled = false; 97 $fulfilled = false;
83 $status = '<error>ERROR!</error>'; 98 $status = '<error>ERROR!</error>';
84 $help = 'You should enabled '.$requirement.' extension'; 99 $help = 'You need the '.$requirement.' function activated';
85 } 100 }
101
86 $rows[] = array($label, $status, $help); 102 $rows[] = array($label, $status, $help);
87 } 103 }
88 104