From 85aa70f8e041bfe3ba2efa13b02afcdabca830f7 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 12 Sep 2014 12:41:40 +0200 Subject: [PATCH] Adding installation requirements. --- app/ChamiloRequirements.php | 62 ++++++++++++++++++++++++++++++++----- composer.json | 9 ++++-- 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/app/ChamiloRequirements.php b/app/ChamiloRequirements.php index 95d6ee85c0..d139915b26 100644 --- a/app/ChamiloRequirements.php +++ b/app/ChamiloRequirements.php @@ -81,6 +81,22 @@ class ChamiloRequirements extends SymfonyRequirements 'Install and enable the icu library at least ' . self::REQUIRED_ICU_VERSION . ' version' ); + $extensions = $this->getExtensions(); + foreach ($extensions as $type) { + $isOptional = $type == 'optional' ? true : false; + foreach ($type as $extension => $url) { + if (extension_loaded($extension)) { + $this->addChamiloRequirement( + extension_loaded($extension), + "$extension extension should be available", + "Install and enable the $extension + extension.", + $isOptional + ); + } + } + } + $this->addRecommendation( class_exists('SoapClient'), 'SOAP extension should be installed (API calls)', @@ -151,17 +167,19 @@ class ChamiloRequirements extends SymfonyRequirements 'Change the permissions of the "web/uploads/" directory so that the web server can write into it.' ); + $this->addChamiloRequirement( + is_writable($baseDir . '/web/bundles'), + 'web/bundles/ directory must be writable', + 'Change the permissions of the "web/bundles/" directory so that the web server can write into it.' + ); + /*$this->addChamiloRequirement( is_writable($baseDir . '/web/media'), 'web/media/ directory must be writable', 'Change the permissions of the "web/media/" directory so that the web server can write into it.' ); - $this->addChamiloRequirement( - is_writable($baseDir . '/web/bundles'), - 'web/bundles/ directory must be writable', - 'Change the permissions of the "web/bundles/" directory so that the web server can write into it.' - );*/ + /*$this->addChamiloRequirement( is_writable($baseDir . '/app/attachment'), @@ -200,7 +218,30 @@ class ChamiloRequirements extends SymfonyRequirements 'Change the permissions of the "app/config/parameters.yml" file so that the web server can write into it.' ); } + } + private function getExtensions() + { + return + array( + 'required' => array( + 'mysql' => array('url' => 'http://php.net/manual/en/book.mysql.php'), + 'curl' => array('url' => 'http://php.net/manual/fr/book.curl.php'), + 'zlib' => array('url' => 'http://php.net/manual/en/book.zlib.php'), + 'pcre' => array('url' => 'http://php.net/manual/en/book.pcre.php'), + 'xml' => array('url' => 'http://php.net/manual/en/book.xml.php'), + 'mbstring' => array('url' => 'http://php.net/manual/en/book.mbstring.php'), + 'iconv' => array('url' => 'http://php.net/manual/en/book.iconv.php'), + 'intl' => array('url' => 'http://php.net/manual/en/book.intl.php'), + 'gd' => array('url' => 'http://php.net/manual/en/book.image.php'), + 'json' => array('url' => 'http://php.net/manual/en/book.json.php') + ), + 'optional' => array( + 'imagick' => array('url' => 'http://php.net/manual/en/book.imagick.php'), + 'ldap' => array('url' => 'http://php.net/manual/en/book.ldap.php'), + 'xapian' => array('url' => 'http://php.net/manual/en/book.xapian.php') + ) + ); } /** @@ -211,9 +252,14 @@ class ChamiloRequirements extends SymfonyRequirements * @param string $helpHtml The help text formatted in HTML for resolving the problem * @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags) */ - public function addChamiloRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null) - { - $this->add(new ChamiloRequirement($fulfilled, $testMessage, $helpHtml, $helpText, false)); + public function addChamiloRequirement( + $fulfilled, + $testMessage, + $helpHtml, + $helpText = null, + $optional = false + ) { + $this->add(new ChamiloRequirement($fulfilled, $testMessage, $helpHtml, $helpText, $optional)); } /** diff --git a/composer.json b/composer.json index 0fdec8fa2c..551b2e06b1 100755 --- a/composer.json +++ b/composer.json @@ -53,7 +53,12 @@ "ext-intl": "*", "ext-gd": "*", + "ext-mysql": "*", "ext-curl": "*", + "ext-zlib": "*", + "ext-xml": "*", + "ext-json": "*", + "ext-mbstring": "*", "twig/twig": "~1.12", "twig/extensions": "~1.0", @@ -82,8 +87,7 @@ "symfony-cmf/routing-bundle": "~1.1", "knplabs/gaufrette": "0.1.4", - "knplabs/knp-paginator-bundle": "dev-master", - "knplabs/knp-menu-bundle": "dev-master as 1.1", + "knplabs/knp-menu-bundle": "~2.0", "sonata-project/easy-extends-bundle": "~2.1@dev", "sonata-project/seo-bundle": "~1@dev", @@ -106,6 +110,7 @@ "sonata-project/timeline-bundle": "~2.2@dev", "sonata-project/classification-bundle": "~2.2@dev", + "sonata-project/ecommerce": "dev-develop", "sonata-project/comment-bundle": "~2.2@dev", "friendsofsymfony/comment-bundle": "~2.0@dev",