2 namespace TYPO3\CMS\Rtehtmlarea\Hook\Install;
28 protected $title =
'Deprecated RTE properties in Page TSconfig';
37 'disableRightClick' =>
'contextMenu.disable',
38 'disableContextMenu' =>
'contextMenu.disable',
39 'hidePStyleItems' =>
'buttons.formatblock.removeItems',
40 'hideFontFaces' =>
'buttons.fontstyle.removeItems',
41 'fontFace' =>
'buttons.fontstyle.addItems',
42 'hideFontSizes' =>
'buttons.fontsize.removeItems',
43 'classesCharacter' =>
'buttons.textstyle.tags.span.allowedClasses',
44 'classesParagraph' =>
'buttons.blockstyle.tags.div.allowedClasses',
45 'classesTable' =>
'buttons.blockstyle.tags.table.allowedClasses',
46 'classesTD' =>
'buttons.blockstyle.tags.td.allowedClasses',
47 'classesImage' =>
'buttons.image.properties.class.allowedClasses',
48 'classesLinks' =>
'buttons.link.properties.class.allowedClasses',
49 'blindImageOptions' =>
'buttons.image.options.removeItems',
50 'blindLinkOptions' =>
'buttons.link.options.removeItems',
51 'defaultLinkTarget' =>
'buttons.link.properties.target.default'
61 'disableTYPO3Browsers' => array(
62 'buttons.image.TYPO3Browser.disabled',
63 'buttons.link.TYPO3Browser.disabled'
65 'showTagFreeClasses' => array(
66 'buttons.blockstyle.showTagFreeClasses',
67 'buttons.textstyle.showTagFreeClasses'
69 'disablePCexamples' => array(
70 'buttons.blockstyle.disableStyleOnOptionLabel',
71 'buttons.textstyle.disableStyleOnOptionLabel'
82 'fontSize' =>
'buttons.fontsize.addItems',
83 'RTE.default.classesAnchor' =>
'RTE.default.buttons.link.properties.class.allowedClasses',
84 'RTE.default.classesAnchor.default.[link-type]' =>
'RTE.default.buttons.link.[link-type].properties.class.default',
85 'mainStyleOverride' =>
'contentCSS',
86 'mainStyleOverride_add.[key]' =>
'contentCSS',
87 'mainStyle_font' =>
'contentCSS',
88 'mainStyle_size' =>
'contentCSS',
89 'mainStyle_color' =>
'contentCSS',
90 'mainStyle_bgcolor' =>
'contentCSS',
91 'inlineStyle.[any-keystring]' =>
'contentCSS',
92 'ignoreMainStyleOverride' =>
'n.a.'
106 $pagesCount = count($pages);
107 $deprecatedProperties =
'';
108 $deprecatedRteProperties = array_merge($this->replacementRteProperties, $this->useInsteadRteProperties);
109 foreach ($deprecatedRteProperties as $deprecatedProperty => $replacementProperty) {
110 $deprecatedProperties .=
'<tr><td>' . $deprecatedProperty .
'</td><td>' . $replacementProperty .
'</td></tr>' . LF;
112 foreach ($this->doubleReplacementRteProperties as $deprecatedProperty => $replacementProperties) {
113 $deprecatedProperties .=
'<tr><td>' . $deprecatedProperty .
'</td><td>' . implode(
' and ', $replacementProperties) .
'</td></tr>' . LF;
115 $description =
'<p>The following Page TSconfig RTE properties are deprecated since TYPO3 4.6 and have been removed in TYPO3 6.0.</p>' . LF .
'<table><thead><tr><th>Deprecated property</th><th>Use instead</th></tr></thead>' . LF .
'<tbody>' . $deprecatedProperties .
'</tboby></table>' . LF .
'<p>You are currently using some of these properties on <strong>' . strval($pagesCount) .
' pages</strong> (including deleted and hidden pages).</p>' . LF;
117 $pagesUids = array();
118 foreach ($pages as $page) {
119 $pagesUids[] = $page[
'uid'];
121 $description .=
'<p>Pages id\'s: ' . implode(
', ', $pagesUids) .
'</p>';
123 $replacementProperties =
'';
124 foreach ($this->useInsteadRteProperties as $deprecatedProperty => $replacementProperty) {
125 $replacementProperties .=
'<tr><td>' . $deprecatedProperty .
'</td><td>' . $replacementProperty .
'</td></tr>' . LF;
129 if (!empty($updateablePages)) {
130 $replacementProperties =
'';
131 foreach ($this->replacementRteProperties as $deprecatedProperty => $replacementProperty) {
132 $replacementProperties .=
'<tr><td>' . $deprecatedProperty .
'</td><td>' . $replacementProperty .
'</td></tr>' . LF;
134 $description .=
'<p>This wizard will perform automatic replacement of the following properties on <strong>' . strval(count($updateablePages)) .
' pages</strong> (including deleted and hidden):</p>' . LF .
'<table><thead><tr><th>Deprecated property</th><th>Will be replaced by</th></tr></thead><tbody>' . $replacementProperties .
'</tboby></table>' . LF .
'<p>The Page TSconfig column of the remaining pages will need to be updated manually.</p>' . LF;
136 $replacementProperties =
'';
137 foreach ($this->useInsteadRteProperties as $deprecatedProperty => $_) {
138 $replacementProperties .=
'<tr><td>' . $deprecatedProperty .
'</td></tr>' . LF;
140 foreach ($this->doubleReplacementRteProperties as $deprecatedProperty => $_) {
141 $replacementProperties .=
'<tr><td>' . $deprecatedProperty .
'</td></tr>' . LF;
143 $description .=
'<p>This wizard cannot update the following properties, some of which are present on those pages:</p>' . LF .
'<table><thead><tr><th>Deprecated property</th></tr></thead><tbody>' . $replacementProperties .
'</tboby></table>' . LF .
'<p>Therefore, the Page TSconfig column of those pages will need to be updated manually.</p>' . LF;
153 $description .=
'<p>Only page records are searched for deprecated properties. However, such properties can also be used in BE group and BE user records (prepended with page.). These are not searched nor updated by this wizard.</p>' . LF .
'<p>Page TSconfig may also be included from external files. These are not updated by this wizard. If required, the update will need to be done manually.</p>' . LF .
'<p>Note also that deprecated properties have been replaced in default configurations provided by htmlArea RTE';
167 $customMessages =
'';
169 if (empty($customMessages)) {
170 $pagesCount = count($pages);
173 if (!empty($updateablePages)) {
174 $this->
updatePages($updateablePages, $dbQueries, $customMessages);
176 if (empty($customMessages)) {
178 if (count($updateablePages) === $pagesCount) {
180 if (empty($customMessages)) {
181 if (!empty($pagesAfter)) {
182 $customMessages =
'Some deprecated Page TSconfig properties were found. However, the wizard was unable to automatically replace all the deprecated properties found. Some properties will have to be replaced manually.';
186 $customMessages =
'Some deprecated Page TSconfig properties were found. However, the wizard was unable to automatically replace all the deprecated properties found. Some properties will have to be replaced manually.';
190 $customMessages =
'Some deprecated Page TSconfig properties were found. However, the wizard was unable to automatically replace any of the deprecated properties found. These properties will have to be replaced manually.';
195 return empty($customMessages);
207 $fields =
'uid, TSconfig';
211 foreach (array_merge($this->replacementRteProperties, $this->useInsteadRteProperties, $this->doubleReplacementRteProperties) as $deprecatedRteProperty => $_) {
212 $where .= ($where ?
' OR ' :
'') .
'(TSconfig LIKE BINARY ' . $db->fullQuoteStr(
'%RTE.%' . $deprecatedRteProperty .
'%',
'pages') .
' AND TSconfig NOT LIKE BINARY ' . $db->fullQuoteStr(
'%RTE.%' . $deprecatedRteProperty .
's%',
'pages') .
')' . LF;
214 $res = $db->exec_SELECTquery($fields, $table, $where);
215 $dbQueries[] = str_replace(LF,
' ', $db->debug_lastBuiltQuery);
216 if ($db->sql_error()) {
217 $customMessages =
'SQL-ERROR: ' . htmlspecialchars($db->sql_error());
220 while ($row = $db->sql_fetch_assoc($res)) {
234 foreach ($pages as $index => $page) {
235 $deprecatedProperties = explode(
',',
'/' . implode(
'/,/((RTE\\.(default\\.|config\\.[a-zA-Z0-9_\\-]*\\.[a-zA-Z0-9_\\-]*\\.))|\\s)', array_keys($this->replacementRteProperties)) .
'/');
236 $replacementProperties = explode(
',',
'$1' . implode(
',$1', array_values($this->replacementRteProperties)));
237 $updatedPageTSConfig = preg_replace($deprecatedProperties, $replacementProperties, $page[
'TSconfig']);
238 if ($updatedPageTSConfig == $page[
'TSconfig']) {
239 unset($pages[$index]);
241 $pages[$index][
'TSconfig'] = $updatedPageTSConfig;
254 protected function updatePages($pages, &$dbQueries, &$customMessages)
257 foreach ($pages as $page) {
259 $where =
'uid =' . $page[
'uid'];
260 $field_values = array(
261 'TSconfig' => $page[
'TSconfig']
263 $db->exec_UPDATEquery($table, $where, $field_values);
264 $dbQueries[] = str_replace(LF,
' ', $db->debug_lastBuiltQuery);
265 if ($db->sql_error()) {
266 $customMessages .=
'SQL-ERROR: ' . htmlspecialchars($db->sql_error()) . LF . LF;