X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=app%2FSymfonyRequirements.php;h=28b0dcdbfcd82a6265fa39f57325fbf46747ce09;hb=78833672469f7beb0c4a195aa0a76f7ca4133057;hp=cbcf1c8e3edf5695ab87372d39bb15cf944def8f;hpb=e4788de51ecbf2773a043325965e10eb74b14e8f;p=github%2Fwallabag%2Fwallabag.git
diff --git a/app/SymfonyRequirements.php b/app/SymfonyRequirements.php
index cbcf1c8e..28b0dcdb 100644
--- a/app/SymfonyRequirements.php
+++ b/app/SymfonyRequirements.php
@@ -77,7 +77,7 @@ class Requirement
}
/**
- * Returns the help text for resolving the problem
+ * Returns the help text for resolving the problem.
*
* @return string The help text
*/
@@ -119,10 +119,10 @@ class PhpIniRequirement extends Requirement
*
* @param string $cfgName The configuration name used for ini_get()
* @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
- or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
+ * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
- This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
- Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
+ * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
+ * Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string|null $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
* @param string|null $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
@@ -221,10 +221,10 @@ class RequirementCollection implements IteratorAggregate
*
* @param string $cfgName The configuration name used for ini_get()
* @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
- or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
+ * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
- This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
- Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
+ * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
+ * Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
* @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
@@ -239,10 +239,10 @@ class RequirementCollection implements IteratorAggregate
*
* @param string $cfgName The configuration name used for ini_get()
* @param bool|callback $evaluation Either a boolean indicating whether the configuration should evaluate to true or false,
- or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
+ * or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
* @param bool $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
- This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
- Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
+ * This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
+ * Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
* @param string $testMessage The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
* @param string $helpHtml The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
* @param string|null $helpText The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
@@ -446,6 +446,12 @@ class SymfonyRequirements extends RequirementCollection
);
}
+ $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',
@@ -542,11 +548,22 @@ class SymfonyRequirements extends RequirementCollection
/* optional recommendations follow */
- $this->addRecommendation(
- file_get_contents(__FILE__) === file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'),
- 'Requirements file should be up-to-date',
- 'Your requirements file is outdated. Run composer install and re-check your configuration.'
- );
+ 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', '>='),
@@ -627,20 +644,20 @@ class SymfonyRequirements extends RequirementCollection
}
$this->addRecommendation(
- class_exists('Locale'),
+ extension_loaded('intl'),
'intl extension should be available',
'Install and enable the intl extension (used for validators).'
);
- if (class_exists('Collator')) {
+ 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.'
);
- }
- if (class_exists('Locale')) {
+ // check for compatible ICU versions (only done when you have the intl extension)
if (defined('INTL_ICU_VERSION')) {
$version = INTL_ICU_VERSION;
} else {
@@ -659,6 +676,14 @@ class SymfonyRequirements extends RequirementCollection
'intl ICU version should be at least 4+',
'Upgrade your intl extension with a newer ICU version (4+).'
);
+
+ $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 =