From a306cdffd92ec629d4c51ac9dd57ae00245408e2 Mon Sep 17 00:00:00 2001 From: Matthew Vita Date: Sun, 19 Feb 2017 21:19:20 -0500 Subject: [PATCH] OpenEMR minimum web technologies requirements (#443) --- acl_upgrade.php | 8 +++++ admin.php | 8 +++++ common/compatibility/checker.php | 66 ++++++++++++++++++++++++++++++++++++++++ interface/globals.php | 8 +++++ setup.php | 43 +++++++++++++++----------- sql_patch.php | 9 ++++++ sql_upgrade.php | 8 +++++ 7 files changed, 132 insertions(+), 18 deletions(-) create mode 100644 common/compatibility/checker.php diff --git a/acl_upgrade.php b/acl_upgrade.php index 472d46145..447a19000 100644 --- a/acl_upgrade.php +++ b/acl_upgrade.php @@ -108,6 +108,14 @@ * @link http://www.open-emr.org */ +// Checks if the server's PHP version is compatible with OpenEMR: +require_once(dirname(__FILE__) . "/common/compatibility/checker.php"); + +$response = Checker::checkPhpVersion(); +if ($response !== true) { + die($response); +} + $ignoreAuth = true; // no login required require_once('interface/globals.php'); diff --git a/admin.php b/admin.php index 655e0a131..93391d9eb 100644 --- a/admin.php +++ b/admin.php @@ -6,6 +6,14 @@ // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. +// Checks if the server's PHP version is compatible with OpenEMR: +require_once(dirname(__FILE__) . "/common/compatibility/checker.php"); + +$response = Checker::checkPhpVersion(); +if ($response !== true) { + die($response); +} + require_once "version.php"; // Please note that the plain sql is used over the Doctrine ORM for diff --git a/common/compatibility/checker.php b/common/compatibility/checker.php new file mode 100644 index 000000000..e58cb8648 --- /dev/null +++ b/common/compatibility/checker.php @@ -0,0 +1,66 @@ + + * + * 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 . + * + * @package OpenEMR + * @author Matthew Vita + * @link http://www.open-emr.org + */ + +// No namespace here because this class is mostly required outside of the +// OpenEMR context. + +class Checker { + private static $minimumPhpVersion = "5.4.0"; + + private static function xlDelegate($value) { + if (function_exists("xl")) { + return xl($value); + } + + return $value; + } + + /** + * Checks to see if minimum PHP version is met. + * + * @return bool | warning string + */ + public static function checkPhpVersion() { + $phpCheck = self::isPhpSupported(); + $response = ""; + + if (!$phpCheck) { + $response .= self::xlDelegate("PHP version needs to be at least") . " " . self::$minimumPhpVersion . "."; + } else { + $response = true; + } + + return $response; + } + + /** + * Checks to see if minimum PHP version is met. + * + * @return bool + */ + private static function isPhpSupported() { + return version_compare(phpversion(), self::$minimumPhpVersion, ">="); + } +} diff --git a/interface/globals.php b/interface/globals.php index 67316c553..19b58c846 100644 --- a/interface/globals.php +++ b/interface/globals.php @@ -1,5 +1,13 @@ * @author Scott Wakefield * @link http://www.open-emr.org - * + * **/ +// Checks if the server's PHP version is compatible with OpenEMR: +require_once(dirname(__FILE__) . "/common/compatibility/checker.php"); + +$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'; @@ -141,7 +149,6 @@ function cloneClicked() { OpenEMR Setup

- acl menu.
  • Reviewing /config.php is a good idea. This file contains some settings that you may want to change.
  • -
  • There's much information and many extra tools bundled within the OpenEMR installation directory. +
  • There's much information and many extra tools bundled within the OpenEMR installation directory. Please refer to openemr/Documentation. Many forms and other useful scripts can be found at openemr/contrib.
  • -
  • To ensure a consistent look and feel through out the application using - Firefox is recommended.
  • +
  • To ensure a consistent look and feel throughout the application, + Firefox and Chrome are recommended. The OpenEMR development team exclusively tests with modern versions of these browsers.
  • The OpenEMR project home page, documentation, and forums can be found at http://www.open-emr.org
  • We pursue grants to help fund the future development of OpenEMR. To apply for these grants, we need to estimate how many times this program is installed and how many practices are evaluating or using this software. It would be awesome if you would email us at president@oemr.org if you have installed this software. The more details about your plans with this software, the better, but even just sending us an email stating you just installed it is very helpful.
  • @@ -208,7 +215,7 @@ if (($config == 1) && ($state < 4)) { } else { switch ($state) { - + case 1: echo "Step $state

    \n"; echo "Now I need to know whether you want me to create the database on my own or if you have already created the database for me to use. For me to create the database, you will need to supply the MySQL root password.\n @@ -222,7 +229,7 @@ else {
    \n

    \n"; break; - + case 2: echo "Step $state

    \n"; echo "Now you need to supply the MySQL server information and path information. Detailed instructions on each item can be found in the 'INSTALL' manual file. @@ -307,7 +314,7 @@ else { echo " (Clone the source site's database instead of creating a fresh one.)\n"; echo "\n"; } - + echo "OPENEMR USER:"; echo "Initial User:(This is the login name of user that will be created for you. Limit this to one word.) Initial User Password:(This is the password for the initial user account above.) @@ -378,7 +385,7 @@ else { echo "Click Back in browser to re-enter.
    \n"; break; } - + echo "Step $state

    \n"; echo "Configuring OpenEMR...

    \n"; @@ -467,7 +474,7 @@ else { echo "OK.
    \n"; flush(); } - + // Load the database files $dump_results = $installer->load_dumpfiles(); if ( ! $dump_results ) { @@ -525,7 +532,7 @@ else { echo "OK
    \n"; flush(); } - + if ( ! empty($installer->clone_database) ) { // Database was cloned, skip ACL setup. echo "Click 'continue' for further instructions."; @@ -535,7 +542,7 @@ else { echo "\n
    Next step will install and configure access controls (php-GACL).
    \n"; $next_state = 4; } - + echo "
    \n @@ -552,7 +559,7 @@ else { case 4: echo "Step $state

    \n"; echo "Installing and Configuring Access Controls (php-GACL)...

    "; - + if ( ! $installer->install_gacl() ) { echo $installer->error_message; break; @@ -563,20 +570,20 @@ else { } echo "Gave the '$installer->iuser' user (password is '$installer->iuserpass') administrator access.

    "; - + echo "Done installing and configuring access controls (php-GACL).
    "; echo "Next step will configure PHP."; - + echo "
    \n \n \n \n -\n +\n
    \n

    \n"; break; - + case 5: echo "Step $state

    \n"; echo "Configuration of PHP...

    \n"; diff --git a/sql_patch.php b/sql_patch.php index 0d2bb6a13..2d6e788f7 100644 --- a/sql_patch.php +++ b/sql_patch.php @@ -10,6 +10,14 @@ // Its purpose is to upgrade the MySQL OpenEMR database as needed // for the new release. +// Checks if the server's PHP version is compatible with OpenEMR: +require_once(dirname(__FILE__) . "/common/compatibility/checker.php"); + +$response = Checker::checkPhpVersion(); +if ($response !== true) { + die($response); +} + // Disable PHP timeout. This will not work in safe mode. ini_set('max_execution_time', '0'); @@ -46,6 +54,7 @@ $EMRversion = trim(preg_replace('/\s*\([^)]*\)/', '', $GLOBALS['openemr_version' +

    OpenEMR getRealPatch()) ?>

    diff --git a/sql_upgrade.php b/sql_upgrade.php index ae6ce4199..4634d2702 100644 --- a/sql_upgrade.php +++ b/sql_upgrade.php @@ -10,6 +10,14 @@ // Its purpose is to upgrade the MySQL OpenEMR database as needed // for the new release. +// Checks if the server's PHP version is compatible with OpenEMR: +require_once(dirname(__FILE__) . "/common/compatibility/checker.php"); + +$response = Checker::checkPhpVersion(); +if ($response !== true) { + die($response); +} + // Disable PHP timeout. This will not work in safe mode. ini_set('max_execution_time', '0'); -- 2.11.4.GIT