Issue Bug Closed

#77758Deleting a workspace spams log

Robert Vock 09/01/16, 17:57 updated 10/02/18, 11:07

Description

If you delete a workspace, you’ll get a log entry for each versionable record. This fills the sys_log-table quite fast.

Steps to reproduce:
1. Create workspace
2. Delete this workspace
3. Log is full with “Attempt to reset workspace for record failed: Not an offline version”

I think, there are two bugs at work here:
The DataHandlerHook does not use the BackendWorkspaceRestriction correctly:
https://github.com/TYPO3/TYPO3.CMS/blob/2206de/typo3/sysext/workspaces/Classes/Hook/DataHandlerHook.php#L108

It should use the workspaceId as parameter.

The resulting SQL-Query looks like this:

SELECT `uid` FROM `pages` WHERE (`pages`.`deleted` = 0) AND ((`pages`.`t3ver_wsid` = 0) OR (`pages`.`t3ver_state` <= 0)) ORDER BY `uid` ASC

After adding the parameter, it looks a bit better:

SELECT `uid` FROM `pages` WHERE (`pages`.`deleted` = 0) AND ((`pages`.`t3ver_wsid` = 9) OR (`pages`.`t3ver_state` <= 0)) ORDER BY `uid` ASC

But the OR within the WHERE-condition still selects all pages, because t3ver_state is 0 for all live-pages. So I think, BackendWorkspaceRestriction is incorrect:
https://github.com/TYPO3/TYPO3.CMS/blob/2206de/typo3/sysext/core/Classes/Database/Query/Restriction/BackendWorkspaceRestriction.php#L68

Before commit ddd05ff314d02abd537fb9432236e6e53c000155 ([TASK] Doctrine: migrate EXT:recordlist/Recordlist/RecordList/AbstractDatabaseRecordList) the query condition looked like this:

1=1 AND pages.t3ver_wsid=10 AND pages.pid=-1 AND `pages`.`deleted` = 0

Reviews 1