Skip to content

Commit

Permalink
make php version checker more robust (openemr#2303)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradymiller committed Mar 21, 2019
1 parent 7f78134 commit 5a1188d
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 35 deletions.
7 changes: 2 additions & 5 deletions acl_upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,9 @@

// Checks if the server's PHP version is compatible with OpenEMR:
require_once(dirname(__FILE__) . "/common/compatibility/Checker.php");

use OpenEMR\Common\Checker;

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

$ignoreAuth = true; // no login required
Expand Down
11 changes: 4 additions & 7 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@
*/
// Checks if the server's PHP version is compatible with OpenEMR:
require_once(dirname(__FILE__) . "/common/compatibility/Checker.php");

use OpenEMR\Common\Checker;

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

require_once "version.php";
Expand Down Expand Up @@ -95,7 +92,7 @@ function sqlQuery($statement, $link)
</div>
</div>
</div>

<div class="row">
<div class="col-sm-12">
<table class='table table-striped'>
Expand Down Expand Up @@ -232,7 +229,7 @@ function sqlQuery($statement, $link)
</div>
<div class="modal-body" style="height:80%;">
<iframe src="" id="targetiframe" style="height:100%; width:100%; overflow-x: hidden; border:none"
allowtransparency="true"></iframe>
allowtransparency="true"></iframe>
</div>
<div class="modal-footer" style="margin-top:0px;">
<button class="btn btn-link btn-cancel oe-pull-away" data-dismiss="modal" type="button">Close</button>
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
],
"autoload" : {
"exclude-from-classmap" : [
"common/compatibility/Checker.php",
"library/classes/ClinicalTypes/",
"library/classes/rulesets/",
"library/classes/smtp/",
Expand Down
10 changes: 4 additions & 6 deletions interface/globals.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@

// Checks if the server's PHP version is compatible with OpenEMR:
require_once(dirname(__FILE__) . "/../common/compatibility/Checker.php");
$response = OpenEMR\Common\Checker::checkPhpVersion();
if ($response !== true) {
die(htmlspecialchars($response));
}

use OpenEMR\Common\Checker;
use OpenEMR\Core\Kernel;
use Dotenv\Dotenv;

$response = Checker::checkPhpVersion();
if ($response !== true) {
die($response);
}

// Throw error if the php openssl module is not installed.
if (!(extension_loaded('openssl'))) {
error_log("OPENEMR ERROR: OpenEMR is not working since the php openssl module is not installed.", 0);
Expand Down
15 changes: 8 additions & 7 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
* @copyright Copyright (c) 2019 Ranganath Pathak <[email protected]>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/

// Checks if the server's PHP version is compatible with OpenEMR:
require_once(dirname(__FILE__) . "/common/compatibility/Checker.php");
$response = OpenEMR\Common\Checker::checkPhpVersion();
if ($response !== true) {
die(htmlspecialchars($response));
}

// Set the maximum excution time and time limit to unlimited.
ini_set('max_execution_time', 0);
ini_set('display_errors', 0);
Expand Down Expand Up @@ -86,13 +94,6 @@ function recursive_writable_directory_test($dir)
// Bring in standard libraries/classes
require_once dirname(__FILE__) ."/vendor/autoload.php";

use OpenEMR\Common\Checker;

$response = Checker::checkPhpVersion();
if ($response !== true) {
die($response);
}

$COMMAND_LINE = php_sapi_name() == 'cli';
require_once(dirname(__FILE__) . '/library/authentication/password_hashing.php');
require_once dirname(__FILE__) . '/library/classes/Installer.class.php';
Expand Down
7 changes: 2 additions & 5 deletions sql_patch.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@

// Checks if the server's PHP version is compatible with OpenEMR:
require_once(dirname(__FILE__) . "/common/compatibility/Checker.php");

use OpenEMR\Common\Checker;

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

// Disable PHP timeout. This will not work in safe mode.
Expand Down
7 changes: 2 additions & 5 deletions sql_upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@

// Checks if the server's PHP version is compatible with OpenEMR:
require_once(dirname(__FILE__) . "/common/compatibility/Checker.php");

use OpenEMR\Common\Checker;

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

// Disable PHP timeout. This will not work in safe mode.
Expand Down

0 comments on commit 5a1188d

Please sign in to comment.