Skip to content

Commit 68f8a93

Browse files
committed
get it working
1 parent 68fb547 commit 68f8a93

File tree

6 files changed

+299
-41
lines changed

6 files changed

+299
-41
lines changed

app/config/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ cmf_sonata_admin_integration:
131131
block: ~
132132
routing: ~
133133

134+
134135
sonata_block:
135136
default_contexts: [cms]
136137
blocks:
@@ -196,7 +197,7 @@ sonata_admin:
196197
label: URLs
197198
icon: '<i class="fa fa-link"></i>'
198199
items:
199-
- cmf_sonata_admin_integration.routing.route_admin
200+
- cmf_sonata_admin_integration.route_admin
200201
- cmf_sonata_admin_integration.routing.redirect_route_admin
201202
menu:
202203
label: Menu

bin/symfony_requirements

100644100755
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ echo '> Checking Symfony requirements:'.PHP_EOL.' ';
2222

2323
$messages = array();
2424
foreach ($symfonyRequirements->getRequirements() as $req) {
25-
/** @var $req Requirement */
2625
if ($helpText = get_error_message($req, $lineSize)) {
2726
echo_style('red', 'E');
2827
$messages['error'][] = $helpText;
@@ -121,10 +120,14 @@ function echo_block($style, $title, $message)
121120

122121
echo PHP_EOL.PHP_EOL;
123122

124-
echo_style($style, str_repeat(' ', $width).PHP_EOL);
125-
echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL);
126-
echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL);
127-
echo_style($style, str_repeat(' ', $width).PHP_EOL);
123+
echo_style($style, str_repeat(' ', $width));
124+
echo PHP_EOL;
125+
echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT));
126+
echo PHP_EOL;
127+
echo_style($style, $message);
128+
echo PHP_EOL;
129+
echo_style($style, str_repeat(' ', $width));
130+
echo PHP_EOL;
128131
}
129132

130133
function has_color_support()

composer.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/AppBundle/DataFixtures/PHPCR/LoadRoutingData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function load(ObjectManager $manager)
4949

5050
$session = $manager->getPhpcrSession();
5151

52-
$basepath = $this->container->getParameter('cmf_routing.dynamic.persistence.phpcr.admin_basepath');
52+
$basepath = $this->container->getParameter('cmf_sonata_admin_integration.routing.phpcr.basepath');
5353
if ($session->itemExists($basepath)) {
5454
$session->removeItem($basepath);
5555
}

var/SymfonyRequirements.php

