diff --git a/.gitignore b/.gitignore index d31a615dd..e204a2bf1 100644 --- a/.gitignore +++ b/.gitignore @@ -9,10 +9,8 @@ !/var/sessions /var/sessions/* !var/sessions/.gitkeep -!var/SymfonyRequirements.php /bin/* !/bin/console -!/bin/symfony_requirements .php_cs.cache .phpunit.result.cache phpunit.xml diff --git a/app/AppKernel.php b/app/AppKernel.php index 347197e4a..aabe7579a 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -48,7 +48,6 @@ class AppKernel extends Kernel if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); - $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(); if ('test' === $this->getEnvironment()) { diff --git a/bin/symfony_requirements b/bin/symfony_requirements deleted file mode 100755 index a7bf65a1b..000000000 --- a/bin/symfony_requirements +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/env php -getPhpIniConfigPath(); - -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('yellow', ' WARNING: No configuration file (php.ini) used by PHP!'); -} - -echo PHP_EOL.PHP_EOL; - -echo '> Checking Symfony requirements:'.PHP_EOL.' '; - -$messages = array(); -foreach ($symfonyRequirements->getRequirements() as $req) { - if ($helpText = get_error_message($req, $lineSize)) { - echo_style('red', 'E'); - $messages['error'][] = $helpText; - } else { - echo_style('green', '.'); - } -} - -$checkPassed = empty($messages['error']); - -foreach ($symfonyRequirements->getRecommendations() as $req) { - if ($helpText = get_error_message($req, $lineSize)) { - echo_style('yellow', 'W'); - $messages['warning'][] = $helpText; - } else { - echo_style('green', '.'); - } -} - -if ($checkPassed) { - echo_block('success', 'OK', 'Your system is ready to run Symfony projects'); -} else { - echo_block('error', 'ERROR', 'Your system is not ready to run Symfony projects'); - - echo_title('Fix the following mandatory requirements', 'red'); - - foreach ($messages['error'] as $helpText) { - echo ' * '.$helpText.PHP_EOL; - } -} - -if (!empty($messages['warning'])) { - echo_title('Optional recommendations to improve your setup', 'yellow'); - - foreach ($messages['warning'] as $helpText) { - echo ' * '.$helpText.PHP_EOL; - } -} - -echo PHP_EOL; -echo_style('title', 'Note'); -echo ' The command console could use a different php.ini file'.PHP_EOL; -echo_style('title', '~~~~'); -echo ' than the one used with your web server. To be on the'.PHP_EOL; -echo ' safe side, please check the requirements from your web'.PHP_EOL; -echo ' server using the '; -echo_style('yellow', 'web/config.php'); -echo ' script.'.PHP_EOL; -echo PHP_EOL; - -exit($checkPassed ? 0 : 1); - -function get_error_message(Requirement $requirement, $lineSize) -{ - if ($requirement->isFulfilled()) { - return; - } - - $errorMessage = wordwrap($requirement->getTestMessage(), $lineSize - 3, PHP_EOL.' ').PHP_EOL; - $errorMessage .= ' > '.wordwrap($requirement->getHelpText(), $lineSize - 5, PHP_EOL.' > ').PHP_EOL; - - return $errorMessage; -} - -function echo_title($title, $style = null) -{ - $style = $style ?: 'title'; - - echo PHP_EOL; - echo_style($style, $title.PHP_EOL); - echo_style($style, str_repeat('~', strlen($title)).PHP_EOL); - echo PHP_EOL; -} - -function echo_style($style, $message) -{ - // ANSI color codes - $styles = array( - 'reset' => "\033[0m", - 'red' => "\033[31m", - 'green' => "\033[32m", - 'yellow' => "\033[33m", - 'error' => "\033[37;41m", - 'success' => "\033[37;42m", - 'title' => "\033[34m", - ); - $supports = has_color_support(); - - echo($supports ? $styles[$style] : '').$message.($supports ? $styles['reset'] : ''); -} - -function echo_block($style, $title, $message) -{ - $message = ' '.trim($message).' '; - $width = strlen($message); - - echo PHP_EOL.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() -{ - static $support; - - if (null === $support) { - if (DIRECTORY_SEPARATOR == '\\') { - $support = false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'); - } else { - $support = function_exists('posix_isatty') && @posix_isatty(STDOUT); - } - } - - return $support; -} diff --git a/composer.json b/composer.json index aceda9e71..0dce4fd55 100644 --- a/composer.json +++ b/composer.json @@ -86,7 +86,6 @@ "pragmarx/recovery": "^0.2.0", "predis/predis": "^1.1.3", "scheb/two-factor-bundle": "^4.11.0", - "sensio/distribution-bundle": "^5.0", "sensio/framework-extra-bundle": "^5.2", "sentry/sentry-symfony": "3.5.3", "stof/doctrine-extensions-bundle": "^1.2", @@ -121,10 +120,8 @@ "scripts": { "post-cmd": [ "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" + "bin/console cache:clear --no-warmup", + "bin/console assets:install web --symlink --relative" ], "post-install-cmd": [ "@post-cmd" @@ -134,12 +131,6 @@ ] }, "extra": { - "symfony-app-dir": "app", - "symfony-bin-dir": "bin", - "symfony-var-dir": "var", - "symfony-web-dir": "web", - "symfony-tests-dir": "tests", - "symfony-assets-install": "relative", "incenteev-parameters": { "file": "app/config/parameters.yml" } diff --git a/composer.lock b/composer.lock index e19578a99..0ae0c92d4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0d0c51bee0ced9698321d0fd2ad33aca", + "content-hash": "598bc98358673f361673a95b75c1ffa3", "packages": [ { "name": "babdev/pagerfanta-bundle", diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/about.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/about.html.twig index 1cd3485c0..a043cd281 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/about.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/about.html.twig @@ -136,9 +136,7 @@
composer install
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 "%s", but Symfony needs at least PHP "%s" 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',
- 'Install PHP 5.3.17 or newer (or downgrade to an earlier PHP version)'
- );
-
- $this->addRequirement(
- is_dir(__DIR__.'/../vendor/composer'),
- 'Vendor libraries must be installed',
- 'Vendor libraries are missing. Install composer following instructions from http://getcomposer.org/. '.
- 'Then run "php composer.phar install" to install them.'
- );
-
- $cacheDir = is_dir(__DIR__.'/../var/cache') ? __DIR__.'/../var/cache' : __DIR__.'/cache';
-
- $this->addRequirement(
- is_writable($cacheDir),
- 'app/cache/ or var/cache/ directory must be writable',
- 'Change the permissions of either "app/cache/" or "var/cache/" directory so that the web server can write into it.'
- );
-
- $logsDir = is_dir(__DIR__.'/../var/logs') ? __DIR__.'/../var/logs' : __DIR__.'/logs';
-
- $this->addRequirement(
- is_writable($logsDir),
- 'app/logs/ or var/logs/ directory must be writable',
- 'Change the permissions of either "app/logs/" or "var/logs/" directory so that the web server can write into it.'
- );
-
- if (version_compare($installedPhpVersion, '7.0.0', '<')) {
- $this->addPhpIniRequirement(
- 'date.timezone', true, false,
- 'date.timezone setting must be set',
- 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).'
- );
- }
-
- if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
- $this->addRequirement(
- in_array(@date_default_timezone_get(), DateTimeZone::listIdentifiers(), true),
- sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()),
- 'Your default timezone is not supported by PHP. Check for typos in your php.ini file and have a look at the list of deprecated timezones at http://php.net/manual/en/timezones.others.php.'
- );
- }
-
- $this->addRequirement(
- function_exists('iconv'),
- 'iconv() must be available',
- 'Install and enable the iconv extension.'
- );
-
- $this->addRequirement(
- function_exists('json_encode'),
- 'json_encode() must be available',
- 'Install and enable the JSON extension.'
- );
-
- $this->addRequirement(
- function_exists('session_start'),
- 'session_start() must be available',
- 'Install and enable the session extension.'
- );
-
- $this->addRequirement(
- function_exists('ctype_alpha'),
- 'ctype_alpha() must be available',
- 'Install and enable the ctype extension.'
- );
-
- $this->addRequirement(
- function_exists('token_get_all'),
- 'token_get_all() must be available',
- 'Install and enable the Tokenizer extension.'
- );
-
- $this->addRequirement(
- function_exists('simplexml_import_dom'),
- 'simplexml_import_dom() must be available',
- 'Install and enable the SimpleXML extension.'
- );
-
- if (function_exists('apc_store') && ini_get('apc.enabled')) {
- if (version_compare($installedPhpVersion, '5.4.0', '>=')) {
- $this->addRequirement(
- version_compare(phpversion('apc'), '3.1.13', '>='),
- 'APC version must be at least 3.1.13 when using PHP 5.4',
- 'Upgrade your APC extension (3.1.13+).'
- );
- } else {
- $this->addRequirement(
- version_compare(phpversion('apc'), '3.0.17', '>='),
- 'APC version must be at least 3.0.17',
- 'Upgrade your APC extension (3.0.17+).'
- );
- }
- }
-
- $this->addPhpIniRequirement('detect_unicode', false);
-
- if (extension_loaded('suhosin')) {
- $this->addPhpIniRequirement(
- 'suhosin.executor.include.whitelist',
- create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'),
- false,
- 'suhosin.executor.include.whitelist must be configured correctly in php.ini',
- 'Add "phar" to suhosin.executor.include.whitelist in php.ini*.'
- );
- }
-
- if (extension_loaded('xdebug')) {
- $this->addPhpIniRequirement(
- 'xdebug.show_exception_trace', false, true
- );
-
- $this->addPhpIniRequirement(
- 'xdebug.scream', false, true
- );
-
- $this->addPhpIniRecommendation(
- 'xdebug.max_nesting_level',
- create_function('$cfgValue', 'return $cfgValue > 100;'),
- true,
- 'xdebug.max_nesting_level should be above 100 in php.ini',
- 'Set "xdebug.max_nesting_level" to e.g. "250" in php.ini* to stop Xdebug\'s infinite recursion protection erroneously throwing a fatal error in your project.'
- );
- }
-
- $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null;
-
- $this->addRequirement(
- null !== $pcreVersion,
- 'PCRE extension must be available',
- 'Install the PCRE extension (version 8.0+).'
- );
-
- if (extension_loaded('mbstring')) {
- $this->addPhpIniRequirement(
- 'mbstring.func_overload',
- create_function('$cfgValue', 'return (int) $cfgValue === 0;'),
- true,
- 'string functions should not be overloaded',
- 'Set "mbstring.func_overload" to 0 in php.ini* to disable function overloading by the mbstring extension.'
- );
- }
-
- /* optional recommendations follow */
-
- if (file_exists(__DIR__.'/../vendor/composer')) {
- require_once __DIR__.'/../vendor/autoload.php';
-
- try {
- $r = new ReflectionClass('Sensio\Bundle\DistributionBundle\SensioDistributionBundle');
-
- $contents = file_get_contents(dirname($r->getFileName()).'/Resources/skeleton/app/SymfonyRequirements.php');
- } catch (ReflectionException $e) {
- $contents = '';
- }
- $this->addRecommendation(
- file_get_contents(__FILE__) === $contents,
- 'Requirements file should be up-to-date',
- 'Your requirements file is outdated. Run composer install and re-check your configuration.'
- );
- }
-
- $this->addRecommendation(
- version_compare($installedPhpVersion, '5.3.4', '>='),
- 'You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions',
- 'Your project might malfunction randomly due to PHP bug #52083 ("Notice: Trying to get property of non-object"). Install PHP 5.3.4 or newer.'
- );
-
- $this->addRecommendation(
- version_compare($installedPhpVersion, '5.3.8', '>='),
- 'When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156',
- 'Install PHP 5.3.8 or newer if your project uses annotations.'
- );
-
- $this->addRecommendation(
- version_compare($installedPhpVersion, '5.4.0', '!='),
- 'You should not use PHP 5.4.0 due to the PHP bug #61453',
- 'Your project might not work properly due to the PHP bug #61453 ("Cannot dump definitions which have method calls"). Install PHP 5.4.1 or newer.'
- );
-
- $this->addRecommendation(
- version_compare($installedPhpVersion, '5.4.11', '>='),
- 'When using the logout handler from the Symfony Security Component, you should have at least PHP 5.4.11 due to PHP bug #63379 (as a workaround, you can also set invalidate_session to false in the security logout handler configuration)',
- 'Install PHP 5.4.11 or newer if your project uses the logout handler from the Symfony Security Component.'
- );
-
- $this->addRecommendation(
- (version_compare($installedPhpVersion, '5.3.18', '>=') && version_compare($installedPhpVersion, '5.4.0', '<'))
- ||
- version_compare($installedPhpVersion, '5.4.8', '>='),
- 'You should use PHP 5.3.18+ or PHP 5.4.8+ to always get nice error messages for fatal errors in the development environment due to PHP bug #61767/#60909',
- 'Install PHP 5.3.18+ or PHP 5.4.8+ if you want nice error messages for all fatal errors in the development environment.'
- );
-
- if (null !== $pcreVersion) {
- $this->addRecommendation(
- $pcreVersion >= 8.0,
- sprintf('PCRE extension should be at least version 8.0 (%s installed)', $pcreVersion),
- 'PCRE 8.0+ is preconfigured in PHP since 5.3.2 but you are using an outdated version of it. Symfony probably works anyway but it is recommended to upgrade your PCRE extension.'
- );
- }
-
- $this->addRecommendation(
- class_exists('DomDocument'),
- 'PHP-DOM and PHP-XML modules should be installed',
- 'Install and enable the PHP-DOM and the PHP-XML modules.'
- );
-
- $this->addRecommendation(
- function_exists('mb_strlen'),
- 'mb_strlen() should be available',
- 'Install and enable the mbstring extension.'
- );
-
- $this->addRecommendation(
- function_exists('utf8_decode'),
- 'utf8_decode() should be available',
- 'Install and enable the XML extension.'
- );
-
- $this->addRecommendation(
- function_exists('filter_var'),
- 'filter_var() should be available',
- 'Install and enable the filter extension.'
- );
-
- if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
- $this->addRecommendation(
- function_exists('posix_isatty'),
- 'posix_isatty() should be available',
- 'Install and enable the php_posix extension (used to colorize the CLI output).'
- );
- }
-
- $this->addRecommendation(
- extension_loaded('intl'),
- 'intl extension should be available',
- 'Install and enable the intl extension (used for validators).'
- );
-
- if (extension_loaded('intl')) {
- // in some WAMP server installations, new Collator() returns null
- $this->addRecommendation(
- null !== new Collator('fr_FR'),
- 'intl extension should be correctly configured',
- 'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.'
- );
-
- // check for compatible ICU versions (only done when you have the intl extension)
- if (defined('INTL_ICU_VERSION')) {
- $version = INTL_ICU_VERSION;
- } else {
- $reflector = new ReflectionExtension('intl');
-
- ob_start();
- $reflector->info();
- $output = strip_tags(ob_get_clean());
-
- preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
- $version = $matches[1];
- }
-
- $this->addRecommendation(
- version_compare($version, '4.0', '>='),
- 'intl ICU version should be at least 4+',
- 'Upgrade your intl 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;'),
- true,
- 'intl.error_level should be 0 in php.ini',
- 'Set "intl.error_level" to "0" in php.ini* to inhibit the messages when an error occurs in ICU functions.'
- );
- }
-
- $accelerator =
- (extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'))
- ||
- (extension_loaded('apc') && ini_get('apc.enabled'))
- ||
- (extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable'))
- ||
- (extension_loaded('Zend OPcache') && ini_get('opcache.enable'))
- ||
- (extension_loaded('xcache') && ini_get('xcache.cacher'))
- ||
- (extension_loaded('wincache') && ini_get('wincache.ocenabled'))
- ;
-
- $this->addRecommendation(
- $accelerator,
- 'a PHP accelerator should be installed',
- 'Install and/or enable a PHP accelerator (highly recommended).'
- );
-
- if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
- $this->addRecommendation(
- $this->getRealpathCacheSize() >= 5 * 1024 * 1024,
- 'realpath_cache_size should be at least 5M in php.ini',
- 'Setting "realpath_cache_size" to e.g. "5242880" or "5M" in php.ini* may improve performance on Windows significantly in some cases.'
- );
- }
-
- $this->addPhpIniRecommendation('short_open_tag', false);
-
- $this->addPhpIniRecommendation('magic_quotes_gpc', false, true);
-
- $this->addPhpIniRecommendation('register_globals', false, true);
-
- $this->addPhpIniRecommendation('session.auto_start', false);
-
- $this->addRecommendation(
- class_exists('PDO'),
- 'PDO should be installed',
- 'Install PDO (mandatory for Doctrine).'
- );
-
- if (class_exists('PDO')) {
- $drivers = PDO::getAvailableDrivers();
- $this->addRecommendation(
- count($drivers) > 0,
- sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'),
- 'Install PDO drivers (mandatory for Doctrine).'
- );
- }
- }
-
- /**
- * Loads realpath_cache_size from php.ini and converts it to int.
- *
- * (e.g. 16k is converted to 16384 int)
- *
- * @return int
- */
- protected function getRealpathCacheSize()
- {
- $size = ini_get('realpath_cache_size');
- $size = trim($size);
- $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;
- case 'm':
- return $size * 1024 * 1024;
- case 'k':
- return $size * 1024;
- default:
- 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;
- }
-}