fix: fix direct message log reporting (#7908)
[openemr.git] / src / Common / Compatibility / Checker.php
blob974c0208a0c8c5a114712bfbbd2732e29fcb3781
1 <?php
3 namespace OpenEMR\Common\Compatibility;
5 /**
6 * Check if the server's PHP version is compatible with OpenEMR.
8 * Note that this will only be used within setup.php, sql_upgrade.php,
9 * sql_patch.php, acl_upgrade.php, admin.php, and globals.php.
11 * @package OpenEMR
12 * @author Matthew Vita <matthewvita48@gmail.com>
13 * @link http://www.open-emr.org
14 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 * @copyright Copyright (c) 2017 Matthew Vita
17 class Checker
19 private static $minimumPhpVersion = "8.1.0";
21 /**
22 * Checks to see if minimum PHP version is met.
24 * @return bool | warning string
26 public static function checkPhpVersion()
28 $phpCheck = self::isPhpSupported();
29 $response = "";
31 if (!$phpCheck) {
32 $response .= "PHP version needs to be at least" . " " . self::$minimumPhpVersion . ".";
33 } else {
34 $response = true;
37 return $response;
40 /**
41 * Checks to see if minimum PHP version is met.
43 * @return bool
45 private static function isPhpSupported()
47 return version_compare(phpversion(), self::$minimumPhpVersion, ">=");