46 $this->manager = $manager;
47 $this->pathsByType = $pathsByType;
48 $this->status = $status;
68 $pathsByType = is_int( $type ) ? [ $type => $paths ] : $paths;
70 $status->
merge( $lockStatus );
71 if ( $lockStatus->isOK() ) {
94 $wasOk = $this->status->isOK();
95 $this->status->merge( $this->manager->unlockByType( $this->pathsByType ) );
98 $this->status->setResult(
true, $this->status->value );
Resource locking handling.
lockByType(array $pathsByType, $timeout=0)
Lock the resources at the given abstract paths.
static factory(LockManager $manager, array $paths, $type, StatusValue $status, $timeout=0)
Get a ScopedLock object representing a lock on resource paths.
static release(?ScopedLock &$lock=null)
Release a scoped lock and set any errors in the attached StatusValue object.
__destruct()
Release the locks when this goes out of scope.
array $pathsByType
Map of lock types to resource paths.
__construct(LockManager $manager, array $pathsByType, StatusValue $status)
Generic operation result class Has warning/error list, boolean status and arbitrary value.
merge( $other, $overwriteValue=false)
Merge another status object into this one.