Lines changed: 65 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $
168168
*/
169169
class RequirementCollection implements IteratorAggregate
170170
{
171+
/**
172+
* @var Requirement[]
173+
*/
171174
private $requirements = array();
172175

173176
/**
@@ -265,7 +268,7 @@ public function addCollection(RequirementCollection $collection)
265268
/**
266269
* Returns both requirements and recommendations.
267270
*
268-
* @return array Array of Requirement instances
271+
* @return Requirement[]
269272
*/
270273
public function all()
271274
{
@@ -275,7 +278,7 @@ public function all()
275278
/**
276279
* Returns all mandatory requirements.
277280
*
278-
* @return array Array of Requirement instances
281+
* @return Requirement[]
279282
*/
280283
public function getRequirements()
281284
{
@@ -292,7 +295,7 @@ public function getRequirements()
292295
/**
293296
* Returns the mandatory requirements that were not met.
294297
*
295-
* @return array Array of Requirement instances
298+
* @return Requirement[]
296299
*/
297300
public function getFailedRequirements()
298301
{
@@ -309,7 +312,7 @@ public function getFailedRequirements()
309312
/**
310313
* Returns all optional recommendations.
311314
*
312-
* @return array Array of Requirement instances
315+
* @return Requirement[]
313316
*/
314317
public function getRecommendations()
315318
{
@@ -326,7 +329,7 @@ public function getRecommendations()
326329
/**
327330
* Returns the recommendations that were not met.
328331
*
329-
* @return array Array of Requirement instances
332+
* @return Requirement[]
330333
*/
331334
public function getFailedRecommendations()
332335
{
@@ -376,7 +379,8 @@ public function getPhpIniConfigPath()
376379
*/
377380
class SymfonyRequirements extends RequirementCollection
378381
{
379-
const REQUIRED_PHP_VERSION = '5.3.3';
382+
const LEGACY_REQUIRED_PHP_VERSION = '5.3.3';
383+
const REQUIRED_PHP_VERSION = '5.5.9';
380384

381385
/**
382386
* Constructor that initializes the requirements.
@@ -386,16 +390,26 @@ public function __construct()
386390
/* mandatory requirements follow */
387391

388392
$installedPhpVersion = phpversion();
393+
$requiredPhpVersion = $this->getPhpRequiredVersion();
389394

390-
$this->addRequirement(
391-
version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='),
392-
sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion),
393-
sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
394-
Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
395-
$installedPhpVersion, self::REQUIRED_PHP_VERSION),
396-
sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion)
395+
$this->addRecommendation(
396+
$requiredPhpVersion,
397+
'Vendors should be installed in order to check all requirements.',
398+
'Run the <code>composer install</code> command.',
399+
'Run the "composer install" command.'
397400
);
398401

402+
if (false !== $requiredPhpVersion) {
403+
$this->addRequirement(
404+
version_compare($installedPhpVersion, $requiredPhpVersion, '>='),
405+
sprintf('PHP version must be at least %s (%s installed)', $requiredPhpVersion, $installedPhpVersion),
406+
sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
407+
Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
408+
$installedPhpVersion, $requiredPhpVersion),
409+
sprintf('Install PHP %s or newer (installed version is %s)', $requiredPhpVersion, $installedPhpVersion)
410+
);
411+
}
412+
399413
$this->addRequirement(
400414
version_compare($installedPhpVersion, '5.3.16', '!='),
401415
'PHP version must not be 5.3.16 as Symfony won\'t work properly with it',
@@ -433,7 +447,7 @@ public function __construct()
433447
);
434448
}
435449

436-
if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
450+
if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
437451
$timezones = array();
438452
foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
439453
foreach ($abbreviations as $abbreviation) {
@@ -681,10 +695,17 @@ function_exists('posix_isatty'),
681695

682696
if (class_exists('Symfony\Component\Intl\Intl')) {
683697
$this->addRecommendation(
684-
\Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(),
685-
sprintf('intl ICU version installed on your system (%s) should match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()),
686-
'In most cases you should be fine, but please verify there is no inconsistencies between data provided by Symfony and the intl extension. See https://github.com/symfony/symfony/issues/15007 for an example of inconsistencies you might run into.'
698+
\Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion(),
699+
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()),
700+
'To get the latest internationalization data upgrade the ICU system package and the intl PHP extension.'
687701
);
702+
if (\Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion()) {
703+
$this->addRecommendation(
704+
\Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(),
705+
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()),
706+
'To avoid internationalization data inconsistencies upgrade the symfony/intl component.'
707+
);
708+
}
688709
}
689710

690711
$this->addPhpIniRecommendation(
@@ -718,9 +739,9 @@ function_exists('posix_isatty'),
718739

719740
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
720741
$this->addRecommendation(
721-
$this->getRealpathCacheSize() > 1000,
722-
'realpath_cache_size should be above 1024 in php.ini',
723-
'Set "<strong>realpath_cache_size</strong>" to e.g. "<strong>1024</strong>" in php.ini<a href="#phpini">*</a> to improve performance on windows.'
742+
$this->getRealpathCacheSize() >= 5 * 1024 * 1024,
743+
'realpath_cache_size should be at least 5M in php.ini',
744+
'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.'
724745
);
725746
}
726747

@@ -771,4 +792,28 @@ protected function getRealpathCacheSize()
771792
return (int) $size;
772793
}
773794
}
795+
796+
/**
797+
* Defines PHP required version from Symfony version.
798+
*
799+
* @return string|false The PHP required version or false if it could not be guessed
800+
*/
801+
protected function getPhpRequiredVersion()
802+
{
803+
if (!file_exists($path = __DIR__.'/../composer.lock')) {
804+
return false;
805+
}
806+
807+
$composerLock = json_decode(file_get_contents($path), true);
808+
foreach ($composerLock['packages'] as $package) {
809+
$name = $package['name'];
810+
if ('symfony/symfony' !== $name && 'symfony/http-kernel' !== $name) {
811+
continue;
812+
}
813+
814+
return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION;
815+
}
816+
817+
return false;
818+
}
774819
}

0 commit comments

Comments
 (0)