From b11194520cb668152e31c532956ab62affb229a9 Mon Sep 17 00:00:00 2001 From: Daniel Dimitrov Date: Thu, 28 Jun 2012 09:15:14 +0200 Subject: [PATCH] adding installation check for php version --- .../components/com_jedchecker/jedchecker.xml | 1 + .../components/com_jedchecker/script.php | 31 ++++++++++++++++++- .../language/en-GB/en-GB.com_jedchecker.ini | 3 +- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/source/administrator/components/com_jedchecker/jedchecker.xml b/source/administrator/components/com_jedchecker/jedchecker.xml index 7d1462b..22767fa 100644 --- a/source/administrator/components/com_jedchecker/jedchecker.xml +++ b/source/administrator/components/com_jedchecker/jedchecker.xml @@ -10,6 +10,7 @@ http://www.gnu.org/copyleft/gpl.html GNU/GPL + script.php COM_@@COMPONENTNAMEUPPERCASE@@ diff --git a/source/administrator/components/com_jedchecker/script.php b/source/administrator/components/com_jedchecker/script.php index b5c9881..c05f6f7 100644 --- a/source/administrator/components/com_jedchecker/script.php +++ b/source/administrator/components/com_jedchecker/script.php @@ -7,4 +7,33 @@ * @license GNU General Public License version 2 or later; see LICENSE */ -defined('_JEXEC') or die('Restricted access'); \ No newline at end of file +defined('_JEXEC') or die('Restricted access'); + + +class com_jedcheckerInstallerScript +{ + protected $extension = 'com_jedchecker'; + + function preflight( $type, $parent ) { + $this->parent = $parent; + if (version_compare(PHP_VERSION, '5.5.6', '<')) { + $this->loadLanguage(); + Jerror::raiseWarning(null, JText::sprintf('COM_JEDCHECKER_PHP_VERSION_INCOMPATIBLE', PHP_VERSION, '5.3.6')); + return false; + } + } + + + public function loadLanguage() + { + $extension = $this->extension; + $jlang =& JFactory::getLanguage(); + $path = $this->parent->getParent()->getPath('source') . '/administrator'; + $jlang->load($extension, $path, 'en-GB', true); + $jlang->load($extension, $path, $jlang->getDefault(), true); + $jlang->load($extension, $path, null, true); + $jlang->load($extension . '.sys', $path, 'en-GB', true); + $jlang->load($extension . '.sys', $path, $jlang->getDefault(), true); + $jlang->load($extension . '.sys', $path, null, true); + } +} \ No newline at end of file diff --git a/source/administrator/language/en-GB/en-GB.com_jedchecker.ini b/source/administrator/language/en-GB/en-GB.com_jedchecker.ini index fcd3aee..9c340b6 100644 --- a/source/administrator/language/en-GB/en-GB.com_jedchecker.ini +++ b/source/administrator/language/en-GB/en-GB.com_jedchecker.ini @@ -24,5 +24,4 @@ COM_JEDCHECKER_RULE_PH3="Rule PH3 - License tag missing or incorrect in XML inst COM_JEDCHECKER_RULE_PH3_DESC="An install file should include the license information in a license-tag. The license must be GPL or GPL compatible." COM_JEDCHECKER_EVERYTHING_SEEMS_TO_BE_FINE_WITH_THAT_RULE="Congrats! Everything seems to be fine with that rule!" COM_JEDCHECKER_DEVELOPED_BY="JEDchecker is primary developed by compojoom.com" - - +COM_JEDCHECKER_PHP_VERSION_INCOMPATIBLE="JEDchecker is incompatible with the PHP version that you run on this site: %s. You would need at least PHP Version %s. Aborting installation"