9 namespace Fossology\Lib\Dao;
24 const NO_LICENSE_FOUND =
'No_license_found';
25 const VOID_LICENSE =
'Void';
32 private $candidatePrefix =
'*';
34 function __construct(
DbManager $dbManager)
37 $this->logger =
new Logger(self::class);
50 $statementName = __METHOD__ .
".$uploadTreeTableName.$usageId";
52 if ($usageId==LicenseMap::TRIVIAL) {
53 $licenseJoin =
"license_ref mlr ON license_file.rf_fk = mlr.rf_pk";
57 $licenseJoin =
"($licenseMapCte) AS mlr ON license_file.rf_fk = mlr.rf_origin";
61 "SELECT LFR.rf_shortname AS license_shortname,
62 LFR.rf_spdx_id AS spdx_id,
63 LFR.rf_fullname AS license_fullname,
64 LFR.rf_pk AS license_id,
65 LFR.fl_pk AS license_file_id,
66 LFR.pfile_fk as file_id,
67 LFR.rf_match_pct AS percent_match,
68 AG.agent_name AS agent_name,
69 AG.agent_pk AS agent_id,
70 AG.agent_rev AS agent_revision
71 FROM ( SELECT mlr.rf_fullname, mlr.rf_shortname, mlr.rf_spdx_id, mlr.rf_pk, license_file.fl_pk, license_file.agent_fk, license_file.pfile_fk, license_file.rf_match_pct
72 FROM license_file JOIN $licenseJoin) as LFR
73 INNER JOIN $uploadTreeTableName as UT ON UT.pfile_fk = LFR.pfile_fk
74 INNER JOIN agent as AG ON AG.agent_pk = LFR.agent_fk
75 WHERE AG.agent_enabled='true' and
76 UT.upload_fk=$1 AND UT.lft BETWEEN $2 and $3
77 ORDER BY license_shortname ASC, percent_match DESC");
78 $result = $this->
dbManager->execute($statementName, $params);
80 while ($row = $this->
dbManager->fetchArray($result)) {
81 $licenseRef =
new LicenseRef(intval($row[
'license_id']), $row[
'license_shortname'], $row[
'license_fullname'], $row[
'spdx_id']);
82 $agentRef =
new AgentRef(intval($row[
'agent_id']), $row[
'agent_name'], $row[
'agent_revision']);
83 $matches[] =
new LicenseMatch(intval($row[
'file_id']), $licenseRef, $agentRef, intval($row[
'license_file_id']), intval($row[
'percent_match']));
100 $statementName = __METHOD__ .
".$uploadTreeTableName";
102 $this->
dbManager->prepare($statementName,
103 "SELECT LF.rf_shortname AS license_shortname,
104 LF.rf_spdx_id AS spdx_id,
105 LF.rf_fullname AS license_fullname,
106 LF.rf_pk AS license_id,
107 LFB.lrb_pk AS license_file_id,
108 LSB.removing AS removing,
109 UT.pfile_fk as file_id
110 FROM license_ref_bulk as LFB
111 INNER JOIN license_set_bulk AS LSB ON LFB.lrb_pk = LSB.lrb_fk
112 INNER JOIN license_ref as LF on LF.rf_pk = LSB.rf_fk
113 INNER JOIN $uploadTreeTableName as UT ON UT.uploadtree_pk = LFB.uploadtree_fk
114 WHERE UT.upload_fk=$1 AND UT.lft BETWEEN $2 and $3
115 ORDER BY license_file_id ASC");
117 $result = $this->
dbManager->execute($statementName,
122 while ($row = $this->
dbManager->fetchArray($result)) {
123 $licenseRef =
new LicenseRef($row[
'license_id'], $row[
'license_shortname'], $row[
'license_fullname'], $row[
'spdx_id']);
124 if ($row[
'removing'] ==
'f') {
126 $agentName =
"bulk addition";
129 $agentName =
"bulk removal";
131 $agentRef =
new AgentRef($agentID, $agentName,
"empty");
132 $matches[] =
new LicenseMatch(intval($row[
'file_id']), $licenseRef, $agentRef, intval($row[
'license_file_id']));
144 if (isset($_SESSION) && array_key_exists(
'GroupId', $_SESSION)) {
145 $rfTable =
'license_all';
146 $options = array(
'columns' => array(
'rf_pk',
'rf_shortname',
'rf_fullname'),
'candidatePrefix' => $this->candidatePrefix);
147 $licenseViewDao =
new LicenseViewProxy($_SESSION[
'GroupId'], $options, $rfTable);
148 $withCte = $licenseViewDao->asCTE();
151 $rfTable =
'ONLY license_ref';
154 $searchCondition = $search ?
"WHERE rf_shortname ilike $1" :
"";
156 $order = $orderAscending ?
"ASC" :
"DESC";
157 $statementName = __METHOD__ . ($search ?
".search_" . $search :
"") .
".order_$order";
159 $this->
dbManager->prepare($statementName,
160 $sql = $withCte .
" select rf_pk,rf_shortname,rf_spdx_id,rf_fullname from $rfTable $searchCondition order by LOWER(rf_shortname) $order");
161 $result = $this->
dbManager->execute($statementName, $search ? array(
'%' . strtolower($search) .
'%') : array());
162 $licenseRefs = array();
163 while ($row = $this->
dbManager->fetchArray($result)) {
164 $licenseRefs[] =
new LicenseRef(intval($row[
'rf_pk']), $row[
'rf_shortname'], $row[
'rf_fullname'], $row[
'rf_spdx_id']);
176 $rfTable =
'license_all';
177 $options = array(
'columns' => array(
'rf_pk',
'rf_shortname',
'rf_fullname',
'rf_active',
'rf_spdx_id'),
178 'candidatePrefix' => $this->candidatePrefix);
180 $order = $orderAscending ?
"ASC" :
"DESC";
181 $statementName = __METHOD__ .
".order_$order";
184 $sql = $licenseViewDao->asCTE().
" SELECT rf_pk,rf_shortname,rf_spdx_id,rf_fullname FROM $rfTable
185 WHERE rf_active = 'yes' AND NOT EXISTS (select * from license_map WHERE rf_pk=rf_fk AND rf_fk!=rf_parent)";
187 $param[] =
'%' . $search .
'%';
188 $statementName .=
'.search';
189 $sql .=
" AND rf_shortname ilike $1";
191 if (count($exclude)>0) {
193 $tuple = implode(
',', $exclude);
194 $statementName .=
'.exclude'.$tuple;
195 $sql .=
" AND NOT EXISTS (select * from license_map WHERE rf_pk=rf_parent AND rf_fk IN ($tuple))
196 AND rf_pk NOT IN($tuple)";
198 $this->
dbManager->prepare($statementName,
"$sql ORDER BY LOWER(rf_shortname) $order");
199 $result = $this->
dbManager->execute($statementName, $param);
200 $licenseRefs = array();
201 while ($row = $this->
dbManager->fetchArray($result)) {
202 $licenseRefs[] =
new LicenseRef(intval($row[
'rf_pk']), $row[
'rf_shortname'], $row[
'rf_fullname'], $row[
'rf_spdx_id']);
214 $statementName = __METHOD__;
215 $rfTable =
'license_all';
216 $options = array(
'columns' => array(
'rf_pk',
'rf_shortname',
'rf_fullname',
'rf_active'),
'candidatePrefix' => $this->candidatePrefix);
217 if ($groupId ===
null) {
218 $groupId = (isset($_SESSION) && array_key_exists(
'GroupId', $_SESSION)) ? $_SESSION[
'GroupId'] : 0;
221 $withCte = $licenseViewDao->asCTE();
223 $this->
dbManager->prepare($statementName,
224 $withCte .
" select rf_pk id,rf_shortname shortname,rf_fullname fullname from $rfTable WHERE rf_active = 'yes' ORDER BY LOWER(rf_shortname)");
225 $result = $this->
dbManager->execute($statementName);
226 $licenseRefs = $this->
dbManager->fetchAll($result);
242 $statementName = __METHOD__ .
'.' . $uploadTreeTableName;
243 $param = array($selectedAgentId);
245 if ($includeSubfolders) {
246 $param[] = $itemTreeBounds->
getLeft();
247 $param[] = $itemTreeBounds->
getRight();
248 $condition =
"lft BETWEEN $2 AND $3";
249 $statementName .=
".subfolders";
250 if (!empty($nameRange)) {
251 $condition .=
" AND ufile_name BETWEEN $4 and $5";
252 $param[] = $nameRange[0];
253 $param[] = $nameRange[1];
254 $statementName .=
".nameRange";
258 $condition =
"realparent = $2";
261 if (
'uploadtree_a' == $uploadTreeTableName) {
263 $condition .=
" AND utree.upload_fk=$".count($param);
266 $sql =
"SELECT utree.pfile_fk as pfile_id,
267 license_ref.rf_pk as license_id,
268 rf_match_pct as match_percentage,
269 CAST($1 AS INT) AS agent_id,
271 FROM license_file, license_ref, $uploadTreeTableName utree
273 AND license_file.rf_fk = license_ref.rf_pk
274 AND license_file.pfile_fk = utree.pfile_fk
276 ORDER BY match_percentage ASC";
278 $this->
dbManager->prepare($statementName, $sql);
279 $result = $this->
dbManager->execute($statementName, $param);
280 $licensesPerFileId = array();
281 while ($row = $this->
dbManager->fetchArray($result)) {
282 $licensesPerFileId[$row[
'pfile_id']][$row[
'license_id']] = $row;
286 return $licensesPerFileId;
299 $selectedAgentIds=
null,
300 $includeSubfolders=
true,
303 &$clearingDecisionsForLicList = array(),
304 $includeTreeId=
false)
307 $statementName = __METHOD__ .
'.' . $uploadTreeTableName;
310 $condition =
" (ufile_mode & (1<<28)) = 0";
311 if ($includeSubfolders) {
312 $param[] = $itemTreeBounds->
getLeft();
313 $param[] = $itemTreeBounds->
getRight();
314 $condition .=
" AND lft BETWEEN $1 AND $2";
315 $statementName .=
".subfolders";
318 $condition .=
" AND realparent = $1";
321 if (
'uploadtree_a' == $uploadTreeTableName) {
323 $condition .=
" AND upload_fk=$".count($param);
327 if ($selectedAgentIds !==
null) {
328 $statementName .=
".".count($selectedAgentIds).
"agents";
329 $agentSelect =
"WHERE agent_fk IS NULL";
330 foreach ($selectedAgentIds as $selectedAgentId) {
331 $param[] = $selectedAgentId;
332 $agentSelect .=
" OR agent_fk = $".count($param);
337 SELECT uploadtree_pk, ufile_name, lft, rgt, ufile_mode,
338 rf_shortname, agent_fk
340 uploadtree_pk, ufile_name,
341 lft, rgt, ufile_mode, pfile_fk
342 FROM $uploadTreeTableName
343 WHERE $condition) AS subselect1
344 LEFT JOIN (SELECT rf_shortname,pfile_fk,agent_fk
345 FROM license_file, license_ref
346 WHERE rf_fk = rf_pk) AS subselect2
347 ON subselect1.pfile_fk = subselect2.pfile_fk
352 $this->
dbManager->prepare($statementName, $sql);
353 $result = $this->
dbManager->execute($statementName, $param);
354 $licensesPerFileName = array();
356 $row = $this->
dbManager->fetchArray($result);
357 $pathStack = array($row[
'ufile_name']);
358 $rgtStack = array($row[
'rgt']);
359 $lastLft = $row[
'lft'];
360 $path = implode(
'/', $pathStack);
361 $this->addToLicensesPerFileName($licensesPerFileName, $path, $row,
362 $ignore, $clearingDecisionsForLicList, $includeTreeId);
363 while ($row = $this->
dbManager->fetchArray($result)) {
364 if (!empty($excluding) &&
false!==strpos(
"/$row[ufile_name]/", $excluding)) {
365 $lastLft = $row[
'rgt'] + 1;
368 if ($row[
'lft'] < $lastLft) {
372 $this->updateStackState($pathStack, $rgtStack, $lastLft, $row);
373 $path = implode(
'/', $pathStack);
374 $this->addToLicensesPerFileName($licensesPerFileName, $path, $row,
375 $ignore, $clearingDecisionsForLicList, $includeTreeId);
378 return array_reverse($licensesPerFileName);
381 private function updateStackState(&$pathStack, &$rgtStack, &$lastLft, $row)
383 if ($row[
'lft'] >= $lastLft) {
384 while (count($rgtStack) > 0 && $row[
'lft'] > $rgtStack[count($rgtStack)-1]) {
385 array_pop($pathStack);
386 array_pop($rgtStack);
388 if ($row[
'lft'] > $lastLft) {
389 $pathStack[] = $row[
'ufile_name'];
390 $rgtStack[] = $row[
'rgt'];
391 $lastLft = $row[
'lft'];
396 private function addToLicensesPerFileName(&$licensesPerFileName, $path, $row,
398 &$clearingDecisionsForLicList = array(),
399 $includeTreeId=
false)
401 if (($row[
'ufile_mode'] & (1 << 29)) == 0) {
402 if ($row[
'rf_shortname']) {
403 $licensesPerFileName[$path][
'scanResults'][] = $row[
'rf_shortname'];
404 if (array_key_exists($row[
'uploadtree_pk'], $clearingDecisionsForLicList)) {
405 $licensesPerFileName[$path][
'concludedResults'][] = $clearingDecisionsForLicList[$row[
'uploadtree_pk']];
408 }
else if (!$ignore) {
409 $licensesPerFileName[$path] =
false;
411 if ($includeTreeId) {
412 $licensesPerFileName[$path][
'uploadtree_pk'][] = $row[
'uploadtree_pk'];
424 $agentText = $agentId ? (is_array($agentId) ? implode(
',', $agentId) : $agentId) :
'-';
425 $statementName = __METHOD__ .
'.' . $uploadTreeTableName .
".$agentText";
427 $sql =
"SELECT rf_shortname AS license_shortname, rf_spdx_id AS spdx_id, rf_pk, count(*) AS count, count(distinct pfile_ref.pfile_fk) as \"unique\"
428 FROM ( SELECT license_ref.rf_shortname, license_ref.rf_spdx_id, license_ref.rf_pk, license_file.fl_pk, license_file.agent_fk, license_file.pfile_fk
430 JOIN license_ref ON license_file.rf_fk = license_ref.rf_pk) AS pfile_ref
431 RIGHT JOIN $uploadTreeTableName UT ON pfile_ref.pfile_fk = UT.pfile_fk";
432 if (is_array($agentId)) {
433 $sql .=
' AND agent_fk=ANY($4)';
434 $param[] =
'{' . implode(
',', $agentId) .
'}';
435 } elseif (!empty($agentId)) {
436 $sql .=
' AND agent_fk=$4';
439 $sql .=
" WHERE (rf_shortname IS NULL OR rf_shortname NOT IN ('Void')) AND upload_fk=$1
440 AND (UT.lft BETWEEN $2 AND $3) AND UT.ufile_mode&(3<<28)=0
441 GROUP BY license_shortname, spdx_id, rf_pk";
442 $this->
dbManager->prepare($statementName, $sql);
443 $result = $this->
dbManager->execute($statementName, $param);
444 $assocLicenseHist = array();
445 while ($row = $this->
dbManager->fetchArray($result)) {
446 $shortname = empty($row[
'rf_pk']) ? self::NO_LICENSE_FOUND : $row[
'license_shortname'];
447 $assocLicenseHist[$shortname] = array(
448 'count' => intval($row[
'count']),
449 'unique' => intval($row[
'unique']),
450 'rf_pk' => intval($row[
'rf_pk']),
455 return $assocLicenseHist;
458 public function getLicenseShortnamesContained(
ItemTreeBounds $itemTreeBounds, $latestSuccessfulAgentIds=
null, $filterLicenses = array(
'VOID'))
462 $noLicenseFoundStmt = empty($filterLicenses) ?
"" :
" AND rf_shortname NOT IN ("
463 . implode(
", ", array_map(
function ($name)
465 return "'" . $name .
"'";
466 }, $filterLicenses)) .
")";
468 $statementName = __METHOD__ .
'.' . $uploadTreeTableName;
471 if (is_array($latestSuccessfulAgentIds)) {
472 $agentIdSet =
"{" . implode(
',', $latestSuccessfulAgentIds) .
"}";
473 $statementName .=
".$agentIdSet";
474 $agentFilter =
" AND agent_fk=ANY('$agentIdSet')";
477 $this->
dbManager->prepare($statementName,
478 "SELECT license_ref.rf_shortname
479 FROM license_file JOIN license_ref ON license_file.rf_fk = license_ref.rf_pk
480 INNER JOIN $uploadTreeTableName uploadTree ON uploadTree.pfile_fk=license_file.pfile_fk
482 AND lft BETWEEN $2 AND $3
483 $noLicenseFoundStmt $agentFilter
484 GROUP BY rf_shortname
485 ORDER BY rf_shortname ASC");
486 $result = $this->
dbManager->execute($statementName,
490 while ($row = $this->
dbManager->fetchArray($result)) {
491 $licenses[] = $row[
'rf_shortname'];
506 $extraCondition =
"";
508 "SELECT rf_pk, rf_shortname, rf_spdx_id, rf_fullname, rf_text, rf_url, rf_risk, rf_detector_type FROM ONLY license_ref WHERE $condition",
509 $param, __METHOD__ .
".$condition.only");
510 if (
false === $row && isset($groupId)) {
511 $userId = (isset($_SESSION) && array_key_exists(
'UserId', $_SESSION)) ? $_SESSION[
'UserId'] : 0;
512 $statementName = __METHOD__ .
".$condition";
513 if (!empty($userId)) {
515 $extraCondition =
"AND group_fk IN (SELECT group_fk FROM group_user_member WHERE user_fk=$".count($param).
")";
516 $statementName .=
".userId";
518 if (is_int($groupId) && empty($userId)) {
520 $extraCondition =
"AND group_fk=$".count($param);
521 $statementName .=
".groupId";
524 "SELECT rf_pk, rf_shortname, rf_spdx_id, rf_fullname, rf_text, rf_url, rf_risk, rf_detector_type FROM license_candidate WHERE $condition $extraCondition",
525 $param, $statementName);
527 if (
false === $row) {
530 return new License(intval($row[
'rf_pk']), $row[
'rf_shortname'],
531 $row[
'rf_fullname'], $row[
'rf_risk'], $row[
'rf_text'], $row[
'rf_url'],
532 $row[
'rf_detector_type'], $row[
'rf_spdx_id']);
577 public function insertBulkLicense($userId, $groupId, $uploadTreeId, $licenseRemovals, $refText, $ignoreIrrelevant=
true, $delimiters=
null, $scanFindingsOnly=
false)
579 if (strcasecmp($delimiters,
"DEFAULT") === 0) {
581 } elseif ($delimiters !==
null) {
584 $licenseRefBulkIdResult = $this->
dbManager->getSingleRow(
585 "INSERT INTO license_ref_bulk (user_fk, group_fk, uploadtree_fk, rf_text, ignore_irrelevant, bulk_delimiters, scan_findings)
586 VALUES ($1,$2,$3,$4,$5,$6,$7) RETURNING lrb_pk",
587 array($userId, $groupId, $uploadTreeId,
589 $this->
dbManager->booleanToDb($ignoreIrrelevant),
591 $this->dbManager->booleanToDb($scanFindingsOnly)),
592 __METHOD__ .
'.getLrb'
594 if ($licenseRefBulkIdResult ===
false) {
597 $bulkId = $licenseRefBulkIdResult[
'lrb_pk'];
599 $stmt = __METHOD__ .
'.insertAction';
600 $this->
dbManager->prepare($stmt,
"INSERT INTO license_set_bulk (lrb_fk, rf_fk, removing, comment, reportinfo, acknowledgement) VALUES ($1,$2,$3,$4,$5,$6)");
601 foreach ($licenseRemovals as $licenseId=>$removing) {
602 $this->
dbManager->execute($stmt, array($bulkId, $licenseId,
603 $this->
dbManager->booleanToDb($removing[0]),
619 $licenceViewDao =
new LicenseViewProxy($groupId, array(
'columns' => array(
'rf_shortname')));
620 $sql =
'SELECT count(*) cnt FROM (' . $licenceViewDao->getDbViewQuery() .
') AS license_all WHERE rf_shortname=$1';
621 $duplicatedRef = $this->
dbManager->getSingleRow($sql, array($newShortname), __METHOD__.
".$groupId" );
622 return $duplicatedRef[
'cnt'] == 0;
634 "INSERT INTO license_ref (rf_shortname, rf_text, rf_detector_type, rf_spdx_id) VALUES ($1, $2, 2, $3) RETURNING rf_pk",
638 __METHOD__.
".addLicense" );
639 return $row[
"rf_pk"];
649 $sql =
'INSERT INTO license_candidate (group_fk,rf_shortname,rf_fullname,rf_text,rf_md5,rf_detector_type,rf_user_fk_created) VALUES ($1,$2,$2,$3,md5($3),1,$4) RETURNING rf_pk';
650 $refArray = $this->
dbManager->getSingleRow($sql, array($groupId,
653 return $refArray[
'rf_pk'];
662 $licenseRefTable = $this->
dbManager->getSingleRow(
"SELECT COUNT(*) cnt FROM license_ref WHERE rf_text!=$1", array(
"License by Nomos."));
663 return intval($licenseRefTable[
'cnt']);
676 $rfNotes, $lastmodified, $userIdmodified,
677 $readyformerge, $riskLvl, $spdxId =
null)
679 $marydone = $this->
dbManager->booleanToDb($readyformerge);
680 $sql =
'UPDATE license_candidate SET ' .
681 'rf_shortname=$2, rf_fullname=$3, rf_text=$4, rf_url=$5, rf_notes=$6, ' .
682 'rf_lastmodified=$7, rf_user_fk_modified=$8, marydone=$9, rf_risk=$10';
687 $userIdmodified, $marydone, $riskLvl);
688 $statement = __METHOD__;
689 if ($spdxId !=
null) {
691 $sql .=
', rf_spdx_id=$' . count($params);
692 $statement .=
".spdxid";
694 $sql .=
' WHERE rf_pk=$1';
695 $this->
dbManager->getSingleRow($sql, $params, $statement);
704 return $this->
getLicenseByCondition(
" rf_pk=(SELECT rf_parent FROM license_map WHERE usage=$1 AND rf_fk=$2 AND rf_fk!=rf_parent)",
705 array(LicenseMap::CONCLUSION,$licenseId), $groupId);
716 if (!empty($licenseLists)) {
719 $params[] =
'{' . implode(
',', $licenseLists) .
'}';
721 $tableName=
'obligation_candidate_map';
722 $sql =
"SELECT ob_pk, ob_topic, ob_text, ob_active, rf_fk, " .
723 "ob_type, ob_classification, ob_comment, " .
724 "rf_shortname, rf_spdx_id FROM obligation_ref " .
725 "JOIN $tableName ON $tableName.ob_fk = obligation_ref.ob_pk " .
726 "JOIN license_ref ON $tableName.rf_fk = license_ref.rf_pk " .
727 "WHERE ob_active='t' AND rf_fk = ANY($1::int[]);";
729 $tableName=
'obligation_map';
731 $sql =
"WITH conclusionmap AS (" . $conclusionmapCte .
") " .
732 "SELECT ob_pk, ob_topic, ob_text, ob_active, rf_origin AS rf_fk, " .
733 "ob_type, ob_classification, ob_comment, " .
734 "lr.rf_shortname, lr.rf_spdx_id FROM obligation_ref " .
735 "JOIN $tableName ON $tableName.ob_fk = obligation_ref.ob_pk " .
736 "JOIN conclusionmap ON $tableName.rf_fk = conclusionmap.rf_pk " .
737 "INNER JOIN license_ref lr ON conclusionmap.rf_origin = lr.rf_pk " .
738 "WHERE ob_active='t' AND rf_origin = ANY($1::int[]);";
739 $params[] = LicenseMap::CONCLUSION;
741 $statementName = __METHOD__.$tableName;
742 $this->
dbManager->prepare($statementName, $sql);
743 $result = $this->
dbManager->execute($statementName, $params);
744 $ObligationRef = $this->
dbManager->fetchAll($result);
746 return $ObligationRef;
757 $sql =
"SELECT rf_licensetype FROM license_ref WHERE rf_pk = $1;";
758 $result = $this->
dbManager->getSingleRow($sql, [$licenseId],
759 __METHOD__ .
".getLicenseType");
760 if (!empty($result)) {
761 return $result[
"rf_licensetype"];
Wrapper class for license map.
static getMappedLicenseRefView($usageExpr=' $1')
Query to get license map view along with license ref.
getLicenseByCondition($condition, $param, $groupId=null)
getLicenseType($licenseId)
getLicenseBySpdxId($licenseSpdxId, $groupId=null)
insertLicense($shortname, $refText, $spdxId=null)
getLicenseHistogram(ItemTreeBounds $itemTreeBounds, $agentId=null)
getLicenseByShortName($licenseShortname, $groupId=null)
getBulkFileLicenseMatches(ItemTreeBounds $itemTreeBounds)
get all the tried bulk recognitions for a single file or uploadtree (currently unused)
getAgentFileLicenseMatches(ItemTreeBounds $itemTreeBounds, $usageId=LicenseMap::TRIVIAL)
get all the licenses for a single file or uploadtree
getLicenseRefs($search=null, $orderAscending=true)
insertUploadLicense($newShortname, $refText, $groupId, $userId)
getLicenseParentById($licenseId, $groupId=null)
getLicenseArray($groupId=null)
insertBulkLicense($userId, $groupId, $uploadTreeId, $licenseRemovals, $refText, $ignoreIrrelevant=true, $delimiters=null, $scanFindingsOnly=false)
getConclusionLicenseRefs($groupId, $search=null, $orderAscending=true, $exclude=array())
getLicensesPerFileNameForAgentId(ItemTreeBounds $itemTreeBounds, $selectedAgentIds=null, $includeSubfolders=true, $excluding='', $ignore=false, &$clearingDecisionsForLicList=array(), $includeTreeId=false)
getLicenseIdPerPfileForAgentId(ItemTreeBounds $itemTreeBounds, $selectedAgentId, $includeSubfolders=true, $nameRange=array())
isNewLicense($newShortname, $groupId)
getLicenseObligations($licenseLists, $candidate=false)
getLicenseById($licenseId, $groupId=null)
updateCandidate($rf_pk, $shortname, $fullname, $rfText, $url, $rfNotes, $lastmodified, $userIdmodified, $readyformerge, $riskLvl, $spdxId=null)
static convertToSpdxId($shortname, $spdxId)
Given a license's shortname and spdx id, give out spdx id to use in reports.
static replaceUnicodeControlChar($input, $replace="")
fo_dbManager * dbManager
fo_dbManager object