1 <?php declare(strict_types=1);
45 return [self::TABLE_NAME];
64 bool $keep_original =
false 91 $r = $this->db->queryF(
92 "SELECT " . self::IDENTIFICATION .
" FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s AND version_number = %s",
97 if ($r->numRows() > 0) {
102 'available' => [
'integer',
true],
103 'owner_id' => [
'integer', $revision->
getOwnerId()],
104 'title' => [
'text', $revision->
getTitle()]
107 self::IDENTIFICATION => [
'text', $rid],
116 self::IDENTIFICATION => [
'text', $rid],
118 'available' => [
'integer',
true],
119 'owner_id' => [
'integer', $revision->
getOwnerId()],
120 'title' => [
'text', $revision->
getTitle()]
134 $rid = $resource->getIdentification()->serialize();
135 if (isset($this->cache[$rid]) && is_array($this->cache[$rid])) {
136 foreach ($this->cache[$rid] as $rev) {
137 $collection->
add($rev);
141 $r = $this->db->queryF(
142 "SELECT * FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s",
146 while (
$d = $this->db->fetchObject($r)) {
148 $revision->setVersionNumber((
int)
$d->version_number);
149 $revision->setOwnerId((
int)
$d->owner_id);
150 $revision->setTitle((
string)
$d->title);
151 $collection->add($revision);
152 $this->cache[
$d->rid][(int)
$d->version_number] = $revision;
163 $rid = $revision->getIdentification()->serialize();
164 $this->db->manipulateF(
165 "DELETE FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s AND version_number = %s",
167 [$rid, $revision->getVersionNumber()]
169 unset($this->cache[$rid][$revision->getVersionNumber()]);
172 public function preload(array $identification_strings) : void
174 $r = $this->db->query(
175 "SELECT * FROM " . self::TABLE_NAME .
" WHERE " . $this->db->in(
176 self::IDENTIFICATION,
177 $identification_strings,
182 while (
$d = $this->db->fetchAssoc($r)) {
190 $revision->setVersionNumber((
int) $data[
'version_number']);
191 $revision->setOwnerId((
int) $data[
'owner_id']);
192 $revision->setTitle((
string) $data[
'revision_title']);
193 $this->cache[$data[
'rid']][(int) $data[
'version_number']] = $revision;
blankFromUpload(InfoResolver $info_resolver, StorableResource $resource, UploadResult $result)
Class RevisionARRepository.
Interface StorageResource.
Class UploadedFileRevision.
Class UploadedFileRevision.
preload(array $identification_strings)
store(Revision $revision)
Class RevisionCollection.
setVersionNumber(int $version_number)
Interface Identification.
populateFromArray(array $data)
Class RevisionDBRepository.
__construct(\ilDBInterface $db)
setVersionNumber(int $version_number)
blankFromStream(InfoResolver $info_resolver, StorableResource $resource, FileStream $stream, bool $keep_original=false)
Interface FileStream The base interface for all filesystem streams.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
blankFromClone(InfoResolver $info_resolver, StorableResource $resource, FileRevision $revision_to_clone)