2012-05-21 08:52:10 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2019-03-09 19:44:14 +00:00
|
|
|
* @package Joomla.JEDChecker
|
2012-06-23 14:18:21 +00:00
|
|
|
*
|
2019-03-10 16:09:42 +00:00
|
|
|
* @copyright Copyright (C) 2017 - 2019 Open Source Matters, Inc. All rights reserved.
|
|
|
|
* Copyright (C) 2008 - 2016 compojoom.com . All rights reserved.
|
2019-03-10 08:49:52 +00:00
|
|
|
* @author Daniel Dimitrov <daniel@compojoom.com>
|
|
|
|
*
|
2019-03-09 19:44:14 +00:00
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
2012-06-23 14:18:21 +00:00
|
|
|
*/
|
|
|
|
|
2012-06-28 07:15:14 +00:00
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
2013-11-11 09:23:05 +00:00
|
|
|
/**
|
|
|
|
* Class Com_JedcheckerInstallerScript
|
|
|
|
*
|
|
|
|
* @since 1.5
|
|
|
|
*/
|
|
|
|
class Com_JedcheckerInstallerScript
|
2012-06-28 07:15:14 +00:00
|
|
|
{
|
2013-11-11 09:23:05 +00:00
|
|
|
protected $extension = 'com_jedchecker';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function executed before the the installation
|
|
|
|
*
|
|
|
|
* @param string $type - the installation type
|
|
|
|
* @param JInstallerComponent $parent - the parent class
|
|
|
|
*/
|
|
|
|
public function preflight($type, $parent)
|
|
|
|
{
|
|
|
|
$this->parent = $parent;
|
|
|
|
|
2016-05-30 21:56:24 +00:00
|
|
|
if (version_compare(PHP_VERSION, '5.3.10', '<'))
|
2013-11-11 09:23:05 +00:00
|
|
|
{
|
|
|
|
$this->loadLanguage();
|
2019-03-09 19:44:14 +00:00
|
|
|
|
2016-05-30 21:56:24 +00:00
|
|
|
Jerror::raiseWarning(null, JText::sprintf('COM_JEDCHECKER_PHP_VERSION_INCOMPATIBLE', PHP_VERSION, '5.3.10'));
|
2013-11-11 09:23:05 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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)
|
|
|
|
{
|
|
|
|
$this->loadLanguage();
|
2012-06-28 07:15:14 +00:00
|
|
|
|
2013-11-11 09:23:05 +00:00
|
|
|
// Doing it this way in case there are other old rules to be deleted
|
|
|
|
$oldRules = array('htmlindexes');
|
2012-06-28 07:15:14 +00:00
|
|
|
|
2013-11-11 09:23:05 +00:00
|
|
|
foreach ($oldRules as $rule)
|
|
|
|
{
|
|
|
|
$rulePhpFile = JPATH_ADMINISTRATOR . '/components/' . $this->extension . '/libraries/rules/' . $rule . '.php';
|
|
|
|
$ruleIniFile = JPATH_ADMINISTRATOR . '/components/' . $this->extension . '/libraries/rules/' . $rule . '.ini';
|
2013-11-11 05:38:08 +00:00
|
|
|
|
2013-11-11 09:23:05 +00:00
|
|
|
// Remove the rule's php file
|
|
|
|
if (file_exists($rulePhpFile))
|
|
|
|
{
|
|
|
|
if (JFile::delete($rulePhpFile))
|
|
|
|
{
|
|
|
|
$msg = JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_PHP_FILE_REMOVED', $rule);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$msg = JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_PHP_FILE_NOT_REMOVED', $rule);
|
|
|
|
}
|
2013-11-10 10:15:54 +00:00
|
|
|
|
2013-11-11 09:23:05 +00:00
|
|
|
echo "<p>$msg</p>";
|
|
|
|
}
|
2013-11-10 10:15:54 +00:00
|
|
|
|
2013-11-11 09:23:05 +00:00
|
|
|
// Remove the rule's ini file
|
|
|
|
if (file_exists($ruleIniFile))
|
|
|
|
{
|
|
|
|
if (JFile::delete($ruleIniFile))
|
|
|
|
{
|
|
|
|
$msg = JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_INI_FILE_REMOVED', $rule);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$msg = JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_INI_FILE_NOT_REMOVED', $rule);
|
|
|
|
}
|
2013-11-10 10:15:54 +00:00
|
|
|
|
2013-11-11 09:23:05 +00:00
|
|
|
echo "<p>$msg</p>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-06-28 07:15:14 +00:00
|
|
|
|
2013-11-11 09:23:05 +00:00
|
|
|
/**
|
|
|
|
* Load language necessary during the installation
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|