本文整理汇总了PHP中SymfonyRequirements::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP SymfonyRequirements::__construct方法的具体用法?PHP SymfonyRequirements::__construct怎么用?PHP SymfonyRequirements::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymfonyRequirements
的用法示例。
在下文中一共展示了SymfonyRequirements::__construct方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$phpVersion = phpversion();
$gdVersion = defined('GD_VERSION') ? GD_VERSION : null;
$curlVersion = function_exists('curl_version') ? curl_version() : null;
$icuVersion = Intl::getIcuVersion();
$this->addOroRequirement(version_compare($phpVersion, self::REQUIRED_PHP_VERSION, '>='), sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $phpVersion), sprintf('You are running PHP version "<strong>%s</strong>", but Oro needs at least PHP "<strong>%s</strong>" to run.
Before using Oro, upgrade your PHP installation, preferably to the latest version.', $phpVersion, self::REQUIRED_PHP_VERSION), sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $phpVersion));
$this->addOroRequirement(null !== $gdVersion && version_compare($gdVersion, self::REQUIRED_GD_VERSION, '>='), 'GD extension must be at least ' . self::REQUIRED_GD_VERSION, 'Install and enable the <strong>GD</strong> extension at least ' . self::REQUIRED_GD_VERSION . ' version');
$this->addOroRequirement(function_exists('mcrypt_encrypt'), 'mcrypt_encrypt() should be available', 'Install and enable the <strong>Mcrypt</strong> extension.');
$this->addOroRequirement(class_exists('Locale'), 'intl extension should be available', 'Install and enable the <strong>intl</strong> extension.');
$this->addOroRequirement(null !== $icuVersion && version_compare($icuVersion, self::REQUIRED_ICU_VERSION, '>='), 'icu library must be at least ' . self::REQUIRED_ICU_VERSION, 'Install and enable the <strong>icu</strong> library at least ' . self::REQUIRED_ICU_VERSION . ' version');
$this->addRecommendation(class_exists('SoapClient'), 'SOAP extension should be installed (API calls)', 'Install and enable the <strong>SOAP</strong> extension.');
$this->addRecommendation(null !== $curlVersion && version_compare($curlVersion['version'], self::REQUIRED_CURL_VERSION, '>='), 'cURL extension must be at least ' . self::REQUIRED_CURL_VERSION, 'Install and enable the <strong>cURL</strong> extension at least ' . self::REQUIRED_CURL_VERSION . ' version');
// Windows specific checks
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->addRecommendation(function_exists('finfo_open'), 'finfo_open() should be available', 'Install and enable the <strong>Fileinfo</strong> extension.');
$this->addRecommendation(class_exists('COM'), 'COM extension should be installed', 'Install and enable the <strong>COM</strong> extension.');
}
$baseDir = realpath(__DIR__ . '/..');
$mem = $this->getBytes(ini_get('memory_limit'));
$this->addPhpIniRequirement('memory_limit', function ($cfgValue) use($mem) {
return $mem >= 256 * 1024 * 1024 || -1 == $mem;
}, false, 'memory_limit should be at least 256M', 'Set the "<strong>memory_limit</strong>" setting in php.ini<a href="#phpini">*</a> to at least "256M".');
$directories = array('web/bundles', 'app/cache', 'app/logs', 'app/archive', 'app/uploads/product');
foreach ($directories as $directory) {
$this->addOroRequirement(is_writable($baseDir . '/' . $directory), $directory . ' directory must be writable', 'Change the permissions of the "<strong>' . $directory . '</strong>" directory so that the web server can write into it.');
}
}
示例2: __construct
public function __construct()
{
parent::__construct();
$phpVersion = phpversion();
$gdVersion = defined('GD_VERSION') ? GD_VERSION : null;
$curlVersion = function_exists('curl_version') ? curl_version() : null;
$icuVersion = Intl::getIcuVersion();
$this->addOroRequirement(version_compare($phpVersion, self::REQUIRED_PHP_VERSION, '>='), sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $phpVersion), sprintf('You are running PHP version "<strong>%s</strong>", but Oro needs at least PHP "<strong>%s</strong>" to run.' . 'Before using Oro, upgrade your PHP installation, preferably to the latest version.', $phpVersion, self::REQUIRED_PHP_VERSION), sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $phpVersion));
$this->addOroRequirement(null !== $gdVersion && version_compare($gdVersion, self::REQUIRED_GD_VERSION, '>='), 'GD extension must be at least ' . self::REQUIRED_GD_VERSION, 'Install and enable the <strong>GD</strong> extension at least ' . self::REQUIRED_GD_VERSION . ' version');
$this->addOroRequirement(null !== $curlVersion && version_compare($curlVersion['version'], self::REQUIRED_CURL_VERSION, '>='), 'cURL extension must be at least ' . self::REQUIRED_CURL_VERSION, 'Install and enable the <strong>cURL</strong> extension at least ' . self::REQUIRED_CURL_VERSION . ' version');
$this->addOroRequirement(function_exists('mcrypt_encrypt'), 'mcrypt_encrypt() should be available', 'Install and enable the <strong>Mcrypt</strong> extension.');
$this->addOroRequirement(class_exists('Locale'), 'intl extension should be available', 'Install and enable the <strong>intl</strong> extension.');
$this->addOroRequirement(null !== $icuVersion && version_compare($icuVersion, self::REQUIRED_ICU_VERSION, '>='), 'icu library must be at least ' . self::REQUIRED_ICU_VERSION, 'Install and enable the <strong>icu</strong> library at least ' . self::REQUIRED_ICU_VERSION . ' version');
$this->addRecommendation(class_exists('SoapClient'), 'SOAP extension should be installed (API calls)', 'Install and enable the <strong>SOAP</strong> extension.');
// Windows specific checks
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->addRecommendation(function_exists('finfo_open'), 'finfo_open() should be available', 'Install and enable the <strong>Fileinfo</strong> extension.');
$this->addRecommendation(class_exists('COM'), 'COM extension should be installed', 'Install and enable the <strong>COM</strong> extension.');
}
// Unix specific checks
// if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
// $this->addRequirement(
// $this->checkFileNameLength(),
// 'Cache folder should not be inside encrypted directory',
// 'Move <strong>app/cache</strong> folder outside encrypted directory.'
// );
// }
// Web installer specific checks
if ('cli' !== PHP_SAPI) {
$output = $this->checkCliRequirements();
$requirement = new CliRequirement(!$output, 'Requirements validation for PHP CLI', 'If you have multiple PHP versions installed, you need to configure ORO_PHP_PATH variable with PHP binary path used by web server');
$requirement->setOutput($output);
$this->add($requirement);
}
$baseDir = realpath(__DIR__ . '/..');
$mem = $this->getBytes(ini_get('memory_limit'));
$this->addPhpIniRequirement('memory_limit', function ($cfgValue) use($mem) {
return $mem >= 512 * 1024 * 1024 || -1 == $mem;
}, false, 'memory_limit should be at least 512M', 'Set the "<strong>memory_limit</strong>" setting in php.ini<a href="#phpini">*</a> to at least "512M".');
$jsEngine = RequireJSConfiguration::getDefaultJsEngine();
$this->addRecommendation($jsEngine ? true : false, $jsEngine ? "A JS Engine ({$jsEngine}) is installed" : 'JSEngine such as NodeJS should be installed', 'Install <strong>JSEngine</strong>.');
$this->addOroRequirement(is_writable($baseDir . '/web/uploads'), 'web/uploads/ directory must be writable', 'Change the permissions of the "<strong>web/uploads/</strong>" directory so that the web server can write into it.');
$this->addOroRequirement(is_writable($baseDir . '/web/media'), 'web/media/ directory must be writable', 'Change the permissions of the "<strong>web/media/</strong>" directory so that the web server can write into it.');
$this->addOroRequirement(is_writable($baseDir . '/web/bundles'), 'web/bundles/ directory must be writable', 'Change the permissions of the "<strong>web/bundles/</strong>" directory so that the web server can write into it.');
$this->addOroRequirement(is_writable($baseDir . '/app/attachment'), 'app/attachment/ directory must be writable', 'Change the permissions of the "<strong>app/attachment/</strong>" directory so that the web server can write into it.');
if (is_dir($baseDir . '/web/js')) {
$this->addOroRequirement(is_writable($baseDir . '/web/js'), 'web/js directory must be writable', 'Change the permissions of the "<strong>web/js</strong>" directory so that the web server can write into it.');
}
if (is_dir($baseDir . '/web/css')) {
$this->addOroRequirement(is_writable($baseDir . '/web/css'), 'web/css directory must be writable', 'Change the permissions of the "<strong>web/css</strong>" directory so that the web server can write into it.');
}
if (!is_dir($baseDir . '/web/css') || !is_dir($baseDir . '/web/js')) {
$this->addOroRequirement(is_writable($baseDir . '/web'), 'web directory must be writable', 'Change the permissions of the "<strong>web</strong>" directory so that the web server can write into it.');
}
if (is_file($baseDir . '/app/config/parameters.yml')) {
$this->addOroRequirement(is_writable($baseDir . '/app/config/parameters.yml'), 'app/config/parameters.yml file must be writable', 'Change the permissions of the "<strong>app/config/parameters.yml</strong>" file so that the web server can write into it.');
}
}
示例3: __construct
public function __construct()
{
parent::__construct();
// System call, e.g. to use Composer via command line, must be possible.
$this->addRecommendation(function_exists('system'), 'system() should be available', 'Please enable the PHP function <strong>system()</strong>.');
$this->addRecommendation(class_exists('IntlDateFormatter '), 'Internationalization Functions should be installed', 'Install and enable the <strong>PHP-INTL</strong> module: http://php.net/manual/en/intl.setup.php.');
// /app/campaignchain must be writable.
$campaignchainAppDir = __DIR__ . DIRECTORY_SEPARATOR . 'campaignchain';
$this->addRequirement(is_writable($campaignchainAppDir), realpath($campaignchainAppDir) . ' must be writable', 'Change the permissions of "' . realpath($campaignchainAppDir) . '" directory so that the web server can write into it.');
// /composer.json must be writable
$composerJson = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'composer.json';
$this->addRecommendation(is_writable($composerJson), realpath($composerJson) . ' should be writable', 'Change the permissions of "' . realpath($composerJson) . '" file if you would like to have the built-in modules dashboard work for users.');
// /app/sessions must be writable.
$campaignchainSessionsDir = __DIR__ . DIRECTORY_SEPARATOR . 'sessions';
$this->addRequirement(is_writable($campaignchainSessionsDir), realpath($campaignchainSessionsDir) . ' must be writable', 'Change the permissions of "' . realpath($campaignchainSessionsDir) . '" directory so that the web server can write into it.');
}
示例4: __construct
/**
* Constructor that initializes the requirements.
*/
public function __construct()
{
parent::__construct();
$this->addRequirement(ini_get("allow_url_fopen") || function_exists("curl_init"), sprintf('No way to remotely load files detected'), sprintf('Either set <strong>allow_url_fopen=true</strong> or install the cURL extension'));
$this->addRequirement(function_exists("imagecreate"), sprintf('GD library not found'), sprintf('Install the GD library extension'));
$this->addRequirement(function_exists("curl_init"), sprintf('CURL library not found'), sprintf('Install the GD library extension'));
$this->addPhpIniRequirement("memory_limit", $this->getBytesIniSetting("memory_limit") > 128000000, false, "Memory Limit too small", sprintf("The php.ini memory_limit directive must be set to 128MB or higher. Your limit is set to %s", ini_get("memory_limit")));
$this->checkWritable(realpath(dirname(__FILE__) . "/../data/"));
$this->checkWritable(realpath(dirname(__FILE__) . "/../app/"));
$this->checkWritable(realpath(dirname(__FILE__) . "/../web/"));
$this->addRecommendation(function_exists("apc_fetch"), sprintf('PHP APCu cache not found'), sprintf('For best performance install the PHP APCu cache'));
$this->addPhpIniRecommendation("max_execution_time", ini_get("max_execution_time") > 30, true, sprintf('Maximum Execution Time might be too low'), sprintf('Your maximum execution time is set to %d seconds, which might be too low for low-end systems. If you encounter problems, please increase the value.', ini_get("max_execution_time")));
$this->addRequirement(function_exists("mb_convert_case"), sprintf('The PHP function mb_convert_case does not exist.'), sprintf('Please compile PHP with the mbstring functions in case you are using Gentoo, or install php-mbstring on RedHat, Fedora or CentOS.'));
if (ini_get("opcache.enable")) {
if (version_compare(phpversion(), "7.0", "<")) {
$this->addPhpIniRequirement("opcache.save_comments", 1, false, "opcache.save_comments must be on", sprintf("The php.ini opcache.save_comments directive must be set to 1."));
$this->addPhpIniRequirement("opcache.load_comments", 1, false, "opcache.load_comments must be on", sprintf("The php.ini opcache.load_comments directive must be set to 1."));
}
}
}
示例5: __construct
public function __construct()
{
$phpVersion = phpversion();
$icuVersion = Intl::getIcuVersion();
$this->addRequirement(version_compare($phpVersion, self::REQUIRED_PHP_VERSION, '>='), sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $phpVersion), sprintf('You are running PHP version "<strong>%s</strong>", but CSBill needs at least PHP "<strong>%s</strong>" to run.
Before using CSBill, upgrade your PHP installation, preferably to the latest version.', $phpVersion, self::REQUIRED_PHP_VERSION), sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $phpVersion));
parent::__construct();
$this->addRequirement(function_exists('mcrypt_encrypt'), 'mcrypt_encrypt() should be available', 'Install and enable the <strong>Mcrypt</strong> extension.');
$this->addRequirement(class_exists('Locale'), 'intl extension should be available', 'Install and enable the <strong>intl</strong> extension.');
$this->addRequirement(null !== $icuVersion && version_compare($icuVersion, self::REQUIRED_ICU_VERSION, '>='), 'icu library must be at least ' . self::REQUIRED_ICU_VERSION, 'Install and enable the <strong>icu</strong> library at least ' . self::REQUIRED_ICU_VERSION . ' version');
$baseDir = realpath(__DIR__ . '/..');
$this->addRequirement(is_writable($baseDir . '/web/uploads'), 'web/uploads/ directory must be writable', 'Change the permissions of the "<strong>web/uploads/</strong>" directory so that the web server can write into it.');
if (is_file($baseDir . '/app/config/parameters.yml')) {
$this->addRequirement(is_writable($baseDir . '/app/config/parameters.yml'), 'app/config/parameters.yml file must be writable', 'Change the permissions of the "<strong>app/config/parameters.yml</strong>" file so that the web server can write into it.');
}
$this->addRequirement(class_exists('PDO'), 'PDO should be installed', 'Install <strong>PDO</strong>.');
if (class_exists('PDO')) {
$drivers = PDO::getAvailableDrivers();
$this->addRequirement(in_array('mysql', $drivers), sprintf('The MySQL driver for PDO should be installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'), 'Install the <strong>MySQL PDO drivers</strong>.');
}
}