Merge pull request #1716 from wallabag/v2-enhance-requirements-installation

Fix #1603: Enhance requirements in InstallCommand
This commit is contained in:
Jeremy Benoist 2016-02-24 14:47:35 +01:00
commit f83125d2f5
3 changed files with 44 additions and 15 deletions

View file

@ -34,9 +34,11 @@ matrix:
allow_failures: allow_failures:
- php: hhvm - php: hhvm
# exclude v1 branches
branches: branches:
only: except:
- v2 - master
- dev
before_script: before_script:
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi; - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;

View file

@ -29,6 +29,20 @@
}, },
"require": { "require": {
"php": ">=5.5.9", "php": ">=5.5.9",
"ext-pcre": "*",
"ext-dom": "*",
"ext-curl": "*",
"ext-gd": "*",
"ext-session": "*",
"ext-ctype": "*",
"ext-hash": "*",
"ext-simplexml": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"ext-iconv": "*",
"ext-tokenizer": "*",
"ext-pdo": "*",
"symfony/symfony": "3.0.*", "symfony/symfony": "3.0.*",
"doctrine/orm": "^2.5", "doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6", "doctrine/doctrine-bundle": "^1.6",
@ -111,7 +125,7 @@
} }
}, },
"autoload": { "autoload": {
"psr-4": { "": "src/" }, "psr-4": { "Wallabag\\": "src/Wallabag/" },
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ] "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
}, },
"config": { "config": {

View file

@ -26,6 +26,14 @@ class InstallCommand extends ContainerAwareCommand
*/ */
protected $defaultOutput; protected $defaultOutput;
/**
* @var array
*/
protected $functionExists = [
'curl_exec',
'curl_multi_init',
];
protected function configure() protected function configure()
{ {
$this $this
@ -65,27 +73,32 @@ class InstallCommand extends ContainerAwareCommand
$fulfilled = true; $fulfilled = true;
$label = '<comment>PCRE</comment>'; $label = '<comment>PDO Drivers</comment>';
if (extension_loaded('pcre')) { if (extension_loaded('pdo_sqlite') || extension_loaded('pdo_mysql') || extension_loaded('pdo_pgsql')) {
$status = '<info>OK!</info>'; $status = '<info>OK!</info>';
$help = ''; $help = '';
} else { } else {
$fulfilled = false; $fulfilled = false;
$status = '<error>ERROR!</error>'; $status = '<error>ERROR!</error>';
$help = 'You should enabled PCRE extension'; $help = 'Needs one of sqlite, mysql or pgsql PDO drivers';
} }
$rows[] = array($label, $status, $help); $rows[] = array($label, $status, $help);
$label = '<comment>DOM</comment>'; foreach ($this->functionExists as $functionRequired) {
if (extension_loaded('DOM')) { $label = '<comment>'.$functionRequired.'</comment>';
$status = '<info>OK!</info>';
$help = ''; if (function_exists($functionRequired)) {
} else { $status = '<info>OK!</info>';
$fulfilled = false; $help = '';
$status = '<error>ERROR!</error>'; } else {
$help = 'You should enabled DOM extension'; $fulfilled = false;
$status = '<error>ERROR!</error>';
$help = 'You need the '.$requirement.' function activated';
}
$rows[] = array($label, $status, $help);
} }
$rows[] = array($label, $status, $help);
$table = new Table($this->defaultOutput); $table = new Table($this->defaultOutput);
$table $table