26 protected $title =
'Deprecated RTE properties in Page TSconfig';
30 'disableRightClick' =>
'contextMenu.disable',
31 'disableContextMenu' =>
'contextMenu.disable',
32 'hidePStyleItems' =>
'buttons.formatblock.removeItems',
33 'hideFontFaces' =>
'buttons.fontstyle.removeItems',
34 'fontFace' =>
'buttons.fontstyle.addItems',
35 'hideFontSizes' =>
'buttons.fontsize.removeItems',
36 'classesCharacter' =>
'buttons.textstyle.tags.span.allowedClasses',
37 'classesParagraph' =>
'buttons.blockstyle.tags.div.allowedClasses',
38 'classesTable' =>
'buttons.blockstyle.tags.table.allowedClasses',
39 'classesTD' =>
'buttons.blockstyle.tags.td.allowedClasses',
40 'classesImage' =>
'buttons.image.properties.class.allowedClasses',
41 'classesLinks' =>
'buttons.link.properties.class.allowedClasses',
42 'blindImageOptions' =>
'buttons.image.options.removeItems',
43 'blindLinkOptions' =>
'buttons.link.options.removeItems',
44 'defaultLinkTarget' =>
'buttons.link.properties.target.default' 48 'disableTYPO3Browsers' => array(
49 'buttons.image.TYPO3Browser.disabled',
50 'buttons.link.TYPO3Browser.disabled' 52 'showTagFreeClasses' => array(
53 'buttons.blockstyle.showTagFreeClasses',
54 'buttons.textstyle.showTagFreeClasses' 56 'disablePCexamples' => array(
57 'buttons.blockstyle.disableStyleOnOptionLabel',
58 'buttons.textstyle.disableStyleOnOptionLabel' 64 'fontSize' =>
'buttons.fontsize.addItems',
65 'RTE.default.classesAnchor' =>
'RTE.default.buttons.link.properties.class.allowedClasses',
66 'RTE.default.classesAnchor.default.[link-type]' =>
'RTE.default.buttons.link.[link-type].properties.class.default',
67 'mainStyleOverride' =>
'contentCSS',
68 'mainStyleOverride_add.[key]' =>
'contentCSS',
69 'mainStyle_font' =>
'contentCSS',
70 'mainStyle_size' =>
'contentCSS',
71 'mainStyle_color' =>
'contentCSS',
72 'mainStyle_bgcolor' =>
'contentCSS',
73 'inlineStyle.[any-keystring]' =>
'contentCSS',
74 'ignoreMainStyleOverride' =>
'n.a.' 86 if ($this->versionNumber >= 4006000) {
87 $pages = $this->getPagesWithDeprecatedRteProperties($dbQueries, $customMessages);
88 $pagesCount = count($pages);
89 $deprecatedProperties =
'';
90 $deprecatedRteProperties = array_merge($this->replacementRteProperties, $this->useInsteadRteProperties);
91 foreach ($deprecatedRteProperties as $deprecatedProperty => $replacementProperty) {
92 $deprecatedProperties .=
'<tr><td>' . $deprecatedProperty .
'</td><td>' . $replacementProperty .
'</td></tr>' . LF;
94 foreach ($this->doubleReplacementRteProperties as $deprecatedProperty => $replacementProperties) {
95 $deprecatedProperties .=
'<tr><td>' . $deprecatedProperty .
'</td><td>' . implode(
' and ', $replacementProperties) .
'</td></tr>' . LF;
97 $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;
100 foreach ($pages as $page) {
101 $pagesUids[] = $page[
'uid'];
103 $description .=
'<p>Pages id\'s: ' . implode(
', ', $pagesUids) .
'</p>';
105 $replacementProperties =
'';
106 foreach ($this->useInsteadRteProperties as $deprecatedProperty => $replacementProperty) {
107 $replacementProperties .=
'<tr><td>' . $deprecatedProperty .
'</td><td>' . $replacementProperty .
'</td></tr>' . LF;
111 if (count($updateablePages)) {
112 $replacementProperties =
'';
113 foreach ($this->replacementRteProperties as $deprecatedProperty => $replacementProperty) {
114 $replacementProperties .=
'<tr><td>' . $deprecatedProperty .
'</td><td>' . $replacementProperty .
'</td></tr>' . LF;
116 $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;
118 $replacementProperties =
'';
119 foreach ($this->useInsteadRteProperties as $deprecatedProperty => $_) {
120 $replacementProperties .=
'<tr><td>' . $deprecatedProperty .
'</td></tr>' . LF;
122 foreach ($this->doubleReplacementRteProperties as $deprecatedProperty => $_) {
123 $replacementProperties .=
'<tr><td>' . $deprecatedProperty .
'</td></tr>' . LF;
125 $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;
135 $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';
148 $customMessages =
'';
149 $pages = $this->getPagesWithDeprecatedRteProperties($dbQueries, $customMessages);
150 if (empty($customMessages)) {
151 $pagesCount = count($pages);
154 if (count($updateablePages)) {
155 $this->
updatePages($updateablePages, $dbQueries, $customMessages);
157 if (empty($customMessages)) {
159 if (count($updateablePages) === $pagesCount) {
160 $pagesAfter = $this->getPagesWithDeprecatedRteProperties($dbQueries, $customMessages);
161 if (empty($customMessages)) {
162 if (count($pagesAfter)) {
163 $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.';
167 $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.';
171 $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.';
176 return empty($customMessages);
186 protected function getPagesWithDeprecatedRteProperties(&$dbQueries, &$customMessages) {
187 $fields =
'uid, TSconfig';
192 foreach (array_merge($this->replacementRteProperties, $this->useInsteadRteProperties, $this->doubleReplacementRteProperties) as $deprecatedRteProperty => $_) {
193 $where .= ($where ?
' OR ' :
'') .
'(TSConfig LIKE BINARY ' . $db->fullQuoteStr(
'%RTE.%' . $deprecatedRteProperty .
'%',
'pages') .
' AND TSConfig NOT LIKE BINARY ' . $db->fullQuoteStr(
'%RTE.%' . $deprecatedRteProperty .
's%',
'pages') .
')' . LF;
195 $res = $db->exec_SELECTquery($fields, $table, $where);
196 $dbQueries[] = str_replace(chr(10),
' ',
$GLOBALS[
'TYPO3_DB']->debug_lastBuiltQuery);
197 if ($db->sql_error()) {
198 $customMessages =
'SQL-ERROR: ' . htmlspecialchars($db->sql_error());
201 while ($row = $db->sql_fetch_assoc($res)) {
214 foreach ($pages as $index => $page) {
215 $deprecatedProperties = explode(
',',
'/' . implode(
'/,/((RTE\\.(default\\.|config\\.[a-zA-Z0-9_\\-]*\\.[a-zA-Z0-9_\\-]*\\.))|\\s)', array_keys($this->replacementRteProperties)) .
'/');
216 $replacementProperties = explode(
',',
'$1' . implode(
',$1', array_values($this->replacementRteProperties)));
217 $updatedPageTSConfig = preg_replace($deprecatedProperties, $replacementProperties, $page[
'TSconfig']);
218 if ($updatedPageTSConfig == $page[
'TSconfig']) {
219 unset($pages[$index]);
221 $pages[$index][
'TSconfig'] = $updatedPageTSConfig;
234 protected function updatePages($pages, &$dbQueries, &$customMessages) {
235 foreach ($pages as $page) {
237 $where =
'uid =' . $page[
'uid'];
238 $field_values = array(
239 'TSconfig' => $page[
'TSconfig']
241 $GLOBALS[
'TYPO3_DB']->exec_UPDATEquery($table, $where, $field_values);
242 $dbQueries[] = str_replace(chr(10),
' ',
$GLOBALS[
'TYPO3_DB']->debug_lastBuiltQuery);
243 if (
$GLOBALS[
'TYPO3_DB']->sql_error()) {
244 $customMessages .=
'SQL-ERROR: ' . htmlspecialchars(
$GLOBALS[
'TYPO3_DB']->sql_error()) . LF . LF;
findUpdateablePagesWithDeprecatedRteProperties(&$pages)
$doubleReplacementRteProperties
performUpdate(array &$dbQueries, &$customMessages)
$replacementRteProperties
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
markWizardAsDone($confValue=1)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
checkForUpdate(&$description)
updatePages($pages, &$dbQueries, &$customMessages)