15 namespace Fossology\DecisionImporter\UI;
18 use Symfony\Component\HttpFoundation\File\UploadedFile;
19 use Symfony\Component\HttpFoundation\Request;
20 use UnexpectedValueException;
29 const NAME =
'agent_fodecisionimporter';
35 public function __construct()
38 $this->Title = _(
"FOSSology Dump Importer");
39 $this->AgentName =
"decisionimporter";
41 parent::__construct();
60 $additionalJqCmdArgs =
"";
62 foreach (self::KEYS as $key) {
63 if ($request->get($key) !== NULL) {
64 $additionalJqCmdArgs .=
" --" . $key .
"=" . $request->get($key);
68 return $additionalJqCmdArgs;
77 public function addReport(UploadedFile $report): string
79 if ($report->isValid()) {
80 if (!$report->isFile()) {
81 throw new UnexpectedValueException(
'Uploaded tmpfile not found');
85 $fileBase = $SysConf[
'FOSSOLOGY'][
'path'] .
"/DecisionImport/";
86 if (!is_dir($fileBase)) {
87 mkdir($fileBase, 0755,
true);
89 $targetFile = time() .
'_' . rand() .
'_' . $report->getClientOriginalName();
90 $movedFile = $report->move($fileBase, $targetFile);
91 if ($movedFile->isFile()) {
92 return '--report=' . $movedFile->getFilename();
99 register_plugin(
new FoDecisionImporter());
const NAME
Plugin mod name.
const KEYS
Additional keys used by agent.
addReport(UploadedFile $report)
setAdditionalJqCmdArgs(Request $request)