25 private $searchHelperDao;
30 function __construct()
32 $this->uploadDao = $GLOBALS[
'container']->get(
'dao.upload');
33 $this->searchHelperDao = $GLOBALS[
'container']->get(
'dao.searchhelperdao');
34 $this->clearingDao = $GLOBALS[
'container']->get(
'dao.clearing');
44 $uploadTreeId = $this->uploadDao->getUploadParent($uploadId);
47 $Item = $uploadTreeId;
48 $Filename =
"LICENSES";
54 $searchtype =
"containers";
58 list($result, $count) = $this->searchHelperDao->GetResults($Item, $Filename, $uploadId, $tag, $Page, $Limit, $SizeMin, $SizeMax, $searchtype, $License, $Copyright, $this->uploadDao,
Auth::getGroupId());
63 $itemTreeBounds = $this->uploadDao->getItemTreeBounds($result[0][
'uploadtree_pk']);
64 $condition =
"(ut.lft BETWEEN $1 AND $2)";
65 $params = array($itemTreeBounds->getLeft(), $itemTreeBounds->getRight());
67 $containedItems = $this->uploadDao->getContainedItems($itemTreeBounds, $condition, $params);
68 foreach ($containedItems as $item) {
82 $uploadTreeId = $this->uploadDao->getUploadParent($uploadId);
84 $rootBounds = $this->uploadDao->getItemTreeBounds($uploadTreeId, $uploadTreeTableName);
86 $condition =
"(ut.ufile_name ilike 'LICENSE' OR ut.ufile_name ilike 'LICENSE.txt' OR ut.ufile_name ilike 'LICENSE.md' OR ut.ufile_name ilike 'LICENSE.rst')";
87 $items = $this->uploadDao->getContainedItems($rootBounds, $condition);
93 $itemTreeBounds = $this->uploadDao->getItemTreeBounds($items[0]->getId(), $uploadTreeTableName);
95 $clearedLicenses = $this->clearingDao->getClearedLicenses($itemTreeBounds,
Auth::getGroupId());
96 $licenseIds = array();
97 foreach ($clearedLicenses as $licenseRef) {
98 $licenseIds[] = $licenseRef->getShortName();
101 return array_unique($licenseIds);
111 return preg_replace(
"/(.*)\\.txt$/i",
"$1", $licenseFileName);
Contains the constants and helpers for authentication of user.
static getGroupId()
Get the current user's group id.
Detects licenses declard inside LICENSES directory.
getLicenseFileDeclaredLicenses($uploadId)
Get licenses declared in root LICENSE file.
getDeclearedLicenses($uploadId)
Get licenses decleared in LICENSES folder.
cleanLicenseId($licenseFileName)
Truncate .txt from licenseFileName.
FUNCTION char * GetUploadtreeTableName(PGconn *pgConn, int upload_pk)
Get the uploadtree table name for this upload_pk If upload_pk does not exist, return "uploadtree".
Contains business rules for FOSSology.