Beispiel #1
0
 /**
  * Update the encrypted cache version in the database
  *
  * @param Storage $sourceStorage
  * @param string $sourceInternalPath
  * @param string $targetInternalPath
  * @param bool $isRename
  */
 private function updateEncryptedVersion(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $isRename)
 {
     $isEncrypted = $this->encryptionManager->isEnabled() && $this->mount->getOption('encrypt', true) ? 1 : 0;
     $cacheInformation = ['encrypted' => (bool) $isEncrypted];
     if ($isEncrypted === 1) {
         $encryptedVersion = $sourceStorage->getCache()->get($sourceInternalPath)['encryptedVersion'];
         // In case of a move operation from an unencrypted to an encrypted
         // storage the old encrypted version would stay with "0" while the
         // correct value would be "1". Thus we manually set the value to "1"
         // for those cases.
         // See also https://github.com/owncloud/core/issues/23078
         if ($encryptedVersion === 0) {
             $encryptedVersion = 1;
         }
         $cacheInformation['encryptedVersion'] = $encryptedVersion;
     }
     // in case of a rename we need to manipulate the source cache because
     // this information will be kept for the new target
     if ($isRename) {
         $sourceStorage->getCache()->put($sourceInternalPath, $cacheInformation);
     } else {
         $this->getCache()->put($targetInternalPath, $cacheInformation);
     }
 }
Beispiel #2
0
 /**
  * Update the encrypted cache version in the database
  *
  * @param Storage $sourceStorage
  * @param string $sourceInternalPath
  * @param string $targetInternalPath
  * @param bool $isRename
  */
 private function updateEncryptedVersion(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $isRename)
 {
     $isEncrypted = $this->encryptionManager->isEnabled() && $this->mount->getOption('encrypt', true) ? 1 : 0;
     $cacheInformation = ['encrypted' => (bool) $isEncrypted];
     if ($isEncrypted === 1) {
         $cacheInformation['encryptedVersion'] = $sourceStorage->getCache()->get($sourceInternalPath)['encryptedVersion'];
     }
     // in case of a rename we need to manipulate the source cache because
     // this information will be kept for the new target
     if ($isRename) {
         $sourceStorage->getCache()->put($sourceInternalPath, $cacheInformation);
     } else {
         $this->getCache()->put($targetInternalPath, $cacheInformation);
     }
 }