HOR-1400 "Remove code scanner review for ProcessMaker plugins" SOLVED

Issue:
    Remove code scanner review for ProcessMaker plugins
Cause:
    Nuevo requerimiento de validacion
Solution:
    Se a incluido la validacion para los "Enterprise Edition Plugin"; donde se evita que el "Code Scanner" revise estos plugins
This commit is contained in:
Victor Saisa Lopez
2016-07-14 12:16:12 -04:00
parent 44756feb18
commit 61dc644bfd
5 changed files with 51 additions and 16 deletions

View File

@@ -408,11 +408,11 @@ class PMPluginRegistry
unset($this->_arrayDesignerMenu[$key]);
}
}
if(sizeof( $this->_aMenuOptionsToReplace )){
unset( $this->_aMenuOptionsToReplace );
}
if(sizeof( $this->_aImportProcessCallbackFile )){
unset( $this->_aImportProcessCallbackFile );
}
@@ -1678,14 +1678,14 @@ class PMPluginRegistry
throw $e;
}
}
/**
* Replace new options to menu
*
* @param unknown_type $namespace
*
* @param array $from
*
*
* @param array $options
*
* @return void
@@ -1701,7 +1701,7 @@ class PMPluginRegistry
$this->_aMenuOptionsToReplace[$from["section"]][$from["menuId"]][] = $options;
}
}
/**
* Return all menu Options from a specific section
*
@@ -1713,10 +1713,10 @@ class PMPluginRegistry
if(sizeof($oMenuFromPlugin)) {
if(array_key_exists($strMenuName,$oMenuFromPlugin)) {
return $oMenuFromPlugin[$strMenuName];
}
}
}
}
/**
* Register a callBackFile in the singleton
*
@@ -1739,12 +1739,12 @@ class PMPluginRegistry
if (!$found) {
$callBackFile = new importCallBack( $namespace, $callBackFile );
$this->_aImportProcessCallbackFile[] = $callBackFile;
}
}
} catch(Excepton $e) {
throw $e;
}
}
/**
* Return all callBackFiles registered
*
@@ -1814,5 +1814,25 @@ class PMPluginRegistry
}
return $plugin;
}
/**
* Checks if the plugin name is Enterprise Plugin
*
* @param string $pluginName Plugin name
* @param string $path Path to plugin
*
* @return bool Returns TRUE when plugin name is Enterprise Plugin, FALSE otherwise
*/
public function isEnterprisePlugin($pluginName, $path = null)
{
$path = (!is_null($path) && $path != '')? rtrim($path, '/\\') . PATH_SEP : PATH_PLUGINS;
$pluginFile = $pluginName . '.php';
//Return
return preg_match(
'/^.*class\s+' . $pluginName . 'Plugin\s+extends\s+(?:enterprisePlugin)\s*\{.*$/i',
str_replace(["\n", "\r", "\t"], ' ', file_get_contents($path . $pluginFile))
);
}
}