diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-02-23 19:06:37 +0100 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2016-02-23 19:06:37 +0100 |
commit | db847ca0b75728602f1800fe61829965493fa73c (patch) | |
tree | 1bbc8071fa7c724940e2af84b4ac3dcb1667e5d2 /src | |
parent | fc6020b2c8f133052b82dd49337fbb3f2f480ebf (diff) | |
download | wallabag-db847ca0b75728602f1800fe61829965493fa73c.tar.gz wallabag-db847ca0b75728602f1800fe61829965493fa73c.tar.zst wallabag-db847ca0b75728602f1800fe61829965493fa73c.zip |
add composer extensions check & function_exists checks
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Command/InstallCommand.php | 30 |
1 files changed, 23 insertions, 7 deletions
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 | ||