OpenEMR minimum web technologies requirements (#443)
[openemr.git] / common / compatibility / checker.php
blobe58cb86485cd232c665d4a7e7d8b6aa944b127d7
1 <?php
2 /**
3 * This class is responsible for checking if the server's PHP version is compatible with OpenEMR.
5 * Note that this will only be used within setup.php, sql_upgrade.php,
6 * sql_patch.php, acl_upgrade.php, admin.php, and globals.php.
8 * Copyright (C) 2017 Matthew Vita <matthewvita48@gmail.com>
10 * LICENSE: This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>.
21 * @package OpenEMR
22 * @author Matthew Vita <matthewvita48@gmail.com>
23 * @link http://www.open-emr.org
26 // No namespace here because this class is mostly required outside of the
27 // OpenEMR context.
29 class Checker {
30 private static $minimumPhpVersion = "5.4.0";
32 private static function xlDelegate($value) {
33 if (function_exists("xl")) {
34 return xl($value);
37 return $value;
40 /**
41 * Checks to see if minimum PHP version is met.
43 * @return bool | warning string
45 public static function checkPhpVersion() {
46 $phpCheck = self::isPhpSupported();
47 $response = "";
49 if (!$phpCheck) {
50 $response .= self::xlDelegate("PHP version needs to be at least") . " " . self::$minimumPhpVersion . ".";
51 } else {
52 $response = true;
55 return $response;
58 /**
59 * Checks to see if minimum PHP version is met.
61 * @return bool
63 private static function isPhpSupported() {
64 return version_compare(phpversion(), self::$minimumPhpVersion, ">=");