8 namespace Fossology\Scancode\Ui;
11 use Symfony\Component\HttpFoundation\Request;
15 const SCAN_FLAG =
'-';
17 public function __construct()
19 $this->Name =
"agent_scancode";
20 $this->Title = _(
"Scancode Toolkit");
21 $this->AgentName =
"scancode";
23 parent::__construct();
33 $renderer = $GLOBALS[
'container']->get(
'twig.environment');
34 return $renderer->load(
'scancode.html.twig')->render($vars);
64 $dependencies = array();
65 $flags = $request->get(
'scancodeFlags') ?: array();
66 $unpackArgs = intval($request->get(
'scm', 0)) == 1 ?
'I' :
'';
71 if (!empty($unpackArgs)) {
72 $dependencies[] =
'agent_mimetype';
74 return parent::AgentAdd($jobId, $uploadId, $errorMsg, array_unique($dependencies) , $args);
86 foreach ($flags as $flag) {
103 if (empty($scanMode)) {
106 if (!empty($unpackArgs)) {
107 $scanMode .= $unpackArgs;
109 return self::SCAN_FLAG . $scanMode;
118 return CheckARS($uploadId, $this->AgentName,
"scancode agent",
"scancode_ars");
129 foreach ($dependencies as $dependency) {
130 if ($dependency == $agentName) {
133 if (is_array($dependency) && $agentName == $dependency[
'name']) {
146 menu_insert(
"ParmAgents::" . $this->Title, 0, $this->Name);
157 return file_exists(
"/home/" .
158 $SysConf[
'DIRECTORIES'][
'PROJECTUSER'] .
"/pythondeps/bin/scancode");
162 $scanCode =
new ScancodesAgentPlugin();
163 if ($scanCode->isScanCodeInstalled()) {
164 register_plugin($scanCode);
getScanCodeArgs($flags, $unpackArgs)
scheduleAgent($jobId, $uploadId, &$errorMsg, $request)
Schedule scancode agent.
renderContent(&$vars)
Render HTML from template.
renderFoot(&$vars)
Render footer HTML.
AgentHasResults($uploadId=0)
isAgentIncluded($dependencies, $agentName)
CheckARS($upload_pk, $AgentName, $AgentDesc, $AgentARSTableName)
Check the ARS table to see if an agent has successfully scanned an upload.