19 declare(strict_types=1);
59 return [self::TABLE_NAME];
71 $revision->setVersionNumber($new_version_number);
72 $revision->setStatus($status);
82 bool $keep_original =
false 87 $revision->setVersionNumber($new_version_number);
88 $revision->setStatus($status);
101 $revision->setVersionNumber($new_version_number);
102 $revision->setStatus(RevisionStatus::PUBLISHED);
110 $r = $this->db->queryF(
111 "SELECT " . self::IDENTIFICATION .
" FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s AND version_number = %s",
116 if (
$r->numRows() > 0) {
121 'available' => [
'integer',
true],
122 'owner_id' => [
'integer', $revision->
getOwnerId()],
123 'title' => [
'text', $revision->
getTitle()],
124 'status' => [
'text', $revision->
getStatus()->value],
127 self::IDENTIFICATION => [
'text', $rid],
136 self::IDENTIFICATION => [
'text', $rid],
138 'available' => [
'integer',
true],
139 'owner_id' => [
'integer', $revision->
getOwnerId()],
140 'title' => [
'text', $revision->
getTitle()],
141 'status' => [
'text', $revision->
getStatus()->value],
155 $rid = $resource->getIdentification()->serialize();
156 if (isset($this->cache[$rid]) && is_array($this->cache[$rid])) {
157 foreach ($this->cache[$rid] as $rev) {
158 $collection->
add($rev);
162 $r = $this->db->queryF(
163 "SELECT * FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s",
167 while (
$d = $this->db->fetchObject(
$r)) {
169 $revision->setVersionNumber((
int)
$d->version_number);
170 $revision->setOwnerId((
int)
$d->owner_id);
171 $revision->setTitle((
string)
$d->title);
173 $collection->add($revision);
174 $this->cache[
$d->rid][(
int)
$d->version_number] = $revision;
185 $rid = $revision->getIdentification()->serialize();
186 $this->db->manipulateF(
187 "DELETE FROM " . self::TABLE_NAME .
" WHERE " . self::IDENTIFICATION .
" = %s AND version_number = %s",
189 [$rid, $revision->getVersionNumber()]
191 unset($this->cache[$rid][$revision->getVersionNumber()]);
194 public function preload(array $identification_strings): void
196 $r = $this->db->query(
197 "SELECT * FROM " . self::TABLE_NAME .
" WHERE " . $this->db->in(
198 self::IDENTIFICATION,
199 $identification_strings,
204 while (
$d = $this->db->fetchAssoc(
$r)) {
212 $revision->setVersionNumber((
int) $data[
'version_number']);
213 $revision->setOwnerId((
int) $data[
'owner_id']);
214 $revision->setTitle((
string) $data[
'revision_title']);
216 $this->cache[$data[
'rid']][(
int) $data[
'version_number']] = $revision;
setStorageID(string $storage_id)
Class RevisionARRepository.
Interface StorageResource.
Class UploadedFileRevision.
Class UploadedFileRevision.
preload(array $identification_strings)
blankFromStream(InfoResolver $info_resolver, StorableResource $resource, FileStream $stream, RevisionStatus $status, bool $keep_original=false)
store(Revision $revision)
Class RevisionCollection.
blankFromUpload(InfoResolver $info_resolver, StorableResource $resource, UploadResult $result, RevisionStatus $status)
Class ResourceIdentification.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
populateFromArray(array $data)
Class RevisionDBRepository.
__construct(protected \ilDBInterface $db)
The base interface for all filesystem streams.
blankFromClone(InfoResolver $info_resolver, StorableResource $resource, FileRevision $revision_to_clone)