Source of file VersionedFileExtension.php
Size: 1,202 Bytes - Last Modified: 2021-12-23T10:28:12+00:00
/var/www/docs.ssmods.com/process/src/src/Symbiote/ContentServiceAssets/VersionedFileExtension.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 | <?php namespace Symbiote\ContentServiceAssets; use ContentService; use DirectoryIterator; use RegexIterator; use UnexpectedValueException; /** * uploads the 'old' version of a file in private mode */ class VersionedFileExtension extends \DataExtension { private $service; private $cachedPaths; private $doUpload = true; public function __construct(ContentService $service) { $this->service = $service; parent::__construct(); } public function onAfterWrite() { parent::onAfterWrite(); if ($this->doUpload) { $this->doUpload = false; $this->owner->uploadToContentService(); } } public function getParentID() { return $this->owner->FileID; } public function Parent() { return $this->owner->File(); } public function canView() { return \Permission::check('ADMIN') || $this->owner->File()->canView(); } public function getCanViewType() { return 'OnlyTheseUsers'; } public function getViewType() { return $this->getCanViewType(); } public function getFilename() { return $this->owner->getField('Filename'); } } |