PM-473 "Analisis de los resultados de escaneo de las..." SOLVED

Issue:
    Despliegue de mensajes al ejecutar "./gulliver check-plugin-disabled-code"
    ----> "grep: write error: Broken pipe"
Cause:
    Este mensaje se ocasiona al llamar al metodo "getPluginVersion" de ciertos
    plugins
Solution:
    Se quita la instanciacion del objeto, y se crea nuevo script para la
    determinacion de la clase padre de un plugin
This commit is contained in:
Victor Saisa Lopez
2014-11-26 14:42:25 -04:00
parent 6b6d11d953
commit 273e7c5241
2 changed files with 26 additions and 33 deletions

View File

@@ -2666,13 +2666,6 @@ function run_check_plugin_disabled_code($task, $args)
if (is_dir(PATH_PLUGINS)) { if (is_dir(PATH_PLUGINS)) {
if ($dirh = opendir(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(); $arrayData = array();
while (($file = readdir($dirh)) !== false) { while (($file = readdir($dirh)) !== false) {
@@ -2680,31 +2673,29 @@ function run_check_plugin_disabled_code($task, $args)
$pluginName = str_replace(".php", "", $file); $pluginName = str_replace(".php", "", $file);
if (is_file(PATH_PLUGINS . $pluginName . ".php") && is_dir(PATH_PLUGINS . $pluginName)) { 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"; switch ($option2) {
case "ENTERPRISE-PLUGIN":
$p = new $pluginClassName(); if ($pluginParentClassName == "enterprisePlugin") {
$arrayData[] = $pluginName;
switch ($option2) { }
case "ENTERPRISE-PLUGIN": break;
if (get_parent_class($p) == "enterprisePlugin") { case "CUSTOM-PLUGIN":
$arrayData[] = $pluginName; case "ALL":
} case "":
break; if ($pluginParentClassName == "PMPlugin") {
case "CUSTOM-PLUGIN": $arrayData[] = $pluginName;
case "ALL": }
case "": break;
if (get_parent_class($p) == "PMPlugin") { default:
$arrayData[] = $pluginName; //PLUGIN-NAME
} if ($pluginName == $option) {
break; $arrayData[] = $pluginName;
default: }
//PLUGIN-NAME break;
if ($pluginName == $option) { }
$arrayData[] = $pluginName;
}
break;
} }
} }
} }

View File

@@ -188,14 +188,16 @@ class CodeScanner
if ($file != "" && $file != "." && $file != "..") { if ($file != "" && $file != "." && $file != "..") {
$f = $path . PATH_SEP . $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); closedir($dirh);
} }
} else { } else {
if (preg_match("/\.php$/", $path)) { if (is_file($path) && preg_match("/\.php$/", $path)) {
$source = file_get_contents($path); $source = file_get_contents($path);
$arrayAux = $this->checkDisabledCodeInSource($source); $arrayAux = $this->checkDisabledCodeInSource($source);