/**
  * @return string
  */
 function getSha1()
 {
     $this->load();
     // Initialise now if necessary
     if ($this->sha1 == '' && $this->fileExists) {
         $this->lock();
         // begin
         $this->sha1 = $this->repo->getFileSha1($this->getPath());
         if (!wfReadOnly() && strval($this->sha1) != '') {
             $dbw = $this->repo->getMasterDB();
             $dbw->update('image', array('img_sha1' => $this->sha1), array('img_name' => $this->getName()), __METHOD__);
             $this->saveToCache();
         }
         $this->unlock();
         // done
     }
     return $this->sha1;
 }
Esempio n. 2
0
 /**
  * Get the SHA-1 base 36 hash of the file
  *
  * @return string
  */
 function getSha1()
 {
     $this->assertRepoDefined();
     return $this->repo->getFileSha1($this->getPath());
 }
 protected function getDeletedPath(LocalRepo $repo, LocalFile $file)
 {
     $hash = $repo->getFileSha1($file->getPath());
     $key = "{$hash}.{$file->getExtension()}";
     return $repo->getDeletedHashPath($key) . $key;
 }