Skip to content

Commit

Permalink
PHPCS issues with tabs vs spaces.
Browse files Browse the repository at this point in the history
Change message handling for easier debug.

Signed-off-by: Craig Phillips <[email protected]>
  • Loading branch information
CraigsOverItAll committed Nov 11, 2013
1 parent d51b731 commit 98434bb
Showing 1 changed file with 44 additions and 43 deletions.
87 changes: 44 additions & 43 deletions source/administrator/components/com_jedchecker/script.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,55 +23,56 @@ function preflight( $type, $parent ) {
}
}

/**
* 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)
{
// Load our language
/**
* 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();

// Doing it this way in case there are other old rules to be deleted
$oldRules = array('htmlindexes');
// Doing it this way in case there are other old rules to be deleted
$oldRules = array('htmlindexes');

foreach ($oldRules as $rule)
{
$rulePhpFile = JPATH_ADMINISTRATOR . '/components/' . $this->extension . '/libraries/rules/' . $rule . '.php';
$ruleIniFile = JPATH_ADMINISTRATOR . '/components/' . $this->extension . '/libraries/rules/' . $rule . '.ini';
foreach ($oldRules as $rule)
{
$rulePhpFile = JPATH_ADMINISTRATOR . '/components/' . $this->extension . '/libraries/rules/' . $rule . '.php';
$ruleIniFile = JPATH_ADMINISTRATOR . '/components/' . $this->extension . '/libraries/rules/' . $rule . '.ini';

// Remove the rule's php file
if(file_exists($rulePhpFile))
{
if(JFile::delete($rulePhpFile))
{
echo '<p>' . JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_PHP_FILE_REMOVED', $rule) . '</p>';
}
else
{
echo '<p>' . JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_PHP_FILE_NOT_REMOVED', $rule) . '</p>';
}
}
// 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);
}
echo "<p>$msg</p>";
}

// Remove the rule's ini file
if(file_exists($ruleIniFile))
{
if(JFile::delete($ruleIniFile))
{
echo '<p>' . JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_INI_FILE_REMOVED', $rule) . '</p>';
}
else
{
echo '<p>' . JText::sprintf('COM_JEDCHECKER_OLD_RULE_X_INI_FILE_NOT_REMOVED', $rule) . '</p>';
}
}
}
}
// 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);
}
echo "<p>$msg</p>";
}
}
}

public function loadLanguage()
public function loadLanguage()
{
$extension = $this->extension;
$jlang = JFactory::getLanguage();
Expand Down

0 comments on commit 98434bb

Please sign in to comment.