/** * Copies all records from tables in $copyTablesArray from page with $old_pid to page with $new_pid * Uses raw-copy for the operation (meant for versioning!) * * @param int $oldPageId Current page id. * @param int $newPageId New page id * @param array $copyTablesArray Array of tables from which to copy * @param DataHandler $tcemainObj TCEmain object * @return void * @see versionizePages() */ protected function rawCopyPageContent($oldPageId, $newPageId, array $copyTablesArray, DataHandler $tcemainObj) { if (!$newPageId) { return; } foreach ($copyTablesArray as $table) { // all records under the page is copied. if ($table && is_array($GLOBALS['TCA'][$table]) && $table !== 'pages') { $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', $table, 'pid=' . (int) $oldPageId . $tcemainObj->deleteClause($table)); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) { // Check, if this record has already been copied by a parent record as relation: if (!$tcemainObj->copyMappingArray[$table][$row['uid']]) { // Copying each of the underlying records (method RAW) $tcemainObj->copyRecord_raw($table, $row['uid'], $newPageId); } } $GLOBALS['TYPO3_DB']->sql_free_result($mres); } } }