[TYPO3-core] Hard locking in the core
kasper2007 at typo3.com
Fri Aug 31 22:01:01 CEST 2007
I have implemented hard locking of records in TYPO3 since it was
requested by Typoheads in Austria (redacted user). The deal is that I
implemented the APIs and they work on the UI. For them, it is a
feature necessary for a workflow engine they have dreamt up.
I already have a patch ready for the core for the first alpha
version. I am evaluating that with Boris now. But for now I will just
post the description of the feature and how it currently works, based
on this I would like to know if there are any objections on the core
team to this feature or other comments (additions/changes). I will
post the patch for review a bit later.
redacted user approached me to have a hard locking feature built into
TYPO3 which would be necessary API wise for a workflow system they
were developing. I have now developed the alpha version of this API,
ready for testing.
There are three modes:
- [default] : The advisory locking we have had for long, managed by
t3lib_BEfunc:: (no changes to this)
- "single" : Hard locking, for individual records
- "extended" : Hard locking, for groups of records; locks for records
on the same page locks down other records on the page. Which tables
are included in this check depends on a TCA [ctrl] configuration
"extendedLocking" = TRUE. By default "pages" and "tt_content" are.
The modes are configured through $GLOBALS['TYPO3_CONF_VARS']['BE']
The two new modes are managed through t3lib_locking - a new class
included with t3lib_BEfunc by default.
t3lib_locking has three public methods: is_locked(), lock() and unlock()
Explicit locking: A configuration, $GLOBALS['TYPO3_CONF_VARS']['BE']
['recordLockingExplicit'] = TRUE, means that records must be locked
explicitly before editing or operation on them. Default is that
records gets locked/unlocked implicitly when edited (see alt_doc.php
below). Explicit mode is evaluated inside t3lib_locking::is_locked();
function will also return "true" if no lock is found for the login
user (when "explicit" mode is set).
Across Workspaces: A configuration, $GLOBALS['TYPO3_CONF_VARS']['BE']
['recordLockingAcrossWS'] = TRUE, means that locks for versions in
other workspaces of all implicated records will block access. By
default only the live records and any versions in the current
workspace (unless in Live of course) is checked.
In "single" and "extended" modes:
- TCEmain will check if a record is lock by another user before
allowing any operation to it.
- alt_doc.php will check for other users locks and if found not edit
the record. Also, if implicit mode is on (default) a lock will be set/
updated for a record when loaded into the form. When the form is
closed the lock is cleared.
- $GLOBALS['TCA'][$table]['ctrl']['extendedLocking'] = TRUE
- expiry of locks by time (kasper)
- clean-up during log-out (kasper)
- admin module for managing locks (podzeit et al)
- more backend feedback (podzeit et al)
- implicit locking support by other than alt_doc.php (podzeit et al?)
- optimized "is_locked" function (which currently make lots of
expensive look-ups for "extended" mode)
- interface missing for setting explicit locks (podzeit et al)
NOTICE: NEW EMAIL for 2007: kasper2007 at typo3.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the TYPO3-team-core