/** * Get the filename hash component of the directory including trailing slash, * e.g. f/fa/ * If the repository is not hashed, returns an empty string. * * @return string */ function getHashPath() { if (!isset($this->hashPath)) { $this->hashPath = $this->repo->getHashPath($this->getName()); } return $this->hashPath; }
/** * Output the chunk to disk * * @param string $chunkPath * @throws UploadChunkFileException * @return FileRepoStatus */ private function outputChunk($chunkPath) { // Key is fileKey + chunk index $fileKey = $this->getChunkFileKey(); // Store the chunk per its indexed fileKey: $hashPath = $this->repo->getHashPath($fileKey); $storeStatus = $this->repo->quickImport($chunkPath, $this->repo->getZonePath('temp') . "/{$hashPath}{$fileKey}"); // Check for error in stashing the chunk: if (!$storeStatus->isOK()) { $error = $storeStatus->getErrorsArray(); $error = reset($error); if (!count($error)) { $error = $storeStatus->getWarningsArray(); $error = reset($error); if (!count($error)) { $error = array('unknown', 'no error recorded'); } } throw new UploadChunkFileException("Error storing file in '{$chunkPath}': " . implode('; ', $error)); } return $storeStatus; }
/** * Get the filename hash component of the directory including trailing slash, * e.g. f/fa/ * If the repository is not hashed, returns an empty string. * * @return string */ function getHashPath() { if (!isset($this->hashPath)) { $this->assertRepoDefined(); $this->hashPath = $this->repo->getHashPath($this->getName()); } return $this->hashPath; }