mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-11-23 21:27:35 +00:00
Clean old rules on update.
Signed-off-by: Craig Phillips <craig@craigphillips.biz>
This commit is contained in:
parent
45c766f0a0
commit
29371309ac
@ -23,6 +23,37 @@ class com_jedcheckerInstallerScript
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
if(file_exists($rulePhpFile) && JFile::delete($rulePhpFile))
|
||||
{
|
||||
echo JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_PHP_FILE_REMOVED', $rule);
|
||||
}
|
||||
|
||||
// Remove the rule's ini file
|
||||
if(file_exists($rulePhpFile) && JFile::delete($rulePhpFile))
|
||||
{
|
||||
echo JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_INI_FILE_REMOVED', $rule);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function loadLanguage()
|
||||
{
|
||||
|
@ -45,3 +45,5 @@ COM_JEDCHECKER_ERROR_GPL_NOT_FOUND="GPL or compatible license was not found"
|
||||
COM_JEDCHECKER_PH1_LICENSE_FOUND="GPL license was found"
|
||||
COM_JEDCHECKER_GPL_COMPATIBLE_LICENSE_WAS_FOUND="GPL compatible license was found"
|
||||
COM_JEDCHECKER_WARNING="Warning"
|
||||
COM_JEDCHECKER_OLD_RULE_X_PHP_FILE_REMOVED="Removed PHP file for '%1' rule."
|
||||
COM_JEDCHECKER_OLD_RULE_X_INI_FILE_REMOVED="Removed 'ini' file for '%1' rule."
|
Loading…
Reference in New Issue
Block a user