/** * Get a ScopedLock object representing a lock on resource paths. * Any locks are released once this object goes out of scope. * The status object is updated with any errors or warnings. * * @param $manager LockManager * @param array $paths List of storage paths * @param $type integer LockManager::LOCK_* constant * @param $status Status * @return ScopedLock|null Returns null on failure */ public static function factory(LockManager $manager, array $paths, $type, Status $status) { $lockStatus = $manager->lock($paths, $type); $status->merge($lockStatus); if ($lockStatus->isOK()) { return new self($manager, $paths, $type, $status); } return null; }
/** * Lock the files at the given storage paths in the backend. * This will either lock all the files or none (on failure). * * Callers should consider using getScopedFileLocks() instead. * * @param array $paths Storage paths * @param integer $type LockManager::LOCK_* constant * @return Status */ final public function lockFiles( array $paths, $type ) { $paths = array_map( 'FileBackend::normalizeStoragePath', $paths ); return $this->lockManager->lock( $paths, $type ); }
/** * Lock the files at the given storage paths in the backend. * This will either lock all the files or none (on failure). * * Callers should consider using getScopedFileLocks() instead. * * @param $paths Array Storage paths * @param $type integer LockManager::LOCK_* constant * @return Status */ public final function lockFiles(array $paths, $type) { return $this->lockManager->lock($paths, $type); }
/** * Lock the files at the given storage paths in the backend. * This will either lock all the files or none (on failure). * * Callers should consider using getScopedFileLocks() instead. * * @param array $paths Storage paths * @param int $type LockManager::LOCK_* constant * @param int $timeout Timeout in seconds (0 means non-blocking) (since 1.24) * @return StatusValue */ public final function lockFiles(array $paths, $type, $timeout = 0) { $paths = array_map('FileBackend::normalizeStoragePath', $paths); return $this->wrapStatus($this->lockManager->lock($paths, $type, $timeout)); }