FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
UploadDao.php
1 <?php
2 /*
3 Copyright (C) 2014-2018, Siemens AG
4 Authors: Andreas Würl, Steffen Weber
5 
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 version 2 as published by the Free Software Foundation.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19 
20 namespace Fossology\Lib\Dao;
21 
30 use Monolog\Logger;
31 
32 require_once(dirname(dirname(__FILE__)) . "/common-dir.php");
33 
34 class UploadDao
35 {
36 
37  const REUSE_NONE = 0;
38  const REUSE_ENHANCED = 2;
39  const REUSE_MAIN = 4;
40  const REUSE_CONF = 16;
41 
43  private $dbManager;
45  private $logger;
47  private $permissionDao;
48 
49  public function __construct(DbManager $dbManager, Logger $logger, UploadPermissionDao $uploadPermissionDao)
50  {
51  $this->dbManager = $dbManager;
52  $this->logger = $logger;
53  $this->permissionDao = $uploadPermissionDao;
54  }
55 
56 
62  public function getUploadEntry($uploadTreeId, $uploadTreeTableName = "uploadtree")
63  {
64  $stmt = __METHOD__ . ".$uploadTreeTableName";
65  $uploadEntry = $this->dbManager->getSingleRow("SELECT * FROM $uploadTreeTableName WHERE uploadtree_pk = $1",
66  array($uploadTreeId), $stmt);
67  if ($uploadEntry) {
68  $uploadEntry['tablename'] = $uploadTreeTableName;
69  }
70  return $uploadEntry;
71  }
72 
79  public function getUploadtreeIdFromPfile($uploadFk, $pfileFk)
80  {
81  $uploadTreeTableName = $this->getUploadtreeTableName($uploadFk);
82  $stmt = __METHOD__ . ".$uploadTreeTableName";
83  $uploadEntry = $this->dbManager->getSingleRow("SELECT uploadtree_pk " .
84  "FROM $uploadTreeTableName " .
85  "WHERE upload_fk = $1 AND pfile_fk = $2",
86  array($uploadFk, $pfileFk), $stmt);
87  return intval($uploadEntry['uploadtree_pk']);
88  }
89 
94  public function getUpload($uploadId)
95  {
96  $stmt = __METHOD__;
97  $row = $this->dbManager->getSingleRow("SELECT * FROM upload WHERE upload_pk = $1",
98  array($uploadId), $stmt);
99 
100  return $row ? Upload::createFromTable($row) : null;
101  }
102 
108  public function getItemTreeBounds($itemId, $uploadTreeTableName = "uploadtree")
109  {
110  $uploadEntryData = $this->getUploadEntry($itemId, $uploadTreeTableName);
111  return $this->createItemTreeBounds($uploadEntryData, $uploadTreeTableName);
112  }
113 
119  public function getItemTreeBoundsFromUploadId($uploadTreeId, $uploadId)
120  {
121  $uploadTreeTableName = $this->getUploadtreeTableName($uploadId);
122  return $this->getItemTreeBounds($uploadTreeId, $uploadTreeTableName);
123  }
124 
131  public function getParentItemBounds($uploadId, $uploadTreeTableName = null)
132  {
133  if ($uploadTreeTableName === null) {
134  $uploadTreeTableName = $this->getUploadtreeTableName($uploadId);
135  }
136 
137  $stmt = __METHOD__ . ".$uploadTreeTableName";
138  $parameters = array();
139  $uploadCondition = $this->handleUploadIdForTable($uploadTreeTableName, $uploadId, $parameters);
140 
141  $uploadEntryData = $this->dbManager->getSingleRow("SELECT * FROM $uploadTreeTableName
142  WHERE parent IS NULL
143  $uploadCondition
144  ",
145  $parameters, $stmt);
146 
147  return $uploadEntryData ? $this->createItemTreeBounds($uploadEntryData, $uploadTreeTableName) : false;
148  }
149 
154  public function countPlainFiles(ItemTreeBounds $itemTreeBounds)
155  {
156  $uploadTreeTableName = $itemTreeBounds->getUploadTreeTableName();
157 
158  $stmt = __METHOD__ . ".$uploadTreeTableName";
159  $parameters = array($itemTreeBounds->getLeft(), $itemTreeBounds->getRight());
160  $uploadCondition = $this->handleUploadIdForTable($uploadTreeTableName, $itemTreeBounds->getUploadId(), $parameters);
161 
162  $row = $this->dbManager->getSingleRow("SELECT count(*) as count FROM $uploadTreeTableName
163  WHERE lft BETWEEN $1 AND $2
164  $uploadCondition
165  AND ((ufile_mode & (3<<28))=0)
166  AND pfile_fk != 0",
167  $parameters, $stmt);
168  $fileCount = intval($row["count"]);
169  return $fileCount;
170  }
171 
172  private function handleUploadIdForTable($uploadTreeTableName, $uploadId, &$parameters)
173  {
174  if ($uploadTreeTableName === "uploadtree" || $uploadTreeTableName === "uploadtree_a") {
175  $parameters[] = $uploadId;
176  return " AND upload_fk = $" . count($parameters) . " ";
177  } else {
178  return "";
179  }
180  }
181 
185  public function getStatusTypeMap()
186  {
187  global $container;
189  $uploadStatus = $container->get('upload_status.types');
190  return $uploadStatus->getMap();
191  }
192 
196  public function getStatus($uploadId, $groupId)
197  {
198  if ($this->isAccessible($uploadId, $groupId)) {
199  $row = $this->dbManager->getSingleRow("SELECT status_fk FROM upload_clearing WHERE upload_fk = $1", array($uploadId));
200  if (false === $row) {
201  throw new \Exception("cannot find uploadId=$uploadId");
202  }
203  return $row['status_fk'];
204  } else {
205  throw new \Exception("permission denied");
206  }
207  }
208 
217  public function getUploadtreeTableName($uploadId)
218  {
219  if (!empty($uploadId)) {
220  $statementName = __METHOD__;
221  $row = $this->dbManager->getSingleRow(
222  "SELECT uploadtree_tablename FROM upload WHERE upload_pk=$1",
223  array($uploadId),
224  $statementName
225  );
226  if (!empty($row['uploadtree_tablename'])) {
227  return $row['uploadtree_tablename'];
228  }
229  }
230  return "uploadtree";
231  }
232 
238  public function getNextItem($uploadId, $itemId, $options = null)
239  {
240  return $this->getItemByDirection($uploadId, $itemId, self::DIR_FWD, $options);
241  }
242 
248  public function getPreviousItem($uploadId, $itemId, $options = null)
249  {
250  return $this->getItemByDirection($uploadId, $itemId, self::DIR_BCK, $options);
251  }
252 
253  const DIR_FWD = 1;
254  const DIR_BCK = -1;
255  const NOT_FOUND = null;
256 
257 
264  public function getItemByDirection($uploadId, $itemId, $direction, $options)
265  {
266  $uploadTreeTableName = $this->getUploadtreeTableName($uploadId);
267  $originItem = $this->getUploadEntry($itemId, $uploadTreeTableName);
268  $originLft = $originItem['lft'];
269 
270  $options[UploadTreeProxy::OPT_ITEM_FILTER] = " AND ut.ufile_mode & (3<<28) = 0";
271  $uploadTreeViewName = 'items2care';
272 
273  if ($direction == self::DIR_FWD) {
274  $uploadTreeViewName .= 'fwd';
275  $options[UploadTreeProxy::OPT_ITEM_FILTER] .= " AND lft>$1";
276  $order = 'ASC';
277  } else {
278  $uploadTreeViewName .= 'bwd';
279  $options[UploadTreeProxy::OPT_ITEM_FILTER] .= " AND lft<$1";
280  $order = 'DESC';
281  }
282 
283  $uploadTreeView = new UploadTreeProxy($uploadId, $options, $uploadTreeTableName, $uploadTreeViewName);
284  $statementName = __METHOD__ . ".$uploadTreeViewName.";
285  $query = $uploadTreeView->getDbViewQuery()." ORDER BY lft $order";
286 
287  $newItemRow = $this->dbManager->getSingleRow("$query LIMIT 1", array($originLft), $statementName);
288  if ($newItemRow) {
289  return $this->createItem($newItemRow, $uploadTreeTableName);
290  } else {
291  return self::NOT_FOUND;
292  }
293  }
294 
295 
300  public function getUploadParent($uploadId)
301  {
302  $uploadTreeTableName = $this->getUploadtreeTableName($uploadId);
303  $statementname = __METHOD__ . $uploadTreeTableName;
304 
305  $parent = $this->dbManager->getSingleRow(
306  "SELECT uploadtree_pk
307  FROM $uploadTreeTableName
308  WHERE upload_fk=$1 AND parent IS NULL", array($uploadId), $statementname);
309  if (false === $parent) {
310  throw new \Exception("Missing upload tree parent for upload");
311  }
312  return $parent['uploadtree_pk'];
313  }
314 
315  public function getLeftAndRight($uploadtreeID, $uploadTreeTableName = "uploadtree")
316  {
317  $statementName = __METHOD__ . $uploadTreeTableName;
318  $leftRight = $this->dbManager->getSingleRow(
319  "SELECT lft,rgt FROM $uploadTreeTableName WHERE uploadtree_pk = $1",
320  array($uploadtreeID), $statementName
321  );
322 
323  return array($leftRight['lft'], $leftRight['rgt']);
324  }
325 
331  public function getContainingFileCount(ItemTreeBounds $itemTreeBounds, UploadTreeProxy $uploadTreeView)
332  {
333  $sql = "SELECT count(*) FROM " . $uploadTreeView->getDbViewName() . " WHERE lft BETWEEN $1 AND $2";
334  $result = $this->dbManager->getSingleRow($sql
335  , array($itemTreeBounds->getLeft(), $itemTreeBounds->getRight()), __METHOD__ . $uploadTreeView->asCTE());
336  $output = $result['count'];
337  return $output;
338  }
339 
346  public function getContainedItems(ItemTreeBounds $itemTreeBounds, $addCondition = "", $addParameters = array())
347  {
348  $uploadTreeTableName = $itemTreeBounds->getUploadTreeTableName();
349 
350  $statementName = __METHOD__ . ".$uploadTreeTableName";
351 
352  $view = new UploadTreeViewProxy($itemTreeBounds, array(UploadTreeViewProxy::CONDITION_PLAIN_FILES));
353 
354  $this->dbManager->prepare($statementName,
355  $view->asCTE() . " SELECT * FROM " . $view->getDbViewName() ." ut ".
356  ($addCondition ? " WHERE " . $addCondition : ''));
357  $res = $this->dbManager->execute($statementName, $addParameters);
358  $items = array();
359 
360  while ($row = $this->dbManager->fetchArray($res)) {
361  $items[] = $this->createItem($row, $uploadTreeTableName);
362  }
363  $this->dbManager->freeResult($res);
364  return $items;
365  }
366 
374  public function addReusedUpload($uploadId, $reusedUploadId, $groupId, $reusedGroupId, $reuseMode=0)
375  {
376  $this->dbManager->insertTableRow('upload_reuse',
377  array('upload_fk'=>$uploadId, 'group_fk'=> $groupId, 'reused_upload_fk'=>$reusedUploadId, 'reused_group_fk'=>$reusedGroupId,'reuse_mode'=>$reuseMode));
378  }
379 
385  public function getReusedUpload($uploadId, $groupId)
386  {
387  $statementName = __METHOD__;
388 
389  $this->dbManager->prepare($statementName,
390  "SELECT reused_upload_fk, reused_group_fk, reuse_mode FROM upload_reuse WHERE upload_fk = $1 AND group_fk=$2");
391  $res = $this->dbManager->execute($statementName, array($uploadId, $groupId));
392  $reusedPairs = $this->dbManager->fetchAll($res);
393  $this->dbManager->freeResult($res);
394  return $reusedPairs;
395  }
396 
402  protected function createItem($uploadEntry, $uploadTreeTableName)
403  {
404  $itemTreeBounds = new ItemTreeBounds(
405  intval($uploadEntry['uploadtree_pk']),
406  $uploadTreeTableName,
407  intval($uploadEntry['upload_fk']),
408  intval($uploadEntry['lft']), intval($uploadEntry['rgt']));
409 
410  $parent = $uploadEntry['parent'];
411  $item = new Item(
412  $itemTreeBounds, $parent !== null ? intval($parent) : null, intval($uploadEntry['pfile_fk']), intval($uploadEntry['ufile_mode']), $uploadEntry['ufile_name']
413  );
414  return $item;
415  }
416 
423  protected function createItemTreeBounds($uploadEntryData, $uploadTreeTableName)
424  {
425  if ($uploadEntryData === false) {
426  throw new Exception("did not find uploadTreeId in $uploadTreeTableName");
427  }
428  return new ItemTreeBounds(intval($uploadEntryData['uploadtree_pk']), $uploadTreeTableName, intval($uploadEntryData['upload_fk']), intval($uploadEntryData['lft']), intval($uploadEntryData['rgt']));
429  }
430 
436  public function countNonArtifactDescendants(ItemTreeBounds $itemTreeBounds, $isFlat=true)
437  {
438  $stmt=__METHOD__;
439  $sql = "SELECT count(*) FROM ".$itemTreeBounds->getUploadTreeTableName()." ut "
440  . "WHERE ut.upload_fk=$1";
441  $params = array($itemTreeBounds->getUploadId());
442  if (!$isFlat) {
443  $stmt = __METHOD__.'.parent';
444  $params[] = $itemTreeBounds->getItemId();
445  $sql .= " AND ut.ufile_mode & (1<<28) = 0 AND ut.realparent = $2";
446  } else {
447  $params[] = $itemTreeBounds->getLeft();
448  $params[] = $itemTreeBounds->getRight();
449  $sql .= " AND ut.ufile_mode & (3<<28) = 0 AND (ut.lft BETWEEN $2 AND $3)";
450  }
451 
452  $descendants = $this->dbManager->getSingleRow($sql,$params);
453  return $descendants['count'];
454  }
455 
456 
457  public function isAccessible($uploadId, $groupId)
458  {
459  return $this->permissionDao->isAccessible($uploadId, $groupId);
460  }
461 
462  public function isEditable($uploadId, $groupId)
463  {
464  return $this->permissionDao->isEditable($uploadId, $groupId);
465  }
466 
467  public function makeAccessibleToGroup($uploadId, $groupId, $perm=null)
468  {
469  $this->permissionDao->makeAccessibleToGroup($uploadId, $groupId, $perm);
470  }
471 
472  public function makeAccessibleToAllGroupsOf($uploadId, $userId, $perm=null)
473  {
474  $this->permissionDao->makeAccessibleToAllGroupsOf($uploadId, $userId, $perm);
475  }
476 
481  public function getUploadHashes($uploadId)
482  {
483  $pfile = $this->dbManager->getSingleRow('SELECT pfile.* FROM upload, pfile WHERE upload_pk=$1 AND pfile_fk=pfile_pk',
484  array($uploadId), __METHOD__);
485  return array('sha1'=>$pfile['pfile_sha1'],'md5'=>$pfile['pfile_md5'],'sha256'=>$pfile['pfile_sha256']);
486  }
487 
494  public function getFatItemArray($itemId,$uploadId,$uploadtreeTablename)
495  {
496  $sqlChildrenOf = "SELECT COUNT(*) FROM $uploadtreeTablename s
497  WHERE ufile_mode&(1<<28)=0 and s.upload_fk=$2 AND s.realparent=";
498  $sql="WITH RECURSIVE item_path (item_id,num_children,depth,ufile_mode,ufile_name) AS (
499  SELECT uploadtree_pk item_id, ($sqlChildrenOf $1) num_children, 0 depth, ufile_mode, ufile_name
500  FROM $uploadtreeTablename WHERE upload_fk=$2 AND uploadtree_pk=$1
501  UNION
502  SELECT uploadtree_pk item_id, ($sqlChildrenOf ut.uploadtree_pk) num_children,
503  item_path.depth+1 depth, ut.ufile_mode, item_path.ufile_name||'/'||ut.ufile_name ufile_name
504  FROM $uploadtreeTablename ut INNER JOIN item_path ON item_id=ut.realparent
505  WHERE upload_fk=$2 AND ut.ufile_mode&(1<<28)=0 AND num_children<2
506  )
507  SELECT * FROM item_path WHERE num_children!=1 OR ufile_mode&(1<<29)=0 ORDER BY depth DESC LIMIT 1";
508  return $this->dbManager->getSingleRow($sql,array($itemId, $uploadId),__METHOD__.$uploadtreeTablename);
509  }
510 
517  public function getFatItemId($itemId,$uploadId,$uploadtreeTablename)
518  {
519  $itemRow = $this->getFatItemArray($itemId,$uploadId,$uploadtreeTablename);
520  return $itemRow['item_id'];
521  }
522 
527  public function getPFileDataPerFileName(ItemTreeBounds $itemTreeBounds)
528  {
529  $uploadTreeTableName = $itemTreeBounds->getUploadTreeTableName();
530  $statementName = __METHOD__ . '.' . $uploadTreeTableName;
531  $param = array();
532 
533  $param[] = $itemTreeBounds->getLeft();
534  $param[] = $itemTreeBounds->getRight();
535  $condition = " lft BETWEEN $1 AND $2";
536  $condition .= " AND (ufile_mode & (1<<28)) = 0";
537 
538  if ('uploadtree_a' == $uploadTreeTableName) {
539  $param[] = $itemTreeBounds->getUploadId();
540  $condition .= " AND upload_fk=$".count($param);
541  }
542 
543  $sql = "
544 SELECT ufile_name, uploadtree_pk, lft, rgt, ufile_mode,
545  pfile_pk, pfile_md5, pfile_sha1, pfile_sha256
546 FROM $uploadTreeTableName
547  LEFT JOIN pfile
548  ON pfile_fk = pfile_pk
549 WHERE $condition
550 ORDER BY lft asc
551 ";
552 
553  $this->dbManager->prepare($statementName, $sql);
554  $result = $this->dbManager->execute($statementName, $param);
555  $pfilePerFileName = array();
556 
557  $row = $this->dbManager->fetchArray($result);
558  $pathStack = array($row['ufile_name']);
559  $rgtStack = array($row['rgt']);
560  $lastLft = $row['lft'];
561  $this->addToPFilePerFileName($pfilePerFileName, $pathStack, $row);
562  while ($row = $this->dbManager->fetchArray($result)) {
563  if ($row['lft'] < $lastLft) {
564  continue;
565  }
566 
567  $this->updateStackState($pathStack, $rgtStack, $lastLft, $row);
568  $this->addToPFilePerFileName($pfilePerFileName, $pathStack, $row);
569  }
570  $this->dbManager->freeResult($result);
571  return $pfilePerFileName;
572  }
573 
574  private function updateStackState(&$pathStack, &$rgtStack, &$lastLft, $row)
575  {
576  if ($row['lft'] >= $lastLft) {
577  while (count($rgtStack) > 0 && $row['lft'] > $rgtStack[count($rgtStack)-1]) {
578  array_pop($pathStack);
579  array_pop($rgtStack);
580  }
581  if ($row['lft'] > $lastLft) {
582  array_push($pathStack, $row['ufile_name']);
583  array_push($rgtStack, $row['rgt']);
584  $lastLft = $row['lft'];
585  }
586  }
587  }
588 
589  private function addToPFilePerFileName(&$pfilePerFileName, $pathStack, $row)
590  {
591  if (($row['ufile_mode'] & (1 << 29)) == 0) {
592  $path = implode($pathStack,'/');
593  $pfilePerFileName[$path]['pfile_pk'] = $row['pfile_pk'];
594  $pfilePerFileName[$path]['uploadtree_pk'] = $row['uploadtree_pk'];
595  $pfilePerFileName[$path]['md5'] = $row['pfile_md5'];
596  $pfilePerFileName[$path]['sha1'] = $row['pfile_sha1'];
597  $pfilePerFileName[$path]['sha256'] = $row['pfile_sha256'];
598  }
599  }
600 
606  public function getPFilesDataPerHashAlgo(ItemTreeBounds $itemTreeBounds, $hashAlgo="sha1")
607  {
608  $uploadTreeTableName = $itemTreeBounds->getUploadTreeTableName();
609  $statementName = __METHOD__ . '.' . $uploadTreeTableName;
610  $param = array();
611 
612  $param[] = $itemTreeBounds->getLeft();
613  $param[] = $itemTreeBounds->getRight();
614  $condition = " lft BETWEEN $1 AND $2";
615  $condition .= " AND (ufile_mode & (1<<28)) = 0";
616 
617  if ('uploadtree_a' == $uploadTreeTableName) {
618  $param[] = $itemTreeBounds->getUploadId();
619  $condition .= " AND upload_fk=$".count($param);
620  }
621  $condition .= " AND pfile_$hashAlgo IS NOT NULL";
622 
623  $sql = "
624 SELECT pfile_fk, uploadtree_pk, ufile_mode, pfile_$hashAlgo as hash
625 FROM $uploadTreeTableName
626  LEFT JOIN pfile
627  ON pfile_fk = pfile_pk
628 WHERE $condition
629 ORDER BY lft asc
630 ";
631 
632  $this->dbManager->prepare($statementName, $sql);
633  $result = $this->dbManager->execute($statementName, $param);
634 
635  $pfilePerHashAlgo = array();
636  while ($row = $this->dbManager->fetchArray($result)) {
637  if (($row['ufile_mode']&(1<<29)) == 0) {
638  $pfilePerHashAlgo[strtolower($row['hash'])][] = array('pfile_pk' => $row['pfile_fk'],
639  'uploadtree_pk' => $row['uploadtree_pk']);
640  }
641  }
642  $this->dbManager->freeResult($result);
643  return $pfilePerHashAlgo;
644  }
645 
646 
647  /* @param int $uploadId
648  * @return array
649  */
650  public function getReportInfo($uploadId)
651  {
652  $stmt = __METHOD__;
653  $sql = "SELECT * FROM report_info WHERE upload_fk = $1";
654  $row = $this->dbManager->getSingleRow($sql, array($uploadId), $stmt);
655 
656  if (empty($row)) {
657  $this->dbManager->begin();
658  $stmt = __METHOD__.'ifempty';
659  $sql = "INSERT INTO report_info (upload_fk) VALUES ($1) RETURNING *";
660  $row = $this->dbManager->getSingleRow($sql, array($uploadId), $stmt);
661  $this->dbManager->commit();
662  }
663  return $row;
664  }
665 
671  public function getUploadHashesFromPfileId($pfilePk)
672  {
673  $stmt = __METHOD__."getUploadHashesFromPfileId";
674  $sql = "SELECT * FROM pfile WHERE pfile_pk = $1";
675  $row = $this->dbManager->getSingleRow($sql, array($pfilePk), $stmt);
676 
677  return ["sha1" => $row["pfile_sha1"], "md5" => $row["pfile_md5"], "sha256" => $row["pfile_sha256"]];
678  }
679 
685  public function insertReportConfReuse($uploadId, $reusedUploadId)
686  {
687  $stmt = __METHOD__;
688  $sql = "SELECT exists(SELECT 1 FROM report_info WHERE upload_fk = $1 LIMIT 1)::int";
689  $row = $this->dbManager->getSingleRow($sql, array($reusedUploadId), $stmt);
690 
691  if ($row['exists']) {
692  $stmt = __METHOD__."CopyinsertReportConfReuse";
693  $this->dbManager->prepare($stmt,
694  "INSERT INTO report_info(
695  upload_fk, ri_ga_checkbox_selection, ri_spdx_selection,
696  ri_excluded_obligations, ri_reviewed, ri_footer, ri_report_rel,
697  ri_community, ri_component, ri_version, ri_release_date,
698  ri_sw360_link, ri_general_assesment, ri_ga_additional, ri_ga_risk)
699  SELECT $1, ri_ga_checkbox_selection, ri_spdx_selection,
700  ri_excluded_obligations, ri_reviewed, ri_footer, ri_report_rel,
701  ri_community, ri_component, ri_version, ri_release_date,
702  ri_sw360_link, ri_general_assesment, ri_ga_additional, ri_ga_risk
703  FROM report_info WHERE upload_fk = $2"
704  );
705  $this->dbManager->freeResult($this->dbManager->execute($stmt, array($uploadId, $reusedUploadId)));
706  return true;
707  }
708  return false;
709  }
710 }
711 
getUploadtreeTableName($uploadId)
Get the uploadtree table name for this upload_pk If upload_pk does not exist, return "uploadtree"...
Definition: UploadDao.php:217
getReusedUpload($uploadId, $groupId)
Definition: UploadDao.php:385
insertReportConfReuse($uploadId, $reusedUploadId)
Definition: UploadDao.php:685
countNonArtifactDescendants(ItemTreeBounds $itemTreeBounds, $isFlat=true)
Definition: UploadDao.php:436
getPFileDataPerFileName(ItemTreeBounds $itemTreeBounds)
Definition: UploadDao.php:527
getFatItemArray($itemId, $uploadId, $uploadtreeTablename)
Definition: UploadDao.php:494
getPFilesDataPerHashAlgo(ItemTreeBounds $itemTreeBounds, $hashAlgo="sha1")
Definition: UploadDao.php:606
getNextItem($uploadId, $itemId, $options=null)
Definition: UploadDao.php:238
addReusedUpload($uploadId, $reusedUploadId, $groupId, $reusedGroupId, $reuseMode=0)
Definition: UploadDao.php:374
getUploadEntry($uploadTreeId, $uploadTreeTableName="uploadtree")
Definition: UploadDao.php:62
getUploadtreeIdFromPfile($uploadFk, $pfileFk)
Definition: UploadDao.php:79
fo_dbManager * dbManager
fo_dbManager object
Definition: process.c:28
asCTE()
Common Table Expressions.
Definition: DbViewProxy.php:80
getPreviousItem($uploadId, $itemId, $options=null)
Definition: UploadDao.php:248
getItemTreeBounds($itemId, $uploadTreeTableName="uploadtree")
Definition: UploadDao.php:108
createItem($uploadEntry, $uploadTreeTableName)
Definition: UploadDao.php:402
getItemTreeBoundsFromUploadId($uploadTreeId, $uploadId)
Definition: UploadDao.php:119
Fossology exception.
Definition: Exception.php:25
createItemTreeBounds($uploadEntryData, $uploadTreeTableName)
Definition: UploadDao.php:423
getStatus($uploadId, $groupId)
unused function
Definition: UploadDao.php:196
getParentItemBounds($uploadId, $uploadTreeTableName=null)
Definition: UploadDao.php:131
getItemByDirection($uploadId, $itemId, $direction, $options)
Definition: UploadDao.php:264
countPlainFiles(ItemTreeBounds $itemTreeBounds)
Definition: UploadDao.php:154
getFatItemId($itemId, $uploadId, $uploadtreeTablename)
Definition: UploadDao.php:517
getUploadHashesFromPfileId($pfilePk)
Get Pfile hashes from the pfile id.
Definition: UploadDao.php:671