Przeglądaj źródła

sensio/distribution-bundle ^5.0.21, para que no tire el warning del CommandEvent

gabriel 7 lat temu
rodzic
commit
2d2adb793a
5 zmienionych plików z 363 dodań i 90 usunięć
  1. 13 10
      bin/symfony_requirements
  2. 1 1
      composer.json
  3. 35 35
      composer.lock
  4. 82 29
      var/SymfonyRequirements.php
  5. 232 15
      web/config.php

+ 13 - 10
bin/symfony_requirements

@@ -1,19 +1,19 @@
 #!/usr/bin/env php
 <?php
 
-require_once dirname(__FILE__).'/./SymfonyRequirements.php';
+require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';
 
 $lineSize = 70;
 $symfonyRequirements = new SymfonyRequirements();
 $iniPath = $symfonyRequirements->getPhpIniConfigPath();
 
-echo_title('Symfony2 Requirements Checker');
+echo_title('Symfony Requirements Checker');
 
 echo '> PHP is using the following php.ini file:'.PHP_EOL;
 if ($iniPath) {
     echo_style('green', '  '.$iniPath);
 } else {
-    echo_style('warning', '  WARNING: No configuration file (php.ini) used by PHP!');
+    echo_style('yellow', '  WARNING: No configuration file (php.ini) used by PHP!');
 }
 
 echo PHP_EOL.PHP_EOL;
@@ -22,7 +22,6 @@ echo '> Checking Symfony requirements:'.PHP_EOL.'  ';
 
 $messages = array();
 foreach ($symfonyRequirements->getRequirements() as $req) {
-    /** @var $req Requirement */
     if ($helpText = get_error_message($req, $lineSize)) {
         echo_style('red', 'E');
         $messages['error'][] = $helpText;
@@ -43,9 +42,9 @@ foreach ($symfonyRequirements->getRecommendations() as $req) {
 }
 
 if ($checkPassed) {
-    echo_block('success', 'OK', 'Your system is ready to run Symfony2 projects');
+    echo_block('success', 'OK', 'Your system is ready to run Symfony projects');
 } else {
-    echo_block('error', 'ERROR', 'Your system is not ready to run Symfony2 projects');
+    echo_block('error', 'ERROR', 'Your system is not ready to run Symfony projects');
 
     echo_title('Fix the following mandatory requirements', 'red');
 
@@ -121,10 +120,14 @@ function echo_block($style, $title, $message)
 
     echo PHP_EOL.PHP_EOL;
 
-    echo_style($style, str_repeat(' ', $width).PHP_EOL);
-    echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL);
-    echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL);
-    echo_style($style, str_repeat(' ', $width).PHP_EOL);
+    echo_style($style, str_repeat(' ', $width));
+    echo PHP_EOL;
+    echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT));
+    echo PHP_EOL;
+    echo_style($style, $message);
+    echo PHP_EOL;
+    echo_style($style, str_repeat(' ', $width));
+    echo PHP_EOL;
 }
 
 function has_color_support()

+ 1 - 1
composer.json

@@ -145,7 +145,7 @@
         "incenteev/composer-parameter-handler": "^2.0",
         "jms/serializer-bundle": "^1.1",
         "php-amqplib/rabbitmq-bundle": "^1.12",
-        "sensio/distribution-bundle": "^5.0",
+        "sensio/distribution-bundle": "^5.0.21",
         "sensio/framework-extra-bundle": "^3.0.2",
         "sonata-project/admin-bundle": "dev-bf4681",
         "sonata-project/doctrine-orm-admin-bundle": "^3.1",

+ 35 - 35
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "content-hash": "861b800b14490bc5fcc9d1b9a88c8c4e",
+    "content-hash": "d63717f3473c434e1b5befd1373bd431",
     "packages": [
         {
             "name": "behat/transliterator",
@@ -1224,9 +1224,9 @@
             },
             "dist": {
                 "type": "zip",
-                "url": "https://satis.infra.flowdat.com/dist/hwi/oauth-bundle/hwi-oauth-bundle-50f4bcbe5c217cfdf0f7f40a174b87199b76d1e1-zip-0aca95.zip",
+                "url": "https://api.github.com/repos/hwi/HWIOAuthBundle/zipball/50f4bcbe5c217cfdf0f7f40a174b87199b76d1e1",
                 "reference": "50f4bcbe5c217cfdf0f7f40a174b87199b76d1e1",
-                "shasum": "b6918d1815cc36aff59cf0d12764bb0324ff1549"
+                "shasum": ""
             },
             "require": {
                 "kriswallsmith/buzz": "~0.13",
@@ -1386,7 +1386,7 @@
                 "audit",
                 "bundle"
             ],
-            "time": "2017-06-27T13:16:34+00:00"
+            "time": "2017-06-27 13:16:34"
         },
         {
             "name": "ik/auth-bundle",
@@ -1409,7 +1409,7 @@
                 "auth",
                 "bundle"
             ],
