Project

General

Profile

Bug #61184 » BackendUtilitycountVersionsOfRecordsOnPage.patch

Patch File - Andreas Lingott, 2014-08-26 10:25

View differences:

Documents/workspace/git/typo3/sysext/backend/Classes/Utility/BackendUtility.php 2014-08-26 09:51:08.000000000 +0200
* @return array Overview of records
*/
static public function countVersionsOfRecordsOnPage($workspace, $pageId) {
$output = array();
if ($workspace != 0) {
foreach ($GLOBALS['TCA'] as $tableName => $cfg) {
if ($tableName != 'pages' && $cfg['ctrl']['versioningWS']) {
$joinStatement = 'A.t3ver_oid=B.uid';
// Consider records that are moved to a different page
// Consider records that are moved to a different page - PART 1
if (self::isTableMovePlaceholderAware($tableName)) {
$movePointer = new VersionState(VersionState::MOVE_POINTER);
$joinStatement = '(A.t3ver_oid=B.uid AND A.t3ver_state<>' . $movePointer
. ' OR A.t3ver_oid=B.t3ver_move_id AND A.t3ver_state=' . $movePointer . ')';
$joinStatement = 'A.t3ver_oid=B.uid AND A.t3ver_state<>' . $movePointer . ' ';
}
// Select all records from this table in the database from the workspace
// This joins the online version with the offline version as tables A and B
$output[$tableName] = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
......
. ' AND A.t3ver_wsid=' . (int)$workspace . ' AND ' . $joinStatement
. self::deleteClause($tableName, 'A') . self::deleteClause($tableName, 'B')
);
// Consider records that are moved to a different page - PART 2
if (self::isTableMovePlaceholderAware($tableName)) {
$orData = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'B.uid as live_uid, A.uid as offline_uid',
$tableName . ' A,' . $tableName . ' B',
'A.pid=-1' . ' AND B.pid=' . (int)$pageId
. ' AND A.t3ver_wsid=' . (int)$workspace . ' AND A.t3ver_oid=B.t3ver_move_id AND A.t3ver_state=' . $movePointer
. self::deleteClause($tableName, 'A') . self::deleteClause($tableName, 'B')
);
$output[$tableName] = array_merge( $output[$tableName], $orData );
}
if (!is_array($output[$tableName]) || !count($output[$tableName])) {
unset($output[$tableName]);
}
(1-1/3)