/** * Updates the index record in the database * * @param File $file * @return void */ public function update(File $file) { $updatedProperties = array_intersect($this->fields, $file->getUpdatedProperties()); $updateRow = array(); foreach ($updatedProperties as $key) { $updateRow[$key] = $file->getProperty($key); } if (count($updateRow) > 0) { $updateRow['tstamp'] = time(); $this->getDatabaseConnection()->exec_UPDATEquery($this->table, $this->getWhereClauseForFile($file), $updateRow); $this->updateRefIndex($file->getUid()); $this->emitRecordUpdatedSignal(array_intersect_key($file->getProperties(), array_flip($this->fields))); } }
/** * 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); }