-            "time": "2017-09-22T13:27:29+00:00"
+            "time": "2017-09-22 13:27:29"
         },
         {
             "name": "ik/base-admin-bundle",
@@ -1432,7 +1432,7 @@
                 "bootstrap",
                 "sonata"
             ],
-            "time": "2017-09-19T12:44:49+00:00"
+            "time": "2017-09-19 12:44:49"
         },
         {
             "name": "ik/device-bundle",
@@ -1455,7 +1455,7 @@
                 "bundle",
                 "validators"
             ],
-            "time": "2017-10-02T15:25:40+00:00"
+            "time": "2017-10-02 15:25:40"
         },
         {
             "name": "ik/extra-data-bundle",
@@ -1478,7 +1478,7 @@
                 "bundle",
                 "extra-data"
             ],
-            "time": "2017-09-26T14:16:42+00:00"
+            "time": "2017-09-26 14:16:42"
         },
         {
             "name": "ik/leaflet-bundle",
@@ -1499,7 +1499,7 @@
                 }
             },
             "description": "The Flowdat3 Leaflet Resource",
-            "time": "2017-09-01T15:52:53+00:00"
+            "time": "2017-09-01 15:52:53"
         },
         {
             "name": "ik/map-bundle",
@@ -1522,7 +1522,7 @@
                 "bootstrap",
                 "sonata"
             ],
-            "time": "2017-10-03T14:04:38+00:00"
+            "time": "2017-10-03 14:04:38"
         },
         {
             "name": "ik/migrations-bundle",
@@ -1545,7 +1545,7 @@
                 "bundle",
                 "migrations"
             ],
-            "time": "2017-08-31T11:49:28+00:00"
+            "time": "2017-08-31 11:49:28"
         },
         {
             "name": "ik/oauthclient-bundle",
@@ -1572,7 +1572,7 @@
                 "bundle",
                 "oauth"
             ],
-            "time": "2017-08-24T15:50:04+00:00"
+            "time": "2017-08-24 15:50:04"
         },
         {
             "name": "ik/owner-voter-bundle",
@@ -1595,7 +1595,7 @@
                 "bundle",
                 "owner-voter"
             ],
-            "time": "2017-06-12T15:49:24+00:00"
+            "time": "2017-06-12 15:49:24"
         },
         {
             "name": "ik/template-bundle",
@@ -1621,7 +1621,7 @@
                 "bundle",
                 "template"
             ],
-            "time": "2017-08-02T18:42:10+00:00"
+            "time": "2017-08-02 18:42:10"
         },
         {
             "name": "ik/webservice-bundle",
@@ -1642,7 +1642,7 @@
                 }
             },
             "description": "The Flowdat3 Webservice Rest",
-            "time": "2017-10-03T14:25:04+00:00"
+            "time": "2017-10-03 14:25:04"
         },
         {
             "name": "ik/workflow-bundle",
@@ -1680,7 +1680,7 @@
                 "bundle",
                 "workflow"
             ],
-            "time": "2017-09-29T19:00:56+00:00"
+            "time": "2017-09-29 19:00:56"
         },
         {
             "name": "incenteev/composer-parameter-handler",
@@ -1692,9 +1692,9 @@
             },
             "dist": {
                 "type": "zip",
-                "url": "https://satis.infra.flowdat.com/dist/incenteev/composer-parameter-handler/incenteev-composer-parameter-handler-d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc-zip-06d0a7.zip",
+                "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc",
                 "reference": "d7ce7f06136109e81d1cb9d57066c4d4a99cf1cc",
-                "shasum": "78accafc69077c94e2b5c40dcac6a23149e62a2d"
+                "shasum": ""
             },
             "require": {
                 "php": ">=5.3.3",
@@ -1834,9 +1834,9 @@
             },
             "dist": {
                 "type": "zip",
-                "url": "https://satis.infra.flowdat.com/dist/jms/parser-lib/jms-parser-lib-c509473bc1b4866415627af0e1c6cc8ac97fa51d-zip-d6e55f.zip",
+                "url": "https://api.github.com/repos/schmittjoh/parser-lib/zipball/c509473bc1b4866415627af0e1c6cc8ac97fa51d",
                 "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d",
-                "shasum": "2ea232ddbcd3fb65004c7454244af057fb422817"
+                "shasum": ""
             },
             "require": {
                 "phpoption/phpoption": ">=0.9,<2.0-dev"
@@ -2796,21 +2796,21 @@
         },
         {
             "name": "sensio/distribution-bundle",
-            "version": "v5.0.0",
+            "version": "v5.0.21",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sensiolabs/SensioDistributionBundle.git",
-                "reference": "a84f4c0fa9ce9791e408a6a013b71e69a6e89282"
+                "reference": "eb6266b3b472e4002538610b28a0a04bcf94891a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://satis.infra.flowdat.com/dist/sensio/distribution-bundle/sensio-distribution-bundle-a84f4c0fa9ce9791e408a6a013b71e69a6e89282-zip-7d1302.zip",
-                "reference": "a84f4c0fa9ce9791e408a6a013b71e69a6e89282",
-                "shasum": "1009054efa2b9ab37a5c6944fdace40c30a84613"
+                "url": "https://satis.infra.flowdat.com/dist/sensio/distribution-bundle/sensio-distribution-bundle-eb6266b3b472e4002538610b28a0a04bcf94891a-zip-b89371.zip",
+                "reference": "eb6266b3b472e4002538610b28a0a04bcf94891a",
+                "shasum": "c880207d73e5af5719bf65852f2890e55cb488d6"
             },
             "require": {
                 "php": ">=5.3.9",
-                "sensiolabs/security-checker": "~3.0",
+                "sensiolabs/security-checker": "~3.0|~4.0",
                 "symfony/class-loader": "~2.3|~3.0",
                 "symfony/config": "~2.3|~3.0",
                 "symfony/dependency-injection": "~2.3|~3.0",
@@ -2844,7 +2844,7 @@
                 "configuration",
                 "distribution"
             ],
-            "time": "2015-11-24T20:13:56+00:00"
+            "time": "2017-08-25T16:55:44+00:00"
         },
         {
             "name": "sensio/framework-extra-bundle",
@@ -3144,7 +3144,7 @@
                 "bootstrap",
                 "sonata"
             ],
-            "time": "2017-10-04T12:16:04+00:00"
+            "time": "2017-10-04 12:16:04"
         },
         {
             "name": "sonata-project/block-bundle",
@@ -3571,9 +3571,9 @@
             },
             "dist": {
                 "type": "zip",
-                "url": "https://satis.infra.flowdat.com/dist/stof/doctrine-extensions-bundle/stof-doctrine-extensions-bundle-4e7499d25dc5d0862da09fa8e336164948a29a25-zip-803a48.zip",
+                "url": "https://api.github.com/repos/stof/StofDoctrineExtensionsBundle/zipball/4e7499d25dc5d0862da09fa8e336164948a29a25",
                 "reference": "4e7499d25dc5d0862da09fa8e336164948a29a25",
-                "shasum": "5f6b05de8625fea312c1ae92066580864eea07d5"
+                "shasum": ""
             },
             "require": {
                 "gedmo/doctrine-extensions": "^2.3.1",
@@ -4077,9 +4077,9 @@
             },
             "dist": {
                 "type": "zip",
-                "url": "https://satis.infra.flowdat.com/dist/symfony/security-acl/symfony-security-acl-053b49bf4aa333a392c83296855989bcf88ddad1-zip-4a92bd.zip",
+                "url": "https://api.github.com/repos/symfony/security-acl/zipball/053b49bf4aa333a392c83296855989bcf88ddad1",
                 "reference": "053b49bf4aa333a392c83296855989bcf88ddad1",
-                "shasum": "9562593da89cd1ab1a2d69962cc0d933cea99714"
+                "shasum": ""
             },
             "require": {
                 "php": ">=5.5.9",
@@ -4457,9 +4457,9 @@
             },
             "dist": {
                 "type": "zip",
-                "url": "https://satis.infra.flowdat.com/dist/voryx/restgeneratorbundle/voryx-restgeneratorbundle-72b61d2188662da453d2e2a9cd625a60b6f3233b-zip-888957.zip",
+                "url": "https://api.github.com/repos/voryx/restgeneratorbundle/zipball/72b61d2188662da453d2e2a9cd625a60b6f3233b",
                 "reference": "72b61d2188662da453d2e2a9cd625a60b6f3233b",
-                "shasum": "5ca3bc614a05b341c7857876407dc54e73dcde0c"
+                "shasum": ""
             },
             "require": {
                 "friendsofsymfony/rest-bundle": "~1.7",
@@ -4492,7 +4492,7 @@
                 }
             ],
             "description": "REST API Generator for Symfony 2",
-            "time": "2016-04-18T12:29:38+00:00"
+            "time": "2016-04-18 12:29:38"
         },
         {
             "name": "willdurand/jsonp-callback-validator",

+ 82 - 29
var/SymfonyRequirements.php

@@ -168,6 +168,9 @@ class PhpIniRequirement extends Requirement
  */
 class RequirementCollection implements IteratorAggregate
 {
+    /**
+     * @var Requirement[]
+     */
     private $requirements = array();
 
     /**
@@ -265,7 +268,7 @@ class RequirementCollection implements IteratorAggregate
     /**
      * Returns both requirements and recommendations.
      *
-     * @return array Array of Requirement instances
+     * @return Requirement[]
      */
     public function all()
     {
@@ -275,7 +278,7 @@ class RequirementCollection implements IteratorAggregate
     /**
      * Returns all mandatory requirements.
      *
-     * @return array Array of Requirement instances
+     * @return Requirement[]
      */
     public function getRequirements()
     {
@@ -292,7 +295,7 @@ class RequirementCollection implements IteratorAggregate
     /**
      * Returns the mandatory requirements that were not met.
      *
-     * @return array Array of Requirement instances
+     * @return Requirement[]
      */
     public function getFailedRequirements()
     {
@@ -309,7 +312,7 @@ class RequirementCollection implements IteratorAggregate
     /**
      * Returns all optional recommendations.
      *
-     * @return array Array of Requirement instances
+     * @return Requirement[]
      */
     public function getRecommendations()
     {
@@ -326,7 +329,7 @@ class RequirementCollection implements IteratorAggregate
     /**
      * Returns the recommendations that were not met.
      *
-     * @return array Array of Requirement instances
+     * @return Requirement[]
      */
     public function getFailedRecommendations()
     {
@@ -376,7 +379,8 @@ class RequirementCollection implements IteratorAggregate
  */
 class SymfonyRequirements extends RequirementCollection
 {
-    const REQUIRED_PHP_VERSION = '5.3.3';
+    const LEGACY_REQUIRED_PHP_VERSION = '5.3.3';
+    const REQUIRED_PHP_VERSION = '5.5.9';
 
     /**
      * Constructor that initializes the requirements.
@@ -386,16 +390,26 @@ class SymfonyRequirements extends RequirementCollection
         /* mandatory requirements follow */
 
         $installedPhpVersion = phpversion();
+        $requiredPhpVersion = $this->getPhpRequiredVersion();
 
-        $this->addRequirement(
-            version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='),
-            sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion),
-            sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
-                Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
-                $installedPhpVersion, self::REQUIRED_PHP_VERSION),
-            sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion)
+        $this->addRecommendation(
+            $requiredPhpVersion,
+            'Vendors should be installed in order to check all requirements.',
+            'Run the <code>composer install</code> command.',
+            'Run the "composer install" command.'
         );
 
+        if (false !== $requiredPhpVersion) {
+            $this->addRequirement(
+                version_compare($installedPhpVersion, $requiredPhpVersion, '>='),
+                sprintf('PHP version must be at least %s (%s installed)', $requiredPhpVersion, $installedPhpVersion),
+                sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
+                Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
+                    $installedPhpVersion, $requiredPhpVersion),
+                sprintf('Install PHP %s or newer (installed version is %s)', $requiredPhpVersion, $installedPhpVersion)
+            );
+        }
+
         $this->addRequirement(
             version_compare($installedPhpVersion, '5.3.16', '!='),
             'PHP version must not be 5.3.16 as Symfony won\'t work properly with it',
@@ -425,13 +439,15 @@ class SymfonyRequirements extends RequirementCollection
             'Change the permissions of either "<strong>app/logs/</strong>" or  "<strong>var/logs/</strong>" directory so that the web server can write into it.'
         );
 
-        $this->addPhpIniRequirement(
-            'date.timezone', true, false,
-            'date.timezone setting must be set',
-            'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
-        );
+        if (version_compare($installedPhpVersion, '7.0.0', '<')) {
+            $this->addPhpIniRequirement(
+                'date.timezone', true, false,
+                'date.timezone setting must be set',
+                'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
+            );
+        }
 
-        if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
+        if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
             $timezones = array();
             foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
                 foreach ($abbreviations as $abbreviation) {
@@ -617,12 +633,6 @@ class SymfonyRequirements extends RequirementCollection
             'Install and enable the <strong>mbstring</strong> extension.'
         );
 
-        $this->addRecommendation(
-            function_exists('iconv'),
-            'iconv() should be available',
-            'Install and enable the <strong>iconv</strong> extension.'
-        );
-
         $this->addRecommendation(
             function_exists('utf8_decode'),
             'utf8_decode() should be available',
@@ -677,6 +687,21 @@ class SymfonyRequirements extends RequirementCollection
                 'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).'
             );
 
+            if (class_exists('Symfony\Component\Intl\Intl')) {
+                $this->addRecommendation(
+                    \Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion(),
+                    sprintf('intl ICU version installed on your system is outdated (%s) and does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()),
+                    'To get the latest internationalization data upgrade the ICU system package and the intl PHP extension.'
+                );
+                if (\Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion()) {
+                    $this->addRecommendation(
+                        \Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(),
+                        sprintf('intl ICU version installed on your system (%s) does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()),
+                        'To avoid internationalization data inconsistencies upgrade the symfony/intl component.'
+                    );
+                }
+            }
+
             $this->addPhpIniRecommendation(
                 'intl.error_level',
                 create_function('$cfgValue', 'return (int) $cfgValue === 0;'),
@@ -708,9 +733,9 @@ class SymfonyRequirements extends RequirementCollection
 
         if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
             $this->addRecommendation(
-                $this->getRealpathCacheSize() > 1000,
-                'realpath_cache_size should be above 1024 in php.ini',
-                'Set "<strong>realpath_cache_size</strong>" to e.g. "<strong>1024</strong>" in php.ini<a href="#phpini">*</a> to improve performance on windows.'
+                $this->getRealpathCacheSize() >= 5 * 1024 * 1024,
+                'realpath_cache_size should be at least 5M in php.ini',
+                'Setting "<strong>realpath_cache_size</strong>" to e.g. "<strong>5242880</strong>" or "<strong>5M</strong>" in php.ini<a href="#phpini">*</a> may improve performance on Windows significantly in some cases.'
             );
         }
 
@@ -749,7 +774,11 @@ class SymfonyRequirements extends RequirementCollection
     {
         $size = ini_get('realpath_cache_size');
         $size = trim($size);
-        $unit = strtolower(substr($size, -1, 1));
+        $unit = '';
+        if (!ctype_digit($size)) {
+            $unit = strtolower(substr($size, -1, 1));
+            $size = (int) substr($size, 0, -1);
+        }
         switch ($unit) {
             case 'g':
                 return $size * 1024 * 1024 * 1024;
@@ -761,4 +790,28 @@ class SymfonyRequirements extends RequirementCollection
                 return (int) $size;
         }
     }
+
+    /**
+     * Defines PHP required version from Symfony version.
+     *
+     * @return string|false The PHP required version or false if it could not be guessed
+     */
+    protected function getPhpRequiredVersion()
+    {
+        if (!file_exists($path = __DIR__.'/../composer.lock')) {
+            return false;
+        }
+
+        $composerLock = json_decode(file_get_contents($path), true);
+        foreach ($composerLock['packages'] as $package) {
+            $name = $package['name'];
+            if ('symfony/symfony' !== $name && 'symfony/http-kernel' !== $name) {
+                continue;
+            }
+
+            return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION;
+        }
+
+        return false;
+    }
 }

Plik diff jest za duży
+ 232 - 15
web/config.php