当前位置: 首页>>代码示例>>PHP>>正文


PHP View::unlockFile方法代码示例

本文整理汇总了PHP中OC\Files\View::unlockFile方法的典型用法代码示例。如果您正苦于以下问题:PHP View::unlockFile方法的具体用法?PHP View::unlockFile怎么用?PHP View::unlockFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC\Files\View的用法示例。


在下文中一共展示了View::unlockFile方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testChangeLock

 public function testChangeLock()
 {
     Filesystem::initMountPoints($this->recipientUid);
     $recipientView = new View('/' . $this->recipientUid . '/files');
     $recipientView->lockFile('bar.txt', ILockingProvider::LOCK_SHARED);
     $recipientView->changeLock('bar.txt', ILockingProvider::LOCK_EXCLUSIVE);
     $recipientView->unlockFile('bar.txt', ILockingProvider::LOCK_EXCLUSIVE);
     $this->assertTrue(true);
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:9,代码来源:locking.php

示例2: releaseLock

 /**
  * @param string $path
  * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
  * @param \OCP\Lock\ILockingProvider $provider
  */
 public function releaseLock($path, $type, ILockingProvider $provider)
 {
     /** @var \OCP\Files\Storage $targetStorage */
     list($targetStorage, $targetInternalPath) = $this->resolvePath($path);
     $targetStorage->releaseLock($targetInternalPath, $type, $provider);
     // unlock the parent folders of the owner when unlocking the share as recipient
     if ($path === '') {
         $sourcePath = $this->ownerView->getPath($this->share['file_source']);
         $this->ownerView->unlockFile(dirname($sourcePath), ILockingProvider::LOCK_SHARED, true);
     }
 }
开发者ID:GrumpyCrouton,项目名称:core,代码行数:16,代码来源:sharedstorage.php

示例3: isFileLocked

 /**
  * Check if the given path is locked with a given type
  *
  * @param \OC\Files\View $view view
  * @param string $path path to check
  * @param int $type lock type
  * @param bool $onMountPoint true to check the mount point instead of the
  * mounted storage
  *
  * @return boolean true if the file is locked with the
  * given type, false otherwise
  */
 protected function isFileLocked($view, $path, $type, $onMountPoint = false)
 {
     // Note: this seems convoluted but is necessary because
     // the format of the lock key depends on the storage implementation
     // (in our case mostly md5)
     if ($type === \OCP\Lock\ILockingProvider::LOCK_SHARED) {
         // to check if the file has a shared lock, try acquiring an exclusive lock
         $checkType = \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE;
     } else {
         // a shared lock cannot be set if exclusive lock is in place
         $checkType = \OCP\Lock\ILockingProvider::LOCK_SHARED;
     }
     try {
         $view->lockFile($path, $checkType, $onMountPoint);
         // no exception, which means the lock of $type is not set
         // clean up
         $view->unlockFile($path, $checkType, $onMountPoint);
         return false;
     } catch (\OCP\Lock\LockedException $e) {
         // we could not acquire the counter-lock, which means
         // the lock of $type was in place
         return true;
     }
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:36,代码来源:testcase.php

示例4: unlockAllTheFiles

 /**
  * @param string $dir
  * @param $files
  * @param integer $getType
  * @param View $view
  * @param string $filename
  */
 private static function unlockAllTheFiles($dir, $files, $getType, $view, $filename)
 {
     if ($getType === self::FILE) {
         $view->unlockFile($filename, ILockingProvider::LOCK_SHARED);
     }
     if ($getType === self::ZIP_FILES) {
         foreach ($files as $file) {
             $file = $dir . '/' . $file;
             $view->unlockFile($file, ILockingProvider::LOCK_SHARED);
         }
     }
     if ($getType === self::ZIP_DIR) {
         $file = $dir . '/' . $files;
         $view->unlockFile($file, ILockingProvider::LOCK_SHARED);
     }
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:23,代码来源:files.php

示例5: releaseLock

 /**
  * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
  */
 public function releaseLock($type)
 {
     $this->fileView->unlockFile($this->path, $type);
 }
开发者ID:evanjt,项目名称:core,代码行数:7,代码来源:node.php

示例6: copyFileContents

 /**
  * Stream copy file contents from $path1 to $path2
  *
  * @param View $view view to use for copying
  * @param string $path1 source file to copy
  * @param string $path2 target file
  *
  * @return bool true for success, false otherwise
  */
 private static function copyFileContents($view, $path1, $path2)
 {
     /** @var \OC\Files\Storage\Storage $storage1 */
     list($storage1, $internalPath1) = $view->resolvePath($path1);
     /** @var \OC\Files\Storage\Storage $storage2 */
     list($storage2, $internalPath2) = $view->resolvePath($path2);
     $view->lockFile($path1, ILockingProvider::LOCK_EXCLUSIVE);
     $view->lockFile($path2, ILockingProvider::LOCK_EXCLUSIVE);
     // TODO add a proper way of overwriting a file while maintaining file ids
     if ($storage1->instanceOfStorage('\\OC\\Files\\ObjectStore\\ObjectStoreStorage') || $storage2->instanceOfStorage('\\OC\\Files\\ObjectStore\\ObjectStoreStorage')) {
         $source = $storage1->fopen($internalPath1, 'r');
         $target = $storage2->fopen($internalPath2, 'w');
         list(, $result) = \OC_Helper::streamCopy($source, $target);
         fclose($source);
         fclose($target);
         if ($result !== false) {
             $storage1->unlink($internalPath1);
         }
     } else {
         $result = $storage2->moveFromStorage($storage1, $internalPath1, $internalPath2);
     }
     $view->unlockFile($path1, ILockingProvider::LOCK_EXCLUSIVE);
     $view->unlockFile($path2, ILockingProvider::LOCK_EXCLUSIVE);
     return $result !== false;
 }
开发者ID:gvde,项目名称:core,代码行数:34,代码来源:storage.php

示例7: unlock

 /**
  * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
  * @throws \OCP\Lock\LockedException
  */
 public function unlock($type)
 {
     $this->view->unlockFile($this->path, $type);
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:8,代码来源:Node.php

示例8: copyFileContents

 /**
  * Stream copy file contents from $path1 to $path2
  *
  * @param \OC\Files\View $view view to use for copying
  * @param string $path1 source file to copy
  * @param string $path2 target file
  *
  * @return bool true for success, false otherwise
  */
 private static function copyFileContents($view, $path1, $path2)
 {
     /** @var \OC\Files\Storage\Storage $storage1 */
     list($storage1, $internalPath1) = $view->resolvePath($path1);
     /** @var \OC\Files\Storage\Storage $storage2 */
     list($storage2, $internalPath2) = $view->resolvePath($path2);
     $view->lockFile($path1, ILockingProvider::LOCK_EXCLUSIVE);
     $view->lockFile($path2, ILockingProvider::LOCK_EXCLUSIVE);
     $result = $storage2->moveFromStorage($storage1, $internalPath1, $internalPath2);
     $view->unlockFile($path1, ILockingProvider::LOCK_EXCLUSIVE);
     $view->unlockFile($path2, ILockingProvider::LOCK_EXCLUSIVE);
     return $result !== false;
 }
开发者ID:0x17de,项目名称:core,代码行数:22,代码来源:storage.php


注:本文中的OC\Files\View::unlockFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。