2 namespace TYPO3\CMS\Core\Resource;
115 $this->originalFileSha1 = $this->originalFile->getSha1();
116 $this->storage = $originalFile->
getStorage()->getProcessingFolder()->getStorage();
119 if (is_array($databaseRow)) {
122 $this->taskTypeRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Processing\TaskTypeRegistry::class);
133 $this->taskType = $this->taskType ?: $databaseRow[
'task_type'];
134 $this->processingConfiguration = $this->processingConfiguration ?: unserialize($databaseRow[
'configuration']);
136 $this->originalFileSha1 = $databaseRow[
'originalfilesha1'];
137 $this->identifier = $databaseRow[
'identifier'];
138 $this->name = $databaseRow[
'name'];
139 $this->properties = $databaseRow;
154 return $this->
getTask()->getConfigurationChecksum();
169 throw new \BadMethodCallException(
'Setting contents not possible for processed file.', 1305438528);
181 if ($this->identifier === null) {
182 throw new \RuntimeException(
'Cannot update original file!', 1350582054);
184 $processingFolder = $this->originalFile->getStorage()->getProcessingFolder();
185 $addedFile = $this->storage->updateProcessedFile($filePath, $this, $processingFolder);
188 $this->identifier = $addedFile->getIdentifier();
189 $this->originalFileSha1 = $this->originalFile->getSha1();
191 $this->deleted =
false;
192 $this->updated =
true;
216 return is_array($this->properties) && array_key_exists(
'uid', $this->properties) && $this->properties[
'uid'] > 0;
248 if ($this->name !==
$name && $this->name !==
'' && $this->
exists()) {
254 $this->identifier = $this->storage->getProcessingFolder()->getIdentifier() .
$this->name;
256 $this->updated =
true;
309 return $this->originalFile->getName();
323 if (!is_array($this->properties)) {
324 $this->properties = array();
328 $this->properties[
'uid'] = $properties[
'uid'];
332 $this->properties = array_merge($this->properties, $properties);
336 $this->properties = array_merge($this->properties, $this->storage->getFileInfo($this));
348 $properties = $this->originalFile->getProperties();
356 $properties[
'height'] = $this->properties[
'height'];
363 $properties[
'configuration'] = serialize($this->processingConfiguration);
368 'task_type' => $this->taskType,
369 'configurationsha1' => sha1(
$properties[
'configuration']),
370 'original' => $this->originalFile->getUid(),
391 $this->identifier = $this->originalFile->getIdentifier();
392 $this->updated =
true;
393 $this->originalFileSha1 = $this->originalFile->getSha1();
401 return $this->identifier == null || $this->identifier === $this->originalFile->getIdentifier();
420 public function delete($force =
false)
427 return parent::delete();
444 return $this->originalFile->getProperty($key);
446 return $this->properties[$key];
457 return $this->properties[
'uid'];
468 $fileMustBeRecreated =
false;
471 if ($this->originalFile->isMissing()) {
477 $fileMustBeRecreated =
true;
481 if (array_key_exists(
'checksum', $this->properties) && $this->
calculateChecksum() !== $this->properties[
'checksum']) {
482 $fileMustBeRecreated =
true;
487 $fileMustBeRecreated =
true;
490 if (!array_key_exists(
'uid', $this->properties)) {
491 $fileMustBeRecreated =
true;
495 if ($fileMustBeRecreated && $this->
exists()) {
498 return $fileMustBeRecreated;
529 if ($this->task == null) {
530 $this->task = $this->taskTypeRegistry->getTaskForType($this->taskType, $this, $this->processingConfiguration);
543 $name = $this->originalFile->getNameWithoutExtension();
544 $name .=
'_' . $this->originalFile->getUid();
558 if ($this->deleted) {
561 return $this->
getOriginalFile()->getPublicUrl($relativeToCurrentScript);
563 return $this->
getStorage()->getPublicUrl($this, $relativeToCurrentScript);