Explorar el Código

Merged in FD3-241 (pull request #15)

FD3-241

Approved-by: Guillermo Espinoza <guillermo@interlink.com.ar>
Gabriel Gosparo hace 7 años
padre
commit
47ae2a2d55
Se han modificado 7 ficheros con 2847 adiciones y 1877 borrados
  1. 2 1
      .drone.yml
  2. 1 0
      app/AppKernel.php
  3. 13 10
      bin/symfony_requirements
  4. 26 12
      composer.json
  5. 2491 1810
      composer.lock
  6. 82 29
      var/SymfonyRequirements.php
  7. 232 15
      web/config.php

+ 2 - 1
.drone.yml

@@ -28,6 +28,7 @@ pipeline:
       - yes | mysqladmin -h 127.0.0.1 create fd_session
       
       - echo 'client = Flowdat3-Stats-Drone-Test' | tee /etc/flowdat.conf
+      - echo 'date.timezone="America/Argentina/Buenos_Aires"' >> /etc/php/7.0/cli/php.ini
 
       - cp app/config/bundles/ik/base-admin-bundle/parameters.yml.dist app/config/bundles/ik/base-admin-bundle/parameters.yml
       - chmod 0400 keys/bitbucket.id_rsa
@@ -35,7 +36,7 @@ pipeline:
       - composer install --no-interaction --no-progress
       - chmod 0777 -R var/logs var/cache var/sessions
       - php bin/console doctrine:schema:update --force -vvv --env=test
-      - vendor/phpunit/phpunit/phpunit --tap -c phpunit.xml.dist
+      - vendor/phpunit/phpunit/phpunit -c phpunit.xml.dist
 
  docker:
    repo : docker.infra.flowdat.com/fd3/stats

+ 1 - 0
app/AppKernel.php

@@ -58,6 +58,7 @@ class AppKernel extends Kernel
             $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
             $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
             $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
+            $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
         }
 
         return $bundles;

+ 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()

+ 26 - 12
composer.json

@@ -20,6 +20,10 @@
         ]
     },
     "repositories": [
+        {
+            "type": "composer",
+            "url": "https://satis.infra.flowdat.com/"
+        },
         {
             "type": "vcs",
             "url": "ssh://git@infra.flowdat.com:222/VendorSoftwareFlowdat3/BaseAdmin.git",
@@ -122,6 +126,11 @@
                 "local_pk": "./keys/bitbucket.id_rsa"
             }
         },
+        {
+            "type": "vcs",
+            "url": "ssh://git@gogs.infra.flowdat.com:222/3erPartyFlowdat3/SonataAdminBundle.git",
+            "name": "ik-sonata"
+        },
         {
             "type": "vcs",
             "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/WorkflowBundle.git",
@@ -137,6 +146,7 @@
         "doctrine/doctrine-migrations-bundle": "^1.2",
         "doctrine/orm": "^2.5",
         "ik/audit-bundle": "dev-master",
+        "ik/auth-bundle": "dev-master",
         "ik/base-admin-bundle": "dev-master",
         "ik/device-bundle": "dev-master",
         "ik/extra-data-bundle": "dev-master",
@@ -149,30 +159,34 @@
         "ik/stats/geoserver-bundle": "dev-master",
         "ik/stats/huawei-bundle": "dev-master",
         "ik/statsd-bundle": "dev-master",
-        "ik/webservice-bundle": "dev-master",
+        "ik/webservice-bundle": "dev-workflow_update",
         "ik/workflow-bundle": "dev-workflow_update",
         "ik/auth-bundle": "dev-master",
-        "ik/workflow-bundle": "dev-master",
         "incenteev/composer-parameter-handler": "^2.0",
-        "jms/serializer-bundle": "^1.1",
+        "jms/serializer": "^1.9.0",
+        "jms/serializer-bundle": "^1.5.0",
+        "kriswallsmith/assetic": "^1.4",
         "opensolutions/oss-snmp": "dev-master",
         "php-amqplib/rabbitmq-bundle": "^1.12",
-        "phpunit/phpunit": "5.5.*",
-        "sensio/distribution-bundle": "^5.0",
+        "sensio/distribution-bundle": "^5.0.21",
         "sensio/framework-extra-bundle": "^3.0.2",
-        "sonata-project/admin-bundle": "^3.12",
+        "sonata-project/admin-bundle": "dev-bf4681 as 3.23.0",
         "sonata-project/doctrine-orm-admin-bundle": "^3.1",
         "stof/doctrine-extensions-bundle": "^1.2",
-        "symfony/monolog-bundle": "^3.0.2",
+        "symfony/assetic-bundle": "^2.8",
+        "symfony/monolog-bundle": "^3.1.0",
         "symfony/polyfill-apcu": "^1.0",
         "symfony/swiftmailer-bundle": "^2.3.10",
-        "symfony/symfony": "3.2.*",
-        "twig/twig": "^1.0||^2.0",
+        "symfony/symfony": "3.3.*",
+        "symfony/web-server-bundle": "^3.3",
+        "twig/extensions": "^1.5",
+        "twig/twig": "^2.0",
         "voryx/restgeneratorbundle": "dev-master"
     },
     "require-dev": {
+        "phpunit/phpunit": "^6.4",
         "sensio/generator-bundle": "^3.0",
-        "symfony/phpunit-bridge": "^3.0"
+        "symfony/phpunit-bridge": "^3.3"
     },
     "scripts": {
         "symfony-scripts": [
@@ -203,6 +217,7 @@
         ]
     },
     "config": {
+        "optimize-autoloader": true,
         "sort-packages": true
     },
     "extra": {
@@ -228,7 +243,6 @@
             {
                 "file": "app/config/bundles/ik/base-admin-bundle/parameters.yml"
             }
-        ],
-        "branch-alias": null
+        ]
     }
 }

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 2491 - 1810
composer.lock


+ 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;
+    }
 }

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 232 - 15
web/config.php