Feature #19524 » 9674_v3.patch
class.t3lib_tcemain.php | ||
---|---|---|
var $checkValue_currentRecord=array(); // Set to "currentRecord" during checking of values.
|
||
var $autoVersioningUpdate = FALSE; // A signal flag used to tell file processing that autoversioning has happend and hence certain action should be applied.
|
||
|
||
|
||
protected $disableDeleteClause = FALSE; // Disable delete clause
|
||
|
||
|
||
|
||
... | ... | |
* @return void
|
||
*/
|
||
function undeleteRecord($table,$uid) {
|
||
$this->deleteRecord($table,$uid,TRUE,FALSE,TRUE);
|
||
if ($this->canUndeleteRecord($table, $uid) === TRUE) {
|
||
$this->deleteRecord($table, $uid, TRUE, FALSE, TRUE);
|
||
}
|
||
}
|
||
|
||
/**
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Beford a record is deleted, check if it has references such as inline type or MM references.
|
||
* Returns true if the record can be undeleted , otherwise false if the record cant undeleted
|
||
*
|
||
* @param string Record Table
|
||
* @param integer Record UID
|
||
* @return boolean Returns true if the record can be undeleted or false if the record cant undeleted
|
||
*/
|
||
function canUndeleteRecord($table, $id) {
|
||
$row = t3lib_BEfunc::getRecord($table, $id, 'pid', '', false);
|
||
if ($row['pid']) {
|
||
$parentPageRow = t3lib_BEfunc::getRecord('pages', $row['pid'], 'deleted, title, uid', '', false);
|
||
if (!$parentPageRow['deleted']) {
|
||
return TRUE;
|
||
} else {
|
||
$this->log($table,$id,'canUndeleteRecord','',1,'Record cannot be undeleted: Parent page is deleted! First undelete page "'.$parentPageRow['title'].' (UID: '.$parentPageRow['uid'].')"');
|
||
}
|
||
}
|
||
return FALSE;
|
||
}
|
||
|
||
/**
|
||
* Before a record is deleted, check if it has references such as inline type or MM references.
|
||
* If so, set these child records also to be deleted.
|
||
*
|
||
* @param string $table: Record Table
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Disable the delete clause
|
||
*
|
||
* @return void
|
||
*/
|
||
public function disableDeleteClause() {
|
||
$this->disableDeleteClause = TRUE;
|
||
}
|
||
|
||
/**
|
||
* Returns delete-clause for the $table
|
||
*
|
||
* @param string Table name
|
||
... | ... | |
function deleteClause($table) {
|
||
// Returns the proper delete-clause if any for a table from TCA
|
||
global $TCA;
|
||
if ($TCA[$table]['ctrl']['delete']) {
|
||
if ($TCA[$table]['ctrl']['delete'] && !$this->disableDeleteClause) {
|
||
return ' AND '.$table.'.'.$TCA[$table]['ctrl']['delete'].'=0';
|
||
} else {
|
||
return '';
|