19 declare(strict_types=1);
41 protected \ilDBInterface
$db;
53 return [self::TABLE_NAME];
75 self::IDENTIFICATION => [
'text', $rid],
76 'version_number' => [
'integer',
$version]
79 'title' => [
'text', $information->
getTitle()],
80 'mime_type' => [
'text', $information->
getMimeType()],
81 'suffix' => [
'text', $information->
getSuffix()],
82 'size' => [
'integer', $information->
getSize()],
83 'creation_date' => [
'integer', $information->
getCreationDate()->getTimestamp()]
87 $this->cache[$rid][
$version] = $information;
95 $rid = $revision->getIdentification()->serialize();
96 if (isset($this->cache[$rid][$revision->getVersionNumber()])) {
97 return $this->cache[$rid][$revision->getVersionNumber()];
99 $r = $this->db->queryF(
100 "SELECT * FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s AND version_number = %s",
107 $revision->getVersionNumber()
111 $d = $this->db->fetchAssoc(
$r);
114 $this->cache[$rid][$revision->getVersionNumber()] = $i;
121 $rid = $revision->getIdentification()->serialize();
122 $this->db->manipulateF(
123 "DELETE FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s AND version_number = %s",
130 $revision->getVersionNumber()
133 unset($this->cache[$rid][$revision->getVersionNumber()]);
136 public function preload(array $identification_strings): void
138 $r = $this->db->query(
139 "SELECT * FROM " . self::TABLE_NAME .
" WHERE " . $this->db->in(
140 self::IDENTIFICATION,
141 $identification_strings,
147 while (
$d = $this->db->fetchAssoc(
$r)) {
160 $i->setTitle((
string) $data[
'title']);
161 $i->setSize((
int) $data[
'size']);
162 $i->setMimeType((
string) $data[
'mime_type']);
163 $i->setSuffix((
string) $data[
'suffix']);
164 $i->setCreationDate((
new \
DateTimeImmutable())->setTimestamp((
int) ($data[
'creation_date'] ?? 0)));