33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2025-01-03 22:57:21 +00:00

switch to JEDCheckerHelper::findManifests in XMLUpdateServer rule

This commit is contained in:
Denis Ryabov 2021-05-11 20:58:38 +03:00
parent 21faa210dc
commit c4c723a93c

View File

@ -15,6 +15,9 @@ defined('_JEXEC') or die('Restricted access');
// Include the rule base class // Include the rule base class
require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php';
// Include the helper class
require_once JPATH_COMPONENT_ADMINISTRATOR . '/libraries/helper.php';
/** /**
* class JedcheckerRulesXMLUpdateServer * class JedcheckerRulesXMLUpdateServer
* *
@ -53,7 +56,7 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule
public function check() public function check()
{ {
// Find all XML files of the extension // Find all XML files of the extension
$files = JFolder::files($this->basedir, '\.xml$', true, true); $files = JEDCheckerHelper::findManifests($this->basedir);
// Find XML package file // Find XML package file
$packageFile = $this->checkPackageXML($files); $packageFile = $this->checkPackageXML($files);
@ -81,15 +84,11 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule
{ {
$xml = JFactory::getXml($file); $xml = JFactory::getXml($file);
// Check if this is an XML and an extension manifest // Check if extension attribute 'type' is for a package
if ($xml && ($xml->getName() == 'install' || $xml->getName() == 'extension')) if ($xml && (string) $xml['type'] === 'package')
{ {
// Check if extension attribute 'type' is for a package $packageCount++;
if($xml->attributes()->type == 'package') $this->find($file);
{
$packageCount++;
$this->find($file);
}
} }
} }
@ -118,8 +117,7 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule
{ {
$xml = JFactory::getXml($file); $xml = JFactory::getXml($file);
// Check if this is an XML and an extension manifest if ($xml)
if ($xml && ($xml->getName() == 'install' || $xml->getName() == 'extension'))
{ {
$directories = explode('/', substr($file, 0, strrpos( $file, '/'))); $directories = explode('/', substr($file, 0, strrpos( $file, '/')));
$XMLFiles[] = array( $XMLFiles[] = array(
@ -183,13 +181,6 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule
return true; return true;
} }
// Check if this is an extension manifest
// 1.5 uses 'install', 1.6 uses 'extension'
if ($xml->getName() != 'install' && $xml->getName() != 'extension')
{
return true;
}
// Check if there is an updateservers tag // Check if there is an updateservers tag
if (!isset($xml->updateservers)) if (!isset($xml->updateservers))
{ {