36 return [self::TABLE_NAME];
52 if (isset($this->cache[$identification->serialize()])) {
53 return $this->cache[$identification->serialize()];
55 $resource = $this->
blank($identification);
57 $q =
"SELECT " . self::IDENTIFICATION .
", storage_id FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s";
58 $r = $this->db->queryF($q, [
'text'], [$identification->serialize()]);
59 $d = $this->db->fetchObject($r);
61 $resource->setStorageID(
$d->storage_id);
63 $this->cache[$identification->serialize()] = $resource;
73 if (isset($this->cache[$identification->
serialize()])) {
76 $q =
"SELECT " . self::IDENTIFICATION .
" FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s";
77 $r = $this->db->queryF($q, [
'text'], [$identification->
serialize()]);
79 return (
bool) $r->numRows() > 0;
93 self::IDENTIFICATION => [
'text', $rid],
97 self::IDENTIFICATION => [
'text', $rid],
105 self::IDENTIFICATION => [
'text', $rid],
110 $this->cache[$rid] = $resource;
119 $this->db->manipulateF(
120 "DELETE FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s",
124 unset($this->cache[$rid]);
135 public function preload(array $identification_strings) : void
137 $r = $this->db->query(
138 "SELECT rid, storage_id FROM " . self::TABLE_NAME .
" WHERE " 139 . $this->db->in(self::IDENTIFICATION, $identification_strings,
false,
'text')
141 while (
$d = $this->db->fetchAssoc($r)) {
149 $resource->setStorageID($data[
'storage_id']);
150 $this->cache[$data[
'rid']] = $resource;
Interface StorageResource.
__construct(\ilDBInterface $db)
Class ResourceDBRepository.
store(StorableResource $resource)
has(ResourceIdentification $identification)
preload(array $identification_strings)
Interface Identification.
populateFromArray(array $data)
Class StorableFileResource.
Interface ResourceRepository.
blank(ResourceIdentification $identification)
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d