1. Josh
  2. yourls-concurrency-fix


This is a plugin for YOURLS (http://yourls.org/)

It's an initial attempt to fix the concurrency issue reported here: http://code.google.com/p/yourls/issues/detail?id=765

By default, it uses file-based locking (flock). You can also choose to use PHP's semaphore extension or MySQL named locks. The semaphore method is generally fastest, but it's not always available.

To get semaphore-based locking, add the following to your config file:

define( 'CONCURRENCY_FIX_METHOD', 'semaphore' );

To get MySQL-based locking, add the following to your config file:

define( 'CONCURRENCY_FIX_METHOD', 'mysql' );

It's been tested against:
* YOURLS trunk (1.5.1-gamma)
* PHP 5.3 (although it should work with PHP 4.3 or greater)
* MySQL 5+ (although it should work with MySQL 4.1 or greater)
* Apache / LiteSpeed
* Windows / Linux (PHP's semaphore extension is not available on Windows)

* In [YOURLS install dir]/user/plugins, create a new folder named concurrency-fix
* Copy plugin.php and readwrite.lockfile into this new folder
* Activate the plugin via YOURLS admin interface

Mercurial Installation:
* cd [YOURLS install dir]/user/plugins
* hg clone https://bitbucket.org/laceous/yourls-concurrency-fix concurrency-fix

* Let's keep this short
* This plugin is free software (see: http://www.gnu.org/licenses/gpl.txt)
* I'm not responsible for any use (or misuse) of this code