2 namespace TYPO3\CMS\Recycler\Domain\Model;
87 $this->limit = trim(
$limit);
94 foreach (
$GLOBALS[
'TCA'] as $tableKey => $tableValue) {
96 if ($this->limit !==
'') {
99 if ((
int)$parts[0] === 0 && (
int)$parts[1] === 0) {
103 $this->table[] = $tableKey;
104 $this->
setData($id, $tableKey, $depth, $tableValue[
'ctrl'], $filter);
121 $deletedRecords = $this->
loadData($id,
$table, $depth,
'', $filter)->getDeletedRows();
123 foreach ($this->table as $tableName) {
124 $countTotal += count($deletedRecords[$tableName]);
142 if (!array_key_exists(
'delete', $tcaCtrl)) {
150 if (trim($filter) !=
'') {
151 $filterWhere =
' AND (' . (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($filter) ?
'uid = ' . $filter .
' OR pid = ' . $filter .
' OR ' :
'') . $tcaCtrl[
'label'] .
' LIKE "%' . $this->
escapeValueForLike($filter,
$table) .
'%"' .
')';
155 if (!empty($this->limit)) {
157 $deletedCount = $db->exec_SELECTcountRows(
'uid',
$table, $deletedField .
'<>0 AND pid = ' . $id . $filterWhere);
161 $rowCount = $parts[1];
163 $result = $offset - $deletedCount;
168 $this->limit = implode(
',', array($offset, $rowCount));
177 $tempOffset = $offset;
184 $absResult = abs($result);
186 if ($absResult > $rowCount) {
188 $limit = implode(
',', array($tempOffset, $rowCount));
190 $this->limit = implode(
',', array($newOffset, 0));
196 $limit = implode(
',', array($tempOffset, $absResult));
198 $newCount = $rowCount - $absResult;
200 $this->limit = implode(
',', array($newOffset, $newCount));
221 $recordsToCheck = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordsByField(
$table, $deletedField,
'1',
' AND pid = ' . $id . $filterWhere,
'',
'',
$limit,
false);
222 if ($recordsToCheck) {
227 if ($allowDepth && $depth >= 1) {
229 $resPages = $db->exec_SELECTquery(
'uid',
'pages',
'pid=' . $id,
'',
'sorting');
231 while ($rowPages = $db->sql_fetch_assoc($resPages)) {
232 $this->
setData($rowPages[
'uid'],
$table, $depth - 1, $tcaCtrl, $filter);
234 if (!empty($this->limit)) {
237 if ((
int)$parts[0] === 0 && (
int)$parts[1] === 0) {
242 $db->sql_free_result($resPages);
245 $this->label[
$table] = $tcaCtrl[
'label'];
246 $this->title[
$table] = $tcaCtrl[
'title'];
258 foreach ($rows as $row) {
276 return $db->escapeStrForLike($db->quoteStr($value, $tableName), $tableName);
288 public function deleteData($recordsArray)
290 if (is_array($recordsArray)) {
294 $tce->disableDeleteClause();
295 foreach ($recordsArray as $record) {
296 list(
$table, $uid) = explode(
':', $record);
297 $tce->deleteEl(
$table, (
int)$uid,
true,
true);
319 if (is_array($recordsArray)) {
320 $this->deletedRows = array();
322 foreach ($recordsArray as $record) {
323 list(
$table, $uid) = explode(
':', $record);
324 $cmd[
$table][$uid][
'undelete'] = 1;
325 if (
$table ===
'pages' && $recursive) {
326 $this->
loadData($uid,
'', $depth,
'');
328 if (count($childRecords) > 0) {
329 foreach ($childRecords as $childTable => $childRows) {
330 foreach ($childRows as $childRow) {
331 $cmd[$childTable][$childRow[
'uid']][
'undelete'] = 1;
339 $tce->start(array(), $cmd);
340 $tce->process_cmdmap();
359 $this->deletedRows[
$table][] = $row;