diff options
| author | 2021-01-14 17:28:45 -0500 | |
|---|---|---|
| committer | 2021-01-14 23:28:45 +0100 | |
| commit | 29fe125b4a18f7107b50e54c69184c4f1777bbf6 (patch) | |
| tree | d76446252588f6db51b50a697ff7649894817aa2 | |
| parent | e3457f7d7b56509048e3c1f53f05f278656e976c (diff) | |
Add constant for PHP requirements (#3369)
* Add constant for PHP requirements
This new constant is used for PHP version check.
This way, we won't forget to modify some part of the code base.
* Remove PHP version checks
Some checks were obsolete because they were checking unsupported
PHP versions.
| -rwxr-xr-x | app/Controllers/configureController.php | 7 | ||||
| -rw-r--r-- | app/install.php | 2 | ||||
| -rw-r--r-- | app/views/configure/system.phtml | 30 | ||||
| -rw-r--r-- | app/views/update/checkInstall.phtml | 2 | ||||
| -rw-r--r-- | constants.php | 1 | ||||
| -rw-r--r-- | lib/Minz/Mailer.php | 6 | ||||
| -rw-r--r-- | lib/lib_install.php | 2 | ||||
| -rw-r--r-- | lib/lib_rss.php | 6 |
8 files changed, 22 insertions, 34 deletions
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 6358f48c2..917879810 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -358,9 +358,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController { Minz_Error::error(403); } - $can_enable_email_validation = version_compare(PHP_VERSION, '5.5') >= 0; - $this->view->can_enable_email_validation = $can_enable_email_validation; - if (Minz_Request::isPost()) { $limits = FreshRSS_Context::$system_conf->limits; $limits['max_registrations'] = Minz_Request::param('max-registrations', 1); @@ -370,9 +367,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { FreshRSS_Context::$system_conf->limits = $limits; FreshRSS_Context::$system_conf->title = Minz_Request::param('instance-name', 'FreshRSS'); FreshRSS_Context::$system_conf->auto_update_url = Minz_Request::param('auto-update-url', false); - if ($can_enable_email_validation) { - FreshRSS_Context::$system_conf->force_email_validation = Minz_Request::param('force-email-validation', false); - } + FreshRSS_Context::$system_conf->force_email_validation = Minz_Request::param('force-email-validation', false); FreshRSS_Context::$system_conf->save(); invalidateHttpCache(); diff --git a/app/install.php b/app/install.php index bb7d9de9d..5e75fe42c 100644 --- a/app/install.php +++ b/app/install.php @@ -371,7 +371,7 @@ function printStep1() { <?php if ($res['php'] == 'ok') { ?> <p class="alert alert-success"><span class="alert-head"><?= _t('gen.short.ok') ?></span> <?= _t('install.check.php.ok', PHP_VERSION) ?></p> <?php } else { ?> - <p class="alert alert-error"><span class="alert-head"><?= _t('gen.short.damn') ?></span> <?= _t('install.check.php.nok', PHP_VERSION, '5.6.0') ?></p> + <p class="alert alert-error"><span class="alert-head"><?= _t('gen.short.damn') ?></span> <?= _t('install.check.php.nok', PHP_VERSION, FRESHRSS_MIN_PHP_VERSION) ?></p> <?php } ?> <?php if ($res['pdo'] == 'ok') { ?> diff --git a/app/views/configure/system.phtml b/app/views/configure/system.phtml index 75117ee1c..79376bc4e 100644 --- a/app/views/configure/system.phtml +++ b/app/views/configure/system.phtml @@ -38,23 +38,21 @@ </div> </div> - <?php if ($this->can_enable_email_validation) { ?> - <div class="form-group"> - <div class="group-controls"> - <label class="checkbox" for="force-email-validation"> - <input - type="checkbox" - name="force-email-validation" - id="force-email-validation" - value="1" - <?= FreshRSS_Context::$system_conf->force_email_validation ? 'checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$system_conf->force_email_validation ?>" - /> - <?= _t('admin.system.force_email_validation') ?> - </label> - </div> + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="force-email-validation"> + <input + type="checkbox" + name="force-email-validation" + id="force-email-validation" + value="1" + <?= FreshRSS_Context::$system_conf->force_email_validation ? 'checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::$system_conf->force_email_validation ?>" + /> + <?= _t('admin.system.force_email_validation') ?> + </label> </div> - <?php } ?> + </div> <div class="form-group"> <label class="group-name" for="max-feeds"><?= _t('admin.system.max-feeds') ?></label> diff --git a/app/views/update/checkInstall.phtml b/app/views/update/checkInstall.phtml index 183f914c0..8a05fa301 100644 --- a/app/views/update/checkInstall.phtml +++ b/app/views/update/checkInstall.phtml @@ -9,7 +9,7 @@ <p class="alert <?= $status ? 'alert-success' : 'alert-error' ?>"> <?php if ($key === 'php') { - echo _t('admin.check_install.' . $key . '.' . ($status ? 'ok' : 'nok'), PHP_VERSION, '5.6.0'); + echo _t('admin.check_install.' . $key . '.' . ($status ? 'ok' : 'nok'), PHP_VERSION, FRESHRSS_MIN_PHP_VERSION); } else { echo _t('admin.check_install.' . $key . '.' . ($status ? 'ok' : 'nok')); } diff --git a/constants.php b/constants.php index 02a2cf8fa..7616195b6 100644 --- a/constants.php +++ b/constants.php @@ -2,6 +2,7 @@ //NB: Do not edit; use ./constants.local.php instead. //<Not customisable> +define('FRESHRSS_MIN_PHP_VERSION', '5.6.0'); define('FRESHRSS_VERSION', '1.17.1-dev'); define('FRESHRSS_WEBSITE', 'https://freshrss.org'); define('FRESHRSS_WIKI', 'https://freshrss.github.io/FreshRSS/'); diff --git a/lib/Minz/Mailer.php b/lib/Minz/Mailer.php index 04392982b..b0de183e3 100644 --- a/lib/Minz/Mailer.php +++ b/lib/Minz/Mailer.php @@ -34,14 +34,8 @@ class Minz_Mailer { /** * Constructor. - * - * If PHP version is < 5.5, a warning is logged. */ public function __construct () { - if (version_compare(PHP_VERSION, '5.5') < 0) { - Minz_Log::warning('Minz_Mailer cannot be used with a version of PHP < 5.5.'); - } - $this->view = new Minz_View(); $this->view->_layout(false); $this->view->attributeParams(); diff --git a/lib/lib_install.php b/lib/lib_install.php index e67b3611c..19b3274e3 100644 --- a/lib/lib_install.php +++ b/lib/lib_install.php @@ -6,7 +6,7 @@ Minz_Configuration::register('default_system', join_path(FRESHRSS_PATH, 'config. Minz_Configuration::register('default_user', join_path(FRESHRSS_PATH, 'config-user.default.php')); function checkRequirements($dbType = '') { - $php = version_compare(PHP_VERSION, '5.6.0') >= 0; + $php = version_compare(PHP_VERSION, FRESHRSS_MIN_PHP_VERSION) >= 0; $curl = extension_loaded('curl'); $pdo_mysql = extension_loaded('pdo_mysql'); $pdo_sqlite = extension_loaded('pdo_sqlite'); diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 9afcc8636..aaa644faf 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -1,6 +1,6 @@ <?php -if (version_compare(PHP_VERSION, '5.6.0', '<')) { - die('FreshRSS error: FreshRSS requires PHP 5.6.0+!'); +if (version_compare(PHP_VERSION, FRESHRSS_MIN_PHP_VERSION, '<')) { + die(sprintf('FreshRSS error: FreshRSS requires PHP %s+!', FRESHRSS_MIN_PHP_VERSION)); } if (!function_exists('mb_strcut')) { @@ -416,7 +416,7 @@ function check_install_php() { $pdo_pgsql = extension_loaded('pdo_pgsql'); $pdo_sqlite = extension_loaded('pdo_sqlite'); return array( - 'php' => version_compare(PHP_VERSION, '5.5.0') >= 0, + 'php' => version_compare(PHP_VERSION, FRESHRSS_MIN_PHP_VERSION) >= 0, 'minz' => file_exists(LIB_PATH . '/Minz'), 'curl' => extension_loaded('curl'), 'pdo' => $pdo_mysql || $pdo_sqlite || $pdo_pgsql, |
