Skip to content

Commit

Permalink
Namespacing the Checker class to meet PSR-4
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdown committed May 10, 2017
1 parent e062cd4 commit 40a2490
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 24 deletions.
2 changes: 1 addition & 1 deletion acl_upgrade.php
Expand Up @@ -127,7 +127,7 @@
// Checks if the server's PHP version is compatible with OpenEMR:
require_once(dirname(__FILE__) . "/common/compatibility/Checker.php");

$response = Checker::checkPhpVersion();
$response = OpenEMR\Checker::checkPhpVersion();
if ($response !== true) {
die($response);
}
Expand Down
2 changes: 1 addition & 1 deletion admin.php
Expand Up @@ -9,7 +9,7 @@
// Checks if the server's PHP version is compatible with OpenEMR:
require_once(dirname(__FILE__) . "/common/compatibility/Checker.php");

$response = Checker::checkPhpVersion();
$response = OpenEMR\Checker::checkPhpVersion();
if ($response !== true) {
die($response);
}
Expand Down
23 changes: 5 additions & 18 deletions common/compatibility/Checker.php
@@ -1,31 +1,18 @@
<?php

namespace OpenEMR;

/**
* This class is responsible for checking if the server's PHP version is compatible with OpenEMR.
* Check if the server's PHP version is compatible with OpenEMR.
*
* Note that this will only be used within setup.php, sql_upgrade.php,
* sql_patch.php, acl_upgrade.php, admin.php, and globals.php.
*
* Copyright (C) 2017 Matthew Vita <matthewvita48@gmail.com>
*
* LICENSE: This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>.
*
* @package OpenEMR
* @author Matthew Vita <matthewvita48@gmail.com>
* @link http://www.open-emr.org
* @copyright Copyright (c) 2017 Matthew Vita
*/

// No namespace here because this class is mostly required outside of the
// OpenEMR context.

class Checker {
private static $minimumPhpVersion = "5.4.0";

Expand Down
2 changes: 2 additions & 0 deletions interface/globals.php
Expand Up @@ -3,6 +3,8 @@
// Checks if the server's PHP version is compatible with OpenEMR:
require_once(dirname(__FILE__) . "/../common/compatibility/Checker.php");

use OpenEMR\Checker;

$response = Checker::checkPhpVersion();
if ($response !== true) {
die($response);
Expand Down
2 changes: 1 addition & 1 deletion setup.php
Expand Up @@ -25,7 +25,7 @@
// Checks if the server's PHP version is compatible with OpenEMR:
require_once(dirname(__FILE__) . "/common/compatibility/Checker.php");

$response = Checker::checkPhpVersion();
$response = OpenEMR\Checker::checkPhpVersion();
if ($response !== true) {
die($response);
}
Expand Down
4 changes: 2 additions & 2 deletions sql_patch.php
Expand Up @@ -13,7 +13,7 @@
// Checks if the server's PHP version is compatible with OpenEMR:
require_once(dirname(__FILE__) . "/common/compatibility/Checker.php");

$response = Checker::checkPhpVersion();
$response = OpenEMR\Checker::checkPhpVersion();
if ($response !== true) {
die($response);
}
Expand Down Expand Up @@ -70,7 +70,7 @@
foreach ($GLOBALS_METADATA as $grpname => $grparr) {
foreach ($grparr as $fldid => $fldarr) {
list($fldname, $fldtype, $flddef, $flddesc) = $fldarr;
if ( is_array($fldtype) || (substr($fldtype, 0, 2) !== 'm_') ) {
if ( is_array($fldtype) || (substr($fldtype, 0, 2) !== 'm_') ) {
$row = sqlQuery("SELECT count(*) AS count FROM globals WHERE gl_name = '$fldid'");
if (empty($row['count'])) {
sqlStatement("INSERT INTO globals ( gl_name, gl_index, gl_value ) " .
Expand Down
2 changes: 1 addition & 1 deletion sql_upgrade.php
Expand Up @@ -13,7 +13,7 @@
// Checks if the server's PHP version is compatible with OpenEMR:
require_once(dirname(__FILE__) . "/common/compatibility/Checker.php");

$response = Checker::checkPhpVersion();
$response = OpenEMR\Checker::checkPhpVersion();
if ($response !== true) {
die($response);
}
Expand Down

0 comments on commit 40a2490

Please sign in to comment.