From c9cf2715f0ec10d51d881d386de9fa818f76af46 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Tue, 24 Nov 2015 01:36:12 +0100 Subject: application: move checkPHPVersion from Utils to ApplicationUtils Relates to #372 Signed-off-by: VirtualTam --- application/ApplicationUtils.php | 20 ++++++++++++++++++++ application/Utils.php | 20 -------------------- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'application') diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php index 6fb07f36..b0e94e24 100644 --- a/application/ApplicationUtils.php +++ b/application/ApplicationUtils.php @@ -5,6 +5,26 @@ class ApplicationUtils { + /** + * Checks the PHP version to ensure Shaarli can run + * + * @param string $minVersion minimum PHP required version + * @param string $curVersion current PHP version (use PHP_VERSION) + * + * @throws Exception the PHP version is not supported + */ + public static function checkPHPVersion($minVersion, $curVersion) + { + if (version_compare($curVersion, $minVersion) < 0) { + throw new Exception( + 'Your PHP version is obsolete!' + .' Shaarli requires at least PHP '.$minVersion.', and thus cannot run.' + .' Your PHP version has known security vulnerabilities and should be' + .' updated as soon as possible.' + ); + } + } + /** * Checks Shaarli has the proper access permissions to its resources * diff --git a/application/Utils.php b/application/Utils.php index 120333c5..b8579b48 100644 --- a/application/Utils.php +++ b/application/Utils.php @@ -119,26 +119,6 @@ function generateLocation($referer, $host, $loopTerms = array()) return $finalReferer; } -/** - * Checks the PHP version to ensure Shaarli can run - * - * @param string $minVersion minimum PHP required version - * @param string $curVersion current PHP version (use PHP_VERSION) - * - * @throws Exception the PHP version is not supported - */ -function checkPHPVersion($minVersion, $curVersion) -{ - if (version_compare($curVersion, $minVersion) < 0) { - throw new Exception( - 'Your PHP version is obsolete!' - .' Shaarli requires at least PHP '.$minVersion.', and thus cannot run.' - .' Your PHP version has known security vulnerabilities and should be' - .' updated as soon as possible.' - ); - } -} - /** * Validate session ID to prevent Full Path Disclosure. * -- cgit v1.2.3