39 protected \ilDBInterface
$db;
67 if (isset($this->cache[$identification->serialize()])) {
68 return $this->cache[$identification->serialize()];
70 $resource = $this->
blank($identification);
72 $q =
"SELECT " . self::IDENTIFICATION .
", storage_id FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s";
73 $r = $this->db->queryF($q, [
'text'], [$identification->serialize()]);
74 $d = $this->db->fetchObject($r);
76 $resource->setStorageID(
$d->storage_id);
78 $this->cache[$identification->serialize()] = $resource;
88 if (isset($this->cache[$identification->
serialize()])) {
91 $q =
"SELECT " . self::IDENTIFICATION .
" FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s";
92 $r = $this->db->queryF($q, [
'text'], [$identification->
serialize()]);
94 return (
bool)$r->numRows() > 0;
108 self::IDENTIFICATION => [
'text', $rid],
112 self::IDENTIFICATION => [
'text', $rid],
120 self::IDENTIFICATION => [
'text', $rid],
125 $this->cache[$rid] = $resource;
134 $this->db->manipulateF(
135 "DELETE FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s",
139 unset($this->cache[$rid]);
150 public function preload(array $identification_strings): void
152 $r = $this->db->query(
153 "SELECT rid, storage_id FROM " . self::TABLE_NAME .
" WHERE "
154 . $this->db->in(self::IDENTIFICATION, $identification_strings,
false,
'text')
156 while (
$d = $this->db->fetchAssoc($r)) {
164 $resource->setStorageID(
$data[
'storage_id']);
165 $this->cache[
$data[
'rid']] = $resource;
Class ResourceIdentification.
Class ResourceDBRepository.
store(StorableResource $resource)
@inheritDoc
__construct(\ilDBInterface $db)
populateFromArray(array $data)
preload(array $identification_strings)
blank(ResourceIdentification $identification)
@inheritDoc
has(ResourceIdentification $identification)
@inheritDoc
Class StorableFileResource.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Interface ResourceRepository.
Interface StorageResource.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...