/** * Checks if a file was changed or if it's missing and updates the status accordingly * * @param array $row Meta data record array with 'uid' field * @param boolean $markMissingDeleted If set (default) a record will be marked deleted if a file is missing * @return integer New status value eg. TXDAM_status_file_changed, TXDAM_status_file_missing */ function meta_updateStatus($meta, $markMissingDeleted = true) { $status = TXDAM_status_file_ok; if (!$meta['uid']) { return false; } $filepath = tx_dam::file_absolutePath($meta); $fileInfo = tx_dam::file_compileInfo($filepath); if ($fileInfo['__exists']) { $hash = tx_dam::file_calcHash($fileInfo); if (!($fileInfo['file_mtime'] == $meta['file_mtime']) or !($hash == $meta['file_hash'])) { $status = TXDAM_status_file_changed; tx_dam_db::updateStatus($meta['uid'], $status, $fileInfo, $hash); } } else { $status = TXDAM_status_file_missing; tx_dam_db::updateStatus($meta['uid'], $status, NULL, NULL, $markMissingDeleted ? 1 : NULL); } return $status; }