1 <?php declare(strict_types=1);
36 return [self::TABLE_NAME];
53 $r = $this->db->queryF(
54 "SELECT " . self::IDENTIFICATION .
" FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s AND version_number = %s",
65 if ($r->numRows() > 0) {
70 'title' => [
'text', $information->
getTitle()],
71 'mime_type' => [
'text', $information->
getMimeType()],
72 'suffix' => [
'text', $information->
getSuffix()],
73 'size' => [
'integer', $information->
getSize()],
74 'creation_date' => [
'integer', $information->
getCreationDate()->getTimestamp()],
77 self::IDENTIFICATION => [
'text', $rid],
86 self::IDENTIFICATION => [
'text', $rid],
88 'title' => [
'text', $information->
getTitle()],
89 'mime_type' => [
'text', $information->
getMimeType()],
90 'suffix' => [
'text', $information->
getSuffix()],
91 'size' => [
'integer', $information->
getSize()],
92 'creation_date' => [
'integer', $information->
getCreationDate()->getTimestamp()],
104 $rid = $revision->getIdentification()->serialize();
105 if (isset($this->cache[$rid][$revision->getVersionNumber()])) {
106 return $this->cache[$rid][$revision->getVersionNumber()];
108 $r = $this->db->queryF(
109 "SELECT * FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s AND version_number = %s",
116 $revision->getVersionNumber()
120 $d = $this->db->fetchAssoc($r);
123 $this->cache[$rid][$revision->getVersionNumber()] =
$i;
130 $rid = $revision->getIdentification()->serialize();
131 $this->db->manipulateF(
132 "DELETE FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s AND version_number = %s",
139 $revision->getVersionNumber()
142 unset($this->cache[$rid][$revision->getVersionNumber()]);
145 public function preload(array $identification_strings) : void
147 $r = $this->db->query(
148 "SELECT * FROM " . self::TABLE_NAME .
" WHERE " . $this->db->in(self::IDENTIFICATION,
149 $identification_strings,
false,
'text')
152 while (
$d = $this->db->fetchAssoc($r)) {
165 $i->setTitle((
string) $data[
'title']);
166 $i->setSize((
int) $data[
'size']);
167 $i->setMimeType((
string) $data[
'mime_type']);
168 $i->setSuffix((
string) $data[
'suffix']);
169 $i->setCreationDate((
new \
DateTimeImmutable())->setTimestamp((
int) $data[
'creation_date'] ?? 0));
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d