/** * Get the sha1 of a file with a given virtual URL/storage path * * @param $virtualUrl string * @return string|false */ public function getFileSha1($virtualUrl) { $path = $this->resolveToStoragePath($virtualUrl); $tmpFile = $this->backend->getLocalReference(array('src' => $path)); if (!$tmpFile) { return false; } return $tmpFile->getSha1Base36(); }
public function doTestGetLocalCopyAndReference404() { $backendName = $this->backendClass(); $base = self::baseStorePath(); $tmpFile = $this->backend->getLocalCopy(array('src' => "{$base}/unittest-cont1/not-there")); $this->assertEquals(null, $tmpFile, "Local copy of not existing file is null ({$backendName})."); $tmpFile = $this->backend->getLocalReference(array('src' => "{$base}/unittest-cont1/not-there")); $this->assertEquals(null, $tmpFile, "Local ref of not existing file is null ({$backendName})."); }
/** * Get a local FS file with a given virtual URL/storage path. * The file is either an original or a copy. It should not be changed. * Temporary files may be purged when the file object falls out of scope. * * @param string $virtualUrl * @return FSFile|null Returns null on failure. */ public function getLocalReference($virtualUrl) { $path = $this->resolveToStoragePath($virtualUrl); return $this->backend->getLocalReference(array('src' => $path)); }