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


PHP Storage::acquireLock方法代码示例

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


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

示例1: scan

	/**
	 * scan a folder and all it's children
	 *
	 * @param string $path
	 * @param bool $recursive
	 * @param int $reuse
	 * @param bool $lock set to false to disable getting an additional read lock during scanning
	 * @return array an array of the meta data of the scanned file or folder
	 */
	public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
		if ($reuse === -1) {
			$reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG;
		}
		if ($lock) {
			$this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
		}
		$data = $this->scanFile($path, $reuse, -1, null, $lock);
		if ($data and $data['mimetype'] === 'httpd/unix-directory') {
			$size = $this->scanChildren($path, $recursive, $reuse, $data, $lock);
			$data['size'] = $size;
		}
		if ($lock) {
			$this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
		}
		return $data;
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:26,代码来源:scanner.php

示例2: scan

 /**
  * scan a folder and all it's children
  *
  * @param string $path
  * @param bool $recursive
  * @param int $reuse
  * @param bool $lock set to false to disable getting an additional read lock during scanning
  * @return array an array of the meta data of the scanned file or folder
  */
 public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true)
 {
     if ($reuse === -1) {
         $reuse = $recursive === self::SCAN_SHALLOW ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG;
     }
     if ($lock) {
         if ($this->storage->instanceOfStorage('\\OCP\\Files\\Storage\\ILockingStorage')) {
             $this->storage->acquireLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
             $this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
         }
     }
     $data = $this->scanFile($path, $reuse, -1, null, $lock);
     if ($data and $data['mimetype'] === 'httpd/unix-directory') {
         $size = $this->scanChildren($path, $recursive, $reuse, $data['fileid'], $lock);
         $data['size'] = $size;
     }
     if ($lock) {
         if ($this->storage->instanceOfStorage('\\OCP\\Files\\Storage\\ILockingStorage')) {
             $this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
             $this->storage->releaseLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
         }
     }
     return $data;
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:33,代码来源:Scanner.php

示例3: acquireLock

 /**
  * @param string $path
  * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
  * @param \OCP\Lock\ILockingProvider $provider
  * @throws \OCP\Lock\LockedException
  */
 public function acquireLock($path, $type, ILockingProvider $provider)
 {
     if ($this->storage->instanceOfStorage('\\OCP\\Files\\Storage\\ILockingStorage')) {
         $this->storage->acquireLock($path, $type, $provider);
     }
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:12,代码来源:Wrapper.php

示例4: acquireLock

 /**
  * @param string $path
  * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
  * @param \OCP\Lock\ILockingProvider $provider
  * @throws \OCP\Lock\LockedException
  */
 public function acquireLock($path, $type, ILockingProvider $provider)
 {
     $this->storage->acquireLock($path, $type, $provider);
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:10,代码来源:wrapper.php


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