Task #43916

Epic #58282: Workspaces Workpackage #2

Story #58284: Bug fixes & Behaviour

File Repository does not work with Workspaces

Added by Devid Messner over 2 years ago. Updated about 1 year ago.

Status:Resolved Start date:2012-12-12
Priority:Should have Due date:
Assigned To:Benjamin Mack % Done:

100%

Category:File Abstraction Layer (FAL) Spent time: -
Target version:-
TYPO3 Version:6.0 Complexity:
PHP Version: Sprint Focus:

Description

The FileRepository \TYPO3\CMS\Core\Resource\FileRepository does not support versioning/workspaces. The bug is in the function "findByRelation".

The patch in attachment work for me.

FileRepositoryWorkspace.diff Magnifier (1.5 kB) Devid Messner, 2012-12-12 14:26

Screen_Shot_2014-07-10_at_16.31.46.png (82.8 kB) Alex Pöll, 2014-07-10 16:40

Screen_Shot_2014-07-10_at_16.35.28.png (25 kB) Alex Pöll, 2014-07-10 16:40

Screen_Shot_2014-07-10_at_16.34.39.png (21.4 kB) Alex Pöll, 2014-07-10 16:40

Screen_Shot_2014-07-10_at_16.38.40.png (43.6 kB) Alex Pöll, 2014-07-10 16:40


Related issues

related to Core - Task #59276: Integrate functional DataHandler tests for FAL Resolved 2014-06-02
related to Core - Bug #48464: Images in workspaces don't work New 2013-05-22
duplicated by Core - Task #58305: Severe Issues with FAL records when in workspaces. Resolved 2014-04-29
duplicated by Core - Task #54956: Invalid workspace image preview in page and list module Closed 2014-01-13

Associated revisions

Revision ed5b0d12
Added by Benjamin Mack about 1 year ago

[BUGFIX] File Relations don't work with workspaces

The file repository used to resolve all sys_file_references
handles enable fields manually currently, which is bad because
it forgets to handle the workspace-related where clause.

The attached patch splits the behavior into frontend and
backend context. In backend the RelationHandler is capable
of automatically resolving IRRE structures. In frontend mode
the enableFiels and version preview settings are relevant to
show correct results.

Resolves: #43916
Releases: 6.2
Change-Id: I6c19e5d7b4cd7a2134921c669b82ab90b54844de
Reviewed-on: https://review.typo3.org/29712
Tested-by: Lorenz Ulrich
Reviewed-by: Fabien Udriot
Tested-by: Fabien Udriot
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter

History

#1 Updated by Reindl Bernd over 2 years ago

Hello,

i have the same problem with TYPO3 6.0.3.

With this patch the relations for the workspace are found.

But if i create a relation in the workspace, the relation is lost. So i have extend the function.

@
public function findByRelation($tableName, $fieldName, $uid) {
$itemList = array();
if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($uid)) {
throw new \InvalidArgumentException('Uid of related record has to be an integer.', 1316789798);
}
$considerWorkspaces = !empty($GLOBALS['BE_USER']->workspace) && \TYPO3\CMS\Backend\Utility\BackendUtility::isTableWorkspaceEnabled($tableName) ? 1 : 0;
if($considerWorkspaces) {
$row = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'*',
$tableName,
'uid=' . intval($uid)
);
$row = $row[0];
\TYPO3\CMS\Backend\Utility\BackendUtility::workspaceOL($tableName, $row);
if(isset($row['_ORIG_uid']))
$uid = $row['_ORIG_uid'];
}
$references = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'*',
'sys_file_reference',
'tablenames=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($tableName, 'sys_file_reference') .
' AND deleted = 0' .
' AND hidden = 0' .
' AND uid_foreign=' . intval($uid) .
' AND fieldname=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($fieldName, 'sys_file_reference'),
'',
'sorting_foreign'
);
foreach ($references as $referenceRecord) {
if($referenceRecord['t3ver_state'] > 0) {
continue;
}
if ($considerWorkspaces) {
\TYPO3\CMS\Backend\Utility\BackendUtility::workspaceOL('sys_file_reference', $referenceRecord);
}
$itemList[] = $this->createFileReferenceObject($referenceRecord);
}
return $itemList;
}@

This works fine for me.

#2 Updated by Marius S. over 2 years ago

Reindl Bernd's version works great for me! Thank you.

Please have this one released.

#3 Updated by Gabe Blair almost 2 years ago

@Reindl: Thanks for the patch. Will you be submitting a Gerrit change for it? You will have a much better chance of getting it into the official core that way.

#4 Updated by Alexander Opitz over 1 year ago

  • Project changed from File Abstraction Layer to Core
  • Category changed from Frontend to Frontend

#5 Updated by Alexander Opitz over 1 year ago

  • Category changed from Frontend to File Abstraction Layer (FAL)
  • Is Regression set to No
  • TYPO3 Version set to 6.0

#6 Updated by Alex Pöll over 1 year ago

Dear TYOP3 core team,

we're using TYPO3 6.1.7 and have experienced this problem. (Images of not yet published content don't show up in Preview).

Although we've implemented the above patch it's still not working.

I'd appreciate if you could help!

Are you going to fix this bug for TYPO3 6.1.7?

And is the same bug present in the new TYPO3 6.2 LTS Version?

Kind regards,
Alex

#7 Updated by Markus Timtner over 1 year ago

Hi Alex,

this issue has forced me to do the update to v6.2LTS - and I am not looking back since ;)
The FAL implementation is now fully Workspace compatible, along with other significant UI improvements.

Kind regards,

MT

#8 Updated by Alex Pöll over 1 year ago

Thanks a lot Markus for your fast response. Sounds good!

#9 Updated by Benjamin Mack over 1 year ago

Hey,

well, files might work, but file relations won't work with repositories at all anymore.

Change an image relation to tt_content (sys_file_reference) in a workspace and publish that - the live workspace will show two records.

#10 Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/29712

#11 Updated by Gerrit Code Review over 1 year ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/29712

#12 Updated by Gerrit Code Review about 1 year ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/29712

#13 Updated by Gerrit Code Review about 1 year ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30100

#14 Updated by Gerrit Code Review about 1 year ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/29712

#15 Updated by Gerrit Code Review about 1 year ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/29712

#16 Updated by Oliver Hader about 1 year ago

  • Parent task set to #58284

#17 Updated by Gerrit Code Review about 1 year ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/29712

#18 Updated by Gerrit Code Review about 1 year ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/29712

#19 Updated by Gerrit Code Review about 1 year ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/29712

#20 Updated by Benjamin Mack about 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#21 Updated by Oliver Hader about 1 year ago

  • Assigned To set to Benjamin Mack

#22 Updated by Alex Pöll about 1 year ago

Dear TYOP3 core team,

we've recently updated (from 6.1.7) to TYPO3 6.2.3 in order to have this problem solved. Unfortunately a new problem come up:

Images of not yet published content (workspaces mode) now appear twice in the backend layout of the page and in the website preview. Please have a look at the attached screenshots.

Thanks for your support,
Alex

#23 Updated by Gerhard Rupp about 1 year ago

It seems that this is fixed in TYPO3 6.2.4.

Also available in: Atom PDF