From c4c723a93c1b41491592483172ef16d46a5d1164 Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Tue, 11 May 2021 20:58:38 +0300 Subject: [PATCH] switch to JEDCheckerHelper::findManifests in XMLUpdateServer rule --- .../libraries/rules/xmlupdateserver.php | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlupdateserver.php b/administrator/components/com_jedchecker/libraries/rules/xmlupdateserver.php index c70dba1..b51dc7e 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlupdateserver.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlupdateserver.php @@ -15,6 +15,9 @@ defined('_JEXEC') or die('Restricted access'); // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; +// Include the helper class +require_once JPATH_COMPONENT_ADMINISTRATOR . '/libraries/helper.php'; + /** * class JedcheckerRulesXMLUpdateServer * @@ -53,7 +56,7 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule public function check() { // Find all XML files of the extension - $files = JFolder::files($this->basedir, '\.xml$', true, true); + $files = JEDCheckerHelper::findManifests($this->basedir); // Find XML package file $packageFile = $this->checkPackageXML($files); @@ -81,15 +84,11 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule { $xml = JFactory::getXml($file); - // Check if this is an XML and an extension manifest - if ($xml && ($xml->getName() == 'install' || $xml->getName() == 'extension')) + // Check if extension attribute 'type' is for a package + if ($xml && (string) $xml['type'] === 'package') { - // Check if extension attribute 'type' is for a package - if($xml->attributes()->type == 'package') - { - $packageCount++; - $this->find($file); - } + $packageCount++; + $this->find($file); } } @@ -118,8 +117,7 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule { $xml = JFactory::getXml($file); - // Check if this is an XML and an extension manifest - if ($xml && ($xml->getName() == 'install' || $xml->getName() == 'extension')) + if ($xml) { $directories = explode('/', substr($file, 0, strrpos( $file, '/'))); $XMLFiles[] = array( @@ -183,13 +181,6 @@ class JedcheckerRulesXMLUpdateServer extends JEDcheckerRule 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 if (!isset($xml->updateservers)) {