19 declare(strict_types=1);
51 return [self::TABLE_NAME];
73 self::IDENTIFICATION => [
'text', $rid],
74 'version_number' => [
'integer',
$version]
77 'title' => [
'text', $information->
getTitle()],
78 'mime_type' => [
'text', $information->
getMimeType()],
79 'suffix' => [
'text', $information->
getSuffix()],
80 'size' => [
'integer', $information->
getSize()],
81 'creation_date' => [
'integer', $information->
getCreationDate()->getTimestamp()]
85 $this->cache[$rid][
$version] = $information;
93 $rid = $revision->getIdentification()->serialize();
94 if (isset($this->cache[$rid][$revision->getVersionNumber()])) {
95 return $this->cache[$rid][$revision->getVersionNumber()];
97 $r = $this->db->queryF(
98 "SELECT * FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s AND version_number = %s",
105 $revision->getVersionNumber()
109 $d = $this->db->fetchAssoc(
$r);
112 $this->cache[$rid][$revision->getVersionNumber()] = $i;
119 $rid = $revision->getIdentification()->serialize();
120 $this->db->manipulateF(
121 "DELETE FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s AND version_number = %s",
128 $revision->getVersionNumber()
131 unset($this->cache[$rid][$revision->getVersionNumber()]);
134 public function preload(array $identification_strings): void
136 $r = $this->db->query(
137 "SELECT * FROM " . self::TABLE_NAME .
" WHERE " . $this->db->in(
138 self::IDENTIFICATION,
139 $identification_strings,
145 while (
$d = $this->db->fetchAssoc(
$r)) {
158 $i->setTitle((
string) $data[
'title']);
159 $i->setSize((
int) $data[
'size']);
160 $i->setMimeType((
string) $data[
'mime_type']);
161 $i->setSuffix((
string) $data[
'suffix']);
162 $i->setCreationDate((
new \
DateTimeImmutable())->setTimestamp((
int) ($data[
'creation_date'] ?? 0)));