public function getScopedLock($virtualKey)
 {
     $status = Status::newGood();
     return ScopedLock::factory($this->lockMgr, array($virtualKey), LockManager::LOCK_EX, $status);
 }
예제 #2
0
	/**
	 * Lock the files at the given storage paths in the backend.
	 * This will either lock all the files or none (on failure).
	 * On failure, the status object will be updated with errors.
	 *
	 * Once the return value goes out scope, the locks will be released and
	 * the status updated. Unlock fatals will not change the status "OK" value.
	 *
	 * @see ScopedLock::factory()
	 *
	 * @param array $paths List of storage paths or map of lock types to path lists
	 * @param integer|string $type LockManager::LOCK_* constant or "mixed"
	 * @param Status $status Status to update on lock/unlock
	 * @return ScopedLock|null Returns null on failure
	 */
	final public function getScopedFileLocks( array $paths, $type, Status $status ) {
		if ( $type === 'mixed' ) {
			foreach ( $paths as &$typePaths ) {
				$typePaths = array_map( 'FileBackend::normalizeStoragePath', $typePaths );
			}
		} else {
			$paths = array_map( 'FileBackend::normalizeStoragePath', $paths );
		}
		return ScopedLock::factory( $this->lockManager, $paths, $type, $status );
	}
예제 #3
0
 /**
  * Lock the files at the given storage paths in the backend.
  * This will either lock all the files or none (on failure).
  * On failure, the status object will be updated with errors.
  *
  * Once the return value goes out scope, the locks will be released and
  * the status updated. Unlock fatals will not change the status "OK" value.
  *
  * @param $paths Array Storage paths
  * @param $type integer LockManager::LOCK_* constant
  * @param $status Status Status to update on lock/unlock
  * @return ScopedLock|null Returns null on failure
  */
 public final function getScopedFileLocks(array $paths, $type, Status $status)
 {
     return ScopedLock::factory($this->lockManager, $paths, $type, $status);
 }