9 namespace Fossology\Lib\Dao;
21 const SWH_STATUS_OK = 200;
22 const SWH_BAD_REQUEST = 400;
23 const SWH_NOT_FOUND = 404;
24 const SWH_RATELIMIT_EXCEED = 429;
36 $this->logger = $logger;
37 $this->uploadDao = $uploadDao;
47 $uploadTreeTableName = $this->uploadDao->getUploadtreeTableName($uploadId);
48 $stmt = __METHOD__.$uploadTreeTableName;
49 $sql =
"SELECT DISTINCT(SWH.pfile_fk) FROM $uploadTreeTableName UT
50 INNER JOIN software_heritage SWH ON SWH.pfile_fk = UT.pfile_fk
51 WHERE UT.upload_fk = $1";
52 return $this->
dbManager->getRows($sql,array($uploadId),$stmt);
64 if (!empty($this->
dbManager->insertTableRow(
'software_heritage',[
'pfile_fk' => $pfileId,
'swh_shortnames' => $licenseDetails,
'swh_status' => $status]))) {
77 $stmt = __METHOD__ .
"getSoftwareHeritageRecord";
79 "SELECT swh_shortnames, swh_status FROM software_heritage WHERE pfile_fk = $1",
80 array($pfileId), $stmt);
84 'swh_shortnames' => null
87 $img =
'<img alt="done" src="images/red.png" class="icon-small"/>';
88 if (self::SWH_STATUS_OK == $row[
'swh_status']) {
89 $img =
'<img alt="done" src="images/green.png" class="icon-small"/>';
91 return [
"license" => $row[
'swh_shortnames'],
"img" => $img];
getSoftwareHetiageRecord($pfileId)
Get a record from Software Heritage schema from the PfileId.
getSoftwareHeritagePfileFk($uploadId)
Get all the pfile_fk stored in software heritage table.
setSoftwareHeritageDetails($pfileId, $licenseDetails, $status)
Store a record of Software Heritage license info in table.
fo_dbManager * dbManager
fo_dbManager object