/** * Release version from this workspace (and into "Live" workspace but as an offline version). * * @param string $table Table name * @param integer $id Record UID * @param boolean $flush If set, will completely delete element * @param t3lib_TCEmain $tcemainObj TCEmain object * @return void */ protected function version_clearWSID($table, $id, $flush = FALSE, t3lib_TCEmain $tcemainObj) { global $TCA; if ($errorCode = $tcemainObj->BE_USER->workspaceCannotEditOfflineVersion($table, $id)) { $tcemainObj->newlog('Attempt to reset workspace for record failed: ' . $errorCode, 1); } elseif ($tcemainObj->checkRecordUpdateAccess($table, $id)) { if ($liveRec = t3lib_BEfunc::getLiveVersionOfRecord($table, $id, 'uid,t3ver_state')) { // Clear workspace ID: $updateData = array('t3ver_wsid' => 0); $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($id), $updateData); // Clear workspace ID for live version AND DELETE IT as well because it is a new record! if ((int) $liveRec['t3ver_state'] == 1 || (int) $liveRec['t3ver_state'] == 2) { $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($liveRec['uid']), $updateData); // THIS assumes that the record was placeholder ONLY for ONE record (namely $id) $tcemainObj->deleteEl($table, $liveRec['uid'], TRUE); } // If "deleted" flag is set for the version that got released // it doesn't make sense to keep that "placeholder" anymore and we delete it completly. $wsRec = t3lib_BEfunc::getRecord($table, $id); if ($flush || ((int) $wsRec['t3ver_state'] == 1 || (int) $wsRec['t3ver_state'] == 2)) { $tcemainObj->deleteEl($table, $id, TRUE, TRUE); } // Remove the move-placeholder if found for live record. if ((int) $TCA[$table]['ctrl']['versioningWS'] >= 2) { if ($plhRec = t3lib_BEfunc::getMovePlaceholder($table, $liveRec['uid'], 'uid')) { $tcemainObj->deleteEl($table, $plhRec['uid'], TRUE, TRUE); } } } } else { $tcemainObj->newlog('Attempt to reset workspace for record failed because you do not have edit access', 1); } }