Index: t3lib/stddb/tables.sql =================================================================== --- t3lib/stddb/tables.sql (revision 5826) +++ t3lib/stddb/tables.sql (working copy) @@ -297,6 +297,7 @@ CREATE TABLE sys_lockedrecords ( uid int(11) unsigned NOT NULL auto_increment, userid int(11) unsigned DEFAULT '0' NOT NULL, + ses_id varchar(32) DEFAULT '' NOT NULL, tstamp int(11) unsigned DEFAULT '0' NOT NULL, record_table varchar(255) DEFAULT '' NOT NULL, record_uid int(11) DEFAULT '0' NOT NULL, Index: t3lib/class.t3lib_befunc.php =================================================================== --- t3lib/class.t3lib_befunc.php (revision 5826) +++ t3lib/class.t3lib_befunc.php (working copy) @@ -2964,21 +2964,26 @@ /** * Unlock or Lock a record from $table with $uid - * If $table and $uid is not set, then all locking for the current BE_USER is removed! + * If $table and $uid is not set, then all locking for the current BE_USER session is removed! * Usage: 5 * * @param string Table name * @param integer Record uid * @param integer Record pid + * @param boolean Creates lock for a single record if true, releases lock otherwise * @return void * @internal * @see t3lib_transferData::lockRecord(), alt_doc.php, db_layout.php, db_list.php, wizard_rte.php */ - public static function lockRecords($table = '', $uid = 0, $pid = 0) { + public static function lockRecords($table = '', $uid = 0, $pid = 0, $createLock = true) { $user_id = intval($GLOBALS['BE_USER']->user['uid']); - if ($table && $uid) { + + if ($table && $uid && $createLock) { + + // create lock $fields_values = array( 'userid' => $user_id, + 'ses_id' => $GLOBALS['BE_USER']->user['ses_id'], 'feuserid' => 0, 'tstamp' => $GLOBALS['EXEC_TIME'], 'record_table' => $table, @@ -2988,8 +2993,13 @@ ); $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_lockedrecords', $fields_values); + + } elseif($table && $uid && !$creabeteLock) { + // release lock for $table:$uid + $GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_lockedrecords', 'record_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_lockedrecords') . ' AND record_uid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($uid, 'sys_lockedrecords')); } else { - $GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_lockedrecords', 'userid='.intval($user_id)); + // release all locks for BE_USER session + $GLOBALS['TYPO3_DB']->exec_DELETEquery('sys_lockedrecords', 'ses_id=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($ses_id, 'sys_lockedrecords')); } } @@ -3011,7 +3021,7 @@ $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( '*', 'sys_lockedrecords', - 'sys_lockedrecords.userid!='.intval($GLOBALS['BE_USER']->user['uid']).' + 'sys_lockedrecords.ses_id != ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($GLOBALS['BE_USER']->user['ses_id'], 'sys_lockedrecords') . ' AND sys_lockedrecords.tstamp > '.($GLOBALS['EXEC_TIME']-2*3600) ); while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { Index: typo3/sysext/opendocs/class.tx_opendocs.php =================================================================== --- typo3/sysext/opendocs/class.tx_opendocs.php (revision 5826) +++ typo3/sysext/opendocs/class.tx_opendocs.php (working copy) @@ -272,6 +272,13 @@ list(, $docDat) = $GLOBALS['BE_USER']->getModuleData('alt_doc.php', 'ses'); $GLOBALS['BE_USER']->pushModuleData('alt_doc.php', array($this->openDocs, $docDat)); $GLOBALS['BE_USER']->pushModuleData('opendocs::recent', $this->recentDocs); + + // unlock record in database + // what we need from recentDocs has the following structure + // $this->recentDocs[$md5sum][1]['edit'][tablename][uid] + list($table) = array_keys($this->recentDocs[$md5sum][1]['edit']); + list($uid) = array_keys($this->recentDocs[$md5sum][1]['edit'][$table]); + t3lib_BEfunc::lockRecords($table, $uid, 0, false); } $this->renderAjax($params, $ajaxObj);