/** * Uses a secondary database connection to check outside the transaction scope * if a file has been generated during the current process execution * @param string $filePath * @param int $expiry * @param int $curtime * @param int $ttl * @param string $fname * @return bool false if the file exists and is not expired, true otherwise */ function _verifyExclusiveLock($filePath, $expiry, $curtime, $ttl, $fname = false) { // we need to create a new backend connection in order to be outside the // current transaction scope if ($this->backendVerify === null) { $backendclass = get_class($this); $this->backendVerify = new $backendclass($filePath); $this->backendVerify->_connect(true); } // we then check the file metadata in this scope to see if it was created // in between $metaData = $this->backendVerify->_fetchMetadata($filePath); if ($metaData !== false) { if (!eZDBFileHandler::isFileExpired($filePath, $metaData['mtime'], max($curtime, $expiry), $curtime, $ttl)) { eZDebugSetting::writeDebug('kernel-clustering', "DBFile '{$filePath}' is valid and not expired", __METHOD__); return false; } } return true; }
/** * Move/rename file to $dstPath * @param string $dstPath Destination path */ function move($dstPath) { $dstPath = eZDBFileHandler::cleanPath($dstPath); $srcPath = $this->filePath; eZDebugSetting::writeDebug('kernel-clustering', "dfs::fileMove( '{$srcPath}', '{$dstPath}' )"); self::$dbbackend->_rename($srcPath, $dstPath); $this->metaData = null; }