37 $this->logger = $DIC->logger()->meta();
50 $obj_ids = $this->
filter($obj_ids);
51 $num = $this->
harvest($obj_ids);
53 $message =
'Created ' . $num .
' new objects. <br />';
57 $message .=
'Deleted ' . $deleted .
' deprecated objects.';
59 if (!$deleted && !$num) {
64 $this->cronresult->setMessage(
$message);
68 $this->cronresult->setMessage($e->getMessage());
79 $collectable_types = $this->
settings->getHarvestingTypes();
80 $copyright_ids = $this->
settings->getCopyRightTemplatesInLomFormat();
87 $this->logger->debug(
'Found ' . count($collectable_types) .
' collectable objects.');
90 return $collectable_obj_ids;
96 protected function filter($a_collectable_obj_ids)
100 $tree = $DIC->repositoryTree();
103 foreach ($a_collectable_obj_ids as $obj_id) {
105 if ($status->isCreated()) {
106 $this->logger->debug(
'Object already created: ' . $obj_id);
109 if ($status->isBlocked()) {
110 $this->logger->debug(
'Object creation is blocked: ' . $obj_id);
116 if (!
$tree->isDeleted($ref_id)) {
121 $this->logger->notice(
'Ignoring deleted object: ' . $obj_id);
124 $filtered[] = $obj_id;
127 $this->logger->debug(
'Result after filtering.');
137 protected function harvest($a_collectable_obj_ids)
140 foreach ($a_collectable_obj_ids as $obj_id) {
142 $ref_id = end($ref_ids);
147 $this->logger->warning(
'Found invalid reference: ' . $ref_id);
149 $this->logger->debug(
'Creating new reference for object: ' . $obj_id);
162 $this->logger->debug(
'Create new reference');
164 $this->logger->debug(
'Put in tree');
166 $this->logger->debug(
'Set pernissions');
169 $this->logger->debug(
'Set status');
172 $status->setBlocked(
false);
186 $this->logger->warning(
'Found invalid reference: ' . $a_ref_id);
189 $this->logger->debug(
'Deleting reference...');
210 if ($status->isBlocked()) {
211 $this->logger->debug(
'Deleting blocked object ressource.');
219 foreach ($this->
settings->getCopyRightTemplatesInLomFormat() as $cp) {
220 if (strcmp($copyright, $cp) === 0) {
226 $this->logger->debug(
'Deleting deprecated object with ref_id: ' . $ref_id);
setHarvestRefId($a_ref_id)
deleteDeprecated()
Delete deprecated.
harvest($a_collectable_obj_ids)
Cron job for definition for oer harvesting.
static _getAllReferences($a_id)
get all reference ids of object
createReference()
creates reference for object
collect()
Collect all obj_ids with copyright settings which are collectable.
static _lookupDescription($a_rbac_id, $a_obj_id)
Lookup description (copyright)
catch(Exception $e) $message
getId()
get object id public
static _lookupObjId($a_id)
__construct(ilCronJobResult $result)
ilOerHarvester constructor.
filter($a_collectable_obj_ids)
static lookupObjIdByHarvestingId($a_href_id)
OER harvester object status.
putInTree($a_parent_ref)
maybe this method should be in tree object!?
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
harvestObject(ilObject $object)
Harvest object.
Cron job result data container.
static lookupRightsByTypeAndCopyright(array $a_types, array $a_copyright)
setPermissions($a_parent_ref)
set permissions of object
deleteObject($a_ref_id)
Delete object.