diff options
author | VirtualTam <virtualtam@flibidi.net> | 2015-11-24 01:36:12 +0100 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2015-11-24 01:40:44 +0100 |
commit | c9cf2715f0ec10d51d881d386de9fa818f76af46 (patch) | |
tree | 013c6f7c590ed936ca7d3244e1ed89c470500df4 /application/ApplicationUtils.php | |
parent | 0def004963c62ff1edfce16272a87ba9f0c87e16 (diff) | |
download | Shaarli-c9cf2715f0ec10d51d881d386de9fa818f76af46.tar.gz Shaarli-c9cf2715f0ec10d51d881d386de9fa818f76af46.tar.zst Shaarli-c9cf2715f0ec10d51d881d386de9fa818f76af46.zip |
application: move checkPHPVersion from Utils to ApplicationUtils
Relates to #372
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'application/ApplicationUtils.php')
-rw-r--r-- | application/ApplicationUtils.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php index 6fb07f36..b0e94e24 100644 --- a/application/ApplicationUtils.php +++ b/application/ApplicationUtils.php | |||
@@ -6,6 +6,26 @@ class ApplicationUtils | |||
6 | { | 6 | { |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Checks the PHP version to ensure Shaarli can run | ||
10 | * | ||
11 | * @param string $minVersion minimum PHP required version | ||
12 | * @param string $curVersion current PHP version (use PHP_VERSION) | ||
13 | * | ||
14 | * @throws Exception the PHP version is not supported | ||
15 | */ | ||
16 | public static function checkPHPVersion($minVersion, $curVersion) | ||
17 | { | ||
18 | if (version_compare($curVersion, $minVersion) < 0) { | ||
19 | throw new Exception( | ||
20 | 'Your PHP version is obsolete!' | ||
21 | .' Shaarli requires at least PHP '.$minVersion.', and thus cannot run.' | ||
22 | .' Your PHP version has known security vulnerabilities and should be' | ||
23 | .' updated as soon as possible.' | ||
24 | ); | ||
25 | } | ||
26 | } | ||
27 | |||
28 | /** | ||
9 | * Checks Shaarli has the proper access permissions to its resources | 29 | * Checks Shaarli has the proper access permissions to its resources |
10 | * | 30 | * |
11 | * @param array $globalConfig The $GLOBALS['config'] array | 31 | * @param array $globalConfig The $GLOBALS['config'] array |