32 const SWH_STATUS_OK = 200;
33 const SWH_BAD_REQUEST = 400;
34 const SWH_NOT_FOUND = 404;
35 const SWH_RATELIMIT_EXCEED = 429;
47 $this->logger = $logger;
48 $this->uploadDao = $uploadDao;
58 $uploadTreeTableName = $this->uploadDao->getUploadtreeTableName($uploadId);
59 $stmt = __METHOD__.$uploadTreeTableName;
60 $sql =
"SELECT DISTINCT(SWH.pfile_fk) FROM $uploadTreeTableName UT 61 INNER JOIN software_heritage SWH ON SWH.pfile_fk = UT.pfile_fk 62 WHERE UT.upload_fk = $1";
63 return $this->
dbManager->getRows($sql,array($uploadId),$stmt);
75 if (!empty($this->
dbManager->insertTableRow(
'software_heritage',[
'pfile_fk' => $pfileId,
'swh_shortnames' => $licenseDetails,
'swh_status' => $status]))) {
88 $stmt = __METHOD__.
"getSoftwareHeritageRecord";
89 $row = $this->
dbManager->getSingleRow(
"SELECT swh_shortnames, swh_status FROM software_heritage WHERE pfile_fk = $1",
90 array($pfileId), $stmt);
91 $img =
'<img alt="done" src="images/red.png" class="icon-small"/>';
92 if (self::SWH_STATUS_OK == $row[
'swh_status']) {
93 $img =
'<img alt="done" src="images/green.png" class="icon-small"/>';
95 return [
"license" => $row[
'swh_shortnames'],
"img" => $img];
setSoftwareHeritageDetails($pfileId, $licenseDetails, $status)
Store a record of Software Heritage license info in table.
getSoftwareHetiageRecord($pfileId)
Get a record from Software Heritage schema from the PfileId.
fo_dbManager * dbManager
fo_dbManager object
getSoftwareHeritagePfileFk($uploadId)
Get all the pfile_fk stored in software heritage table.