$resource->addLock();
$resource->removeLock();
-
☆ A M B ☆
- 2,475 Posts
Hey... where is the man page for addLock?
-
☆ A M B ☆
- 450 Posts
Dang. It looks like lock status is checked before any of the applicable system events are processed. I was dreaming up a really evil plugin that would lock resources in real time as somebody requested them.
Quote from: Everett at Jan 13, 2011, 01:12 PM
Thanks Bob, but it has to be a custom thing that gets, not just a MODx resource. E.g. a custom manager page... no MODx resources are created or involved in any way. So is your solution still viable?
I don’t think so, it looks like that’s only a method for resources (you *did* ask for lockResource in the OP

) and I think it has to be cleared explicitly (not sure). I don’t see any generic MODx "lock" functions.
-
☆ A M B ☆
- 2,475 Posts
Thanks Bob. Yes, I did ask about a resource, didn’t I? Well... I need to write a simple plugin, then. I’ve hand coded this before for an app that required file-locking across load-balanced servers. I think all I’d need is:
1. A database table with a column for the unique name of the thing being locked and a modx user id (plus requisite datestamps etc).
2. API methods to create a lock, clear a lock, check for a lock, and clear all locks.
3. Appropriate messaging.
4. Tie into MODx’s "clear locks" event to fire my own "clearAllLocks" method.
Anyone know off the top of their head which system event is fired as MODx clears locks?
I don’t think there is a system event for that. There are a couple of processors (resource/locks/remove_lock and resource /locks/steal_locks), but they don’t fire any events.
-
☆ A M B ☆
- 2,475 Posts
I think we’ve landed ourselves in a feature request. Do you concur?
Quote from: Everett at Jan 14, 2011, 01:49 AM
I think we’ve landed ourselves in a feature request. Do you concur?
Feel free. I’m not sure I understand what you want to do (not that I need to). And, I’m not clear on whether your request would be for a new system event, new API methods, or both.