2 namespace TYPO3\CMS\Install\Updates;
27 protected $title =
'Migrate CTypes text, image and textpic to textmedia and move file relations from "image" to "media_references"';
44 $updateNeeded =
false;
49 'CType IN (\'text\', \'image\', \'textpic\')'
52 if ($nonTextmediaCount === 0) {
53 $updateNeeded =
false;
57 $description =
'The extension "fluid_styled_content" is using a new CType, textmedia, ' .
58 'which replaces the CTypes text, image and textpic. ' .
59 'This update wizard migrates these old CTypes to the new one in the database. ' .
60 'If backend groups have the explicit deny/allow flag set for any of the old CTypes, ' .
61 'the according flag for the CType textmedia is set as well.';
73 public function performUpdate(array &$databaseQueries, &$customMessages)
76 $databaseConnection->store_lastBuiltQuery =
true;
79 $databaseConnection->exec_UPDATEquery(
81 'tt_content.CType=' . $databaseConnection->fullQuoteStr(
'text',
'tt_content'),
83 'CType' =>
'textmedia',
88 $databaseQueries[] = str_replace(chr(10),
' ', $databaseConnection->debug_lastBuiltQuery);
90 if ($databaseConnection->sql_error()) {
91 $customMessages =
'SQL-ERROR: ' . htmlspecialchars($databaseConnection->sql_error());
98 LEFT JOIN sys_file_reference
99 ON sys_file_reference.uid_foreign=tt_content.uid
100 AND sys_file_reference.tablenames=' . $databaseConnection->fullQuoteStr(
'tt_content',
'sys_file_reference')
101 .
' AND sys_file_reference.fieldname=' . $databaseConnection->fullQuoteStr(
'image',
'sys_file_reference')
102 .
' SET tt_content.CType=' . $databaseConnection->fullQuoteStr(
'textmedia',
'tt_content')
103 .
', tt_content.assets=tt_content.image,
105 sys_file_reference.fieldname=' . $databaseConnection->fullQuoteStr(
'assets',
'tt_content')
107 tt_content.CType=' . $databaseConnection->fullQuoteStr(
'textpic',
'tt_content')
108 .
' OR tt_content.CType=' . $databaseConnection->fullQuoteStr(
'image',
'tt_content');
109 $databaseConnection->sql_query($query);
112 $databaseQueries[] = str_replace(chr(10),
' ', $query);
114 if ($databaseConnection->sql_error()) {
115 $customMessages =
'SQL-ERROR: ' . htmlspecialchars($databaseConnection->sql_error());
120 $databaseConnection->exec_UPDATEquery(
122 '(explicit_allowdeny LIKE ' . $databaseConnection->fullQuoteStr(
'%' . $databaseConnection->escapeStrForLike(
'tt_content:CType:textpic:ALLOW',
'tt_content') .
'%',
'tt_content')
123 .
' OR explicit_allowdeny LIKE ' . $databaseConnection->fullQuoteStr(
'%' . $databaseConnection->escapeStrForLike(
'tt_content:CType:image:ALLOW',
'tt_content') .
'%',
'tt_content')
124 .
' OR explicit_allowdeny LIKE ' . $databaseConnection->fullQuoteStr(
'%' . $databaseConnection->escapeStrForLike(
'tt_content:CType:text:ALLOW',
'tt_content') .
'%',
'tt_content')
125 .
') AND explicit_allowdeny NOT LIKE ' . $databaseConnection->fullQuoteStr(
'%' . $databaseConnection->escapeStrForLike(
'tt_content:CType:textmedia:ALLOW',
'tt_content') .
'%',
'tt_content'),
127 'explicit_allowdeny' =>
'CONCAT(explicit_allowdeny,' . $databaseConnection->fullQuoteStr(
',tt_content:CType:textmedia:ALLOW',
'tt_content') .
')',
130 'explicit_allowdeny',
135 $databaseQueries[] = str_replace(chr(10),
' ', $databaseConnection->debug_lastBuiltQuery);
138 $databaseConnection->exec_UPDATEquery(
140 '(explicit_allowdeny LIKE ' . $databaseConnection->fullQuoteStr(
'%' . $databaseConnection->escapeStrForLike(
'tt_content:CType:textpic:DENY',
'tt_content') .
'%',
'tt_content')
141 .
' OR explicit_allowdeny LIKE ' . $databaseConnection->fullQuoteStr(
'%' . $databaseConnection->escapeStrForLike(
'tt_content:CType:image:DENY',
'tt_content') .
'%',
'tt_content')
142 .
' OR explicit_allowdeny LIKE ' . $databaseConnection->fullQuoteStr(
'%' . $databaseConnection->escapeStrForLike(
'tt_content:CType:text:DENY',
'tt_content') .
'%',
'tt_content')
143 .
') AND explicit_allowdeny NOT LIKE ' . $databaseConnection->fullQuoteStr(
'%' . $databaseConnection->escapeStrForLike(
'tt_content:CType:textmedia:DENY',
'tt_content') .
'%',
'tt_content'),
145 'explicit_allowdeny' =>
'CONCAT(explicit_allowdeny,' . $databaseConnection->fullQuoteStr(
',tt_content:CType:textmedia:DENY',
'tt_content') .
')',
148 'explicit_allowdeny',
153 $databaseQueries[] = str_replace(chr(10),
' ', $databaseConnection->debug_lastBuiltQuery);