예제 #1
0
파일: updater.php 프로젝트: evanjt/core
 protected function setUp()
 {
     parent::setUp();
     $this->loginAsUser();
     $this->storage = new Temporary(array());
     $this->updater = $this->storage->getUpdater();
     $this->cache = $this->storage->getCache();
 }
예제 #2
0
 public function getUpdater($storage = null)
 {
     if (!$storage) {
         $storage = $this;
     }
     return $this->storage->getUpdater($storage);
 }
예제 #3
0
 protected function renameUpdate(Storage $sourceStorage, Storage $targetStorage, $sourceInternalPath, $targetInternalPath)
 {
     if ($this->updaterEnabled) {
         $targetStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
     }
 }
예제 #4
0
파일: updater.php 프로젝트: evanjt/core
 /**
  * Rename a file or folder in the cache and update the size, etag and mtime of the parent folders
  *
  * @param \OC\Files\Storage\Storage $sourceStorage
  * @param string $source
  * @param string $target
  */
 public function renameFromStorage(\OC\Files\Storage\Storage $sourceStorage, $source, $target)
 {
     if (!$this->enabled or Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) {
         return;
     }
     $time = time();
     $sourceCache = $sourceStorage->getCache($source);
     $sourceUpdater = $sourceStorage->getUpdater();
     $sourcePropagator = $sourceStorage->getPropagator();
     if ($sourceCache->inCache($source)) {
         if ($this->cache->inCache($target)) {
             $this->cache->remove($target);
         }
         if ($sourceStorage === $this->storage) {
             $this->cache->move($source, $target);
         } else {
             $this->cache->moveFromCache($sourceCache, $source, $target);
         }
     }
     if (pathinfo($source, PATHINFO_EXTENSION) !== pathinfo($target, PATHINFO_EXTENSION)) {
         // handle mime type change
         $mimeType = $this->storage->getMimeType($target);
         $fileId = $this->cache->getId($target);
         $this->cache->update($fileId, ['mimetype' => $mimeType]);
     }
     $sourceCache->correctFolderSize($source);
     $this->cache->correctFolderSize($target);
     $sourceUpdater->correctParentStorageMtime($source);
     $this->correctParentStorageMtime($target);
     $this->updateStorageMTimeOnly($target);
     $sourcePropagator->propagateChange($source, $time);
     $this->propagator->propagateChange($target, $time);
 }