2012-05-21 08:52:10 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2012-06-23 14:18:21 +00:00
|
|
|
* @author Daniel Dimitrov - compojoom.com
|
|
|
|
* @date: 02.06.12
|
|
|
|
*
|
|
|
|
* @copyright Copyright (C) 2008 - 2012 compojoom.com . All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE
|
|
|
|
*/
|
|
|
|
|
2012-06-28 07:15:14 +00:00
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
|
|
|
|
|
|
|
class com_jedcheckerInstallerScript
|
|
|
|
{
|
|
|
|
protected $extension = 'com_jedchecker';
|
|
|
|
|
|
|
|
function preflight( $type, $parent ) {
|
|
|
|
$this->parent = $parent;
|
2013-01-01 10:44:05 +00:00
|
|
|
if (version_compare(PHP_VERSION, '5.3.1', '<')) {
|
2012-06-28 07:15:14 +00:00
|
|
|
$this->loadLanguage();
|
|
|
|
Jerror::raiseWarning(null, JText::sprintf('COM_JEDCHECKER_PHP_VERSION_INCOMPATIBLE', PHP_VERSION, '5.3.6'));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-10 10:15:54 +00:00
|
|
|
/**
|
|
|
|
* Update cleans out any old rules.
|
|
|
|
*
|
|
|
|
* @param JInstallerComponent $parent Is the class calling this method.
|
|
|
|
*
|
|
|
|
* @return bool|null If this returns false, Joomla will abort the update and undo everything already done.
|
|
|
|
*/
|
|
|
|
public function update($parent)
|
|
|
|
{
|
|
|
|
// Doing it this way in case there are other old rules to be deleted
|
|
|
|
$oldRules = array('htmlindexes');
|
|
|
|
|
|
|
|
foreach ($oldRules as $rule)
|
|
|
|
{
|
|
|
|
$rulePhpFile = JPATH_ADMINISTRATOR . $this->extension . 'libraries/rules/' . $rule . '.php';
|
|
|
|
$ruleIniFile = JPATH_ADMINISTRATOR . $this->extension . 'libraries/rules/' . $rule . '.ini';
|
|
|
|
|
|
|
|
// Remove the rule's php file
|
2013-11-11 02:46:50 +00:00
|
|
|
if(file_exists($rulePhpFile))
|
2013-11-10 10:15:54 +00:00
|
|
|
{
|
2013-11-11 02:46:50 +00:00
|
|
|
if(JFile::delete($rulePhpFile))
|
|
|
|
{
|
|
|
|
echo JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_PHP_FILE_REMOVED', $rule);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_PHP_FILE_NOT_REMOVED', $rule);
|
|
|
|
}
|
2013-11-10 10:15:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Remove the rule's ini file
|
2013-11-11 02:46:50 +00:00
|
|
|
if(file_exists($ruleIniFile))
|
2013-11-10 10:15:54 +00:00
|
|
|
{
|
2013-11-11 02:46:50 +00:00
|
|
|
if(JFile::delete($ruleIniFile))
|
|
|
|
{
|
|
|
|
echo JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_INI_FILE_REMOVED', $rule);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_INI_FILE_NOT_REMOVED', $rule);
|
|
|
|
}
|
2013-11-10 10:15:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-06-28 07:15:14 +00:00
|
|
|
|
2013-11-11 02:46:50 +00:00
|
|
|
public function loadLanguage()
|
2012-06-28 07:15:14 +00:00
|
|
|
{
|
|
|
|
$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);
|
|
|
|
}
|
|
|
|
}
|