19 require_once(BASE.
"wcmf/lib/core/class.WCMFException.php");
20 require_once(BASE.
"wcmf/lib/util/class.Message.php");
21 require_once(BASE.
"wcmf/lib/util/class.InifileParser.php");
22 require_once(BASE.
"wcmf/lib/util/class.SessionData.php");
23 require_once(BASE.
"wcmf/lib/persistence/class.PersistenceFacade.php");
24 require_once(BASE.
"wcmf/lib/persistence/class.NullLockManager.php");
25 require_once(BASE.
"wcmf/lib/persistence/class.Lock.php");
26 require_once(BASE.
"wcmf/lib/security/class.RightsManager.php");
27 require_once(BASE.
"wcmf/lib/util/class.ObjectFactory.php");
47 static $instance = null;
50 $locking = $parser->getValue(
'locking',
'cms');
53 if (!is_object($instance) )
56 $anonymous = $parser->getValue(
'anonymous',
'cms');
59 require_once(BASE.
"wcmf/lib/persistence/class.NullLockManager.php");
65 $instance = &$objectFactory->createInstanceFromConfig(
'implementation',
'LockManager');
66 if ($instance === null)
90 if (strtolower(get_class($object)) ==
'persistentobject' || is_a($object,
'PersistentObject'))
95 if ($rightsManager->authorize($object->getOID(),
'',
ACTION_MODIFY))
98 $lock = $object->getLock();
100 $lockMsg .= $lockManager->getLockMessage($lock, $name).
'<br />';
104 $lockManager->aquireLock($object->getOID());
125 if ($authUser != null)
127 $lock =
new Lock($oid, $authUser->getOID(), $authUser->getLogin(), $session->getID());
128 $this->
aquireLockImpl($authUser->getOID(), $session->getID(), $oid, $lock->getCreated());
144 if ($authUser != null)
165 if ($authUser != null)
176 if ($objectText ==
'')
177 $objectText = $lock->getOID();
178 $msg =
Message::get(
"%1% is locked by user '%2%' since %3%. ", array($objectText, $lock->getLogin(), strftime(
"%X", strtotime($lock->getCreated()))));
200 $lifeTimeInSeconds = (mktime() - strtotime($lock->getCreated()));
201 if ($lifeTimeInSeconds > ini_get(
"session.gc_maxlifetime"))
203 $this->
releaseLockImpl($lock->getUserOID(), $lock->getSessionID(), null);
216 return $rightsManager->getAuthUser();
227 WCMFException::throwEx(
"aquireLockImpl() must be implemented by derived class: ".get_class($this), __FILE__, __LINE__);
238 WCMFException::throwEx(
"releaseLockImpl() must be implemented by derived class: ".get_class($this), __FILE__, __LINE__);
247 WCMFException::throwEx(
"releaseAllLocks() must be implemented by derived class: ".get_class($this), __FILE__, __LINE__);
256 WCMFException::throwEx(
"getLockImpl() must be implemented by derived class: ".get_class($this), __FILE__, __LINE__);
get($message, $parameters=null, $domain='', $lang='')
LockManager is used to handle lock requests on objects.
throwEx($message, $file='', $line='')
releaseLockImpl($useroid, $sessid, $oid)
aquireLockImpl($useroid, $sessid, $oid, $lockDate)
getLockMessage($lock, $objectText)
handleLocking(&$object, $name)
Lock represents a lock on an object.
releaseAllLocksImpl($useroid, $sessid)
NullLockManager acts as if no LockManager was installed. Use this to disable locking.