2017 © Pedro Peláez
 

library lockfile

Create a *.lock file, such as to lock down upgrades from running concurrently.

image

crazedsanity/lockfile

Create a *.lock file, such as to lock down upgrades from running concurrently.

  • Wednesday, August 30, 2017
  • by crazedsanity
  • Repository
  • 1 Watchers
  • 0 Stars
  • 160 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Lock File

This class is intended to avoid having multiple instances of a certain process (like an upgrade, such as with cs_webdbupgrade) from "tripping" over each other. Create a lock file somewhere on the system (which is readable + writable), and remove it when the operation completes. The file should stay if there's a problem that keeps the operation from completing (because trying again would probably fail, or would make things worse)., (*1)

use crazedsanity\lockfile\LockFile;

$lock = new LockFile('/path/to/rw/dir', 'file.lock');

if(!$lock->is_lockfile_present()) {
    $lock->create_lockfile($upgradeWording);

    // ... do some stuff...
    // Only delete the lockfile if it all succeeded
    $lock->delete_lockfile();
}
else {
    throw new exception($lock->read_lockfile());
}

You may want to look at Web DB Upgrade for an implementation example., (*2)

The Versions

30/08 2017

dev-master

9999999-dev http://www.crazedsanity.com

Create a *.lock file, such as to lock down upgrades from running concurrently.

  Sources   Download

MIT

The Requires

 

The Development Requires

php dry oaoo

07/11 2016

v0.1.3

0.1.3.0 http://www.crazedsanity.com

Create a *.lock file, such as to lock down upgrades from running concurrently.

  Sources   Download

MIT

The Requires

 

php dry oaoo

16/12 2015

v0.1.2

0.1.2.0 http://www.crazedsanity.com

Create a *.lock file, such as to lock down upgrades from running concurrently.

  Sources   Download

MIT

The Requires

 

php dry oaoo

16/12 2015

v0.1.1

0.1.1.0 http://www.crazedsanity.com

Create a *.lock file, such as to lock down upgrades from running concurrently.

  Sources   Download

MIT

The Requires

 

php dry oaoo

16/05 2015

v0.1.0

0.1.0.0 http://www.crazedsanity.com

Create a *.lock file, such as to lock down upgrades from running concurrently.

  Sources   Download

MIT

The Requires

 

php dry oaoo