diff --git a/gulliver/bin/tasks/pakeGulliver.php b/gulliver/bin/tasks/pakeGulliver.php index 57b1dfa7a..3127e8d58 100755 --- a/gulliver/bin/tasks/pakeGulliver.php +++ b/gulliver/bin/tasks/pakeGulliver.php @@ -2666,13 +2666,6 @@ function run_check_plugin_disabled_code($task, $args) if (is_dir(PATH_PLUGINS)) { if ($dirh = opendir(PATH_PLUGINS)) { - G::LoadClass("system"); - - require_once("propel" . PATH_SEP . "Propel.php"); - require_once(PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php"); - - Propel::init(PATH_CORE . "config" . PATH_SEP . "databases.php"); - $arrayData = array(); while (($file = readdir($dirh)) !== false) { @@ -2680,31 +2673,29 @@ function run_check_plugin_disabled_code($task, $args) $pluginName = str_replace(".php", "", $file); if (is_file(PATH_PLUGINS . $pluginName . ".php") && is_dir(PATH_PLUGINS . $pluginName)) { - require_once(PATH_PLUGINS . $pluginName . ".php"); + if (preg_match("/^.*class\s+" . $pluginName . "Plugin\s+extends\s+(\w*)\s*\{.*$/i", str_replace(array("\n", "\r"), array(" ", " "), file_get_contents(PATH_PLUGINS . $pluginName . ".php")), $arrayMatch)) { + $pluginParentClassName = $arrayMatch[1]; - $pluginClassName = $pluginName . "Plugin"; - - $p = new $pluginClassName(); - - switch ($option2) { - case "ENTERPRISE-PLUGIN": - if (get_parent_class($p) == "enterprisePlugin") { - $arrayData[] = $pluginName; - } - break; - case "CUSTOM-PLUGIN": - case "ALL": - case "": - if (get_parent_class($p) == "PMPlugin") { - $arrayData[] = $pluginName; - } - break; - default: - //PLUGIN-NAME - if ($pluginName == $option) { - $arrayData[] = $pluginName; - } - break; + switch ($option2) { + case "ENTERPRISE-PLUGIN": + if ($pluginParentClassName == "enterprisePlugin") { + $arrayData[] = $pluginName; + } + break; + case "CUSTOM-PLUGIN": + case "ALL": + case "": + if ($pluginParentClassName == "PMPlugin") { + $arrayData[] = $pluginName; + } + break; + default: + //PLUGIN-NAME + if ($pluginName == $option) { + $arrayData[] = $pluginName; + } + break; + } } } } diff --git a/gulliver/system/class.codeScanner.php b/gulliver/system/class.codeScanner.php index 6a81881eb..b02c7dd01 100644 --- a/gulliver/system/class.codeScanner.php +++ b/gulliver/system/class.codeScanner.php @@ -188,14 +188,16 @@ class CodeScanner if ($file != "" && $file != "." && $file != "..") { $f = $path . PATH_SEP . $file; - $arrayFoundCode = array_merge($arrayFoundCode, $this->checkDisabledCode((is_dir($f))? "PATH" : "FILE", $f)); + if (is_dir($f) || (is_file($f) && preg_match("/\.php$/", $f))) { + $arrayFoundCode = array_merge($arrayFoundCode, $this->checkDisabledCode((is_dir($f))? "PATH" : "FILE", $f)); + } } } closedir($dirh); } } else { - if (preg_match("/\.php$/", $path)) { + if (is_file($path) && preg_match("/\.php$/", $path)) { $source = file_get_contents($path); $arrayAux = $this->checkDisabledCodeInSource($source);