/** * Gets all properties, falling back to values of the parent. * * @return array */ public function getProperties() { if (empty($this->mergedProperties)) { $this->mergedProperties = $this->propertiesOfFileReference; ArrayUtility::mergeRecursiveWithOverrule($this->mergedProperties, $this->originalFile->getProperties(), true, true, false); array_walk($this->mergedProperties, [$this, 'restoreNonNullValuesCallback']); } return $this->mergedProperties; }
/** * Fixes a bug in TYPO3 6.2.0 that the properties metadata is not overlayed on localization. * * @param File $file * @return array */ public static function getFileArray(File $file) { $properties = $file->getProperties(); $stat = $file->getStorage()->getFileInfo($file); $array = $file->toArray(); foreach ($properties as $key => $value) { $array[$key] = $value; } foreach ($stat as $key => $value) { $array[$key] = $value; } return $array; }
/** * Basic array function for the DB update * * @return array */ public function toArray() { if ($this->usesOriginalFile()) { $properties = $this->originalFile->getProperties(); unset($properties['uid']); unset($properties['pid']); unset($properties['identifier']); unset($properties['name']); // Use width + height set in processed file $properties['width'] = $this->properties['width']; $properties['height'] = $this->properties['height']; } else { $properties = $this->properties; $properties['identifier'] = $this->getIdentifier(); $properties['name'] = $this->getName(); } $properties['configuration'] = serialize($this->processingConfiguration); return array_merge($properties, array('storage' => $this->getStorage()->getUid(), 'checksum' => $this->calculateChecksum(), 'task_type' => $this->taskType, 'configurationsha1' => sha1($properties['configuration']), 'original' => $this->originalFile->getUid(), 'originalfilesha1' => $this->originalFileSha1)); }
/** * Updates an existing file object in the database * * @param \TYPO3\CMS\Core\Resource\File $modifiedObject * @return void */ public function update($modifiedObject) { // TODO check if $modifiedObject is an instance of \TYPO3\CMS\Core\Resource\File // TODO check if $modifiedObject is indexed $changedProperties = $modifiedObject->getUpdatedProperties(); $properties = $modifiedObject->getProperties(); $updateFields = array(); foreach ($changedProperties as $propertyName) { $updateFields[$propertyName] = $properties[$propertyName]; } $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_file', 'uid=' . $modifiedObject->getUid(), $updateFields); }
/** * Gets all properties. * * @return array */ public function getReferenceProperties() { return \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($this->originalFile->getProperties(), $this->propertiesOfFileReference); }