Project

General

Profile

Typo3 V10 > V11 » History » Version 21

Philipp Gröbelbauer, 09.06.2023 12:12

1 1 Enis Nuredini
h1. Migration Typo3 v10 > v11
2
3
Some changes in php are needed to get QFQ work in v11.
4
5 18 Philipp Gröbelbauer
Follow these steps:
6
7
* Install ig_ldap_sso_auth v3.7.1
8
* Install qfq v23.6.0 or higher
9
* Replace symlink typo3_src
10
** rm typo3_src
11
** ln -s /var/www/typo3_src-10.5.25/ typo3_src
12
13
* go to installtool: /typo3/install.php
14 19 Philipp Gröbelbauer
** Upgrade: Run the upgrade wizard 
15 21 Philipp Gröbelbauer
*** *DO NOT*  Execute any of the upgrades that install extensions. Also not needed: "Sanitize existing SVG files in fileadmin folder"
16 19 Philipp Gröbelbauer
*** *DO NOT* execute "Migrate backend users' selected UI languages to new format."
17 18 Philipp Gröbelbauer
** Maintenance:
18
*** Database analyzer and apply the changes
19
*** Flush Caches
20 20 Philipp Gröbelbauer
** Environment: Directory Status" and autofix problems
21
22 18 Philipp Gröbelbauer
23
24
25
26 10 Enis Nuredini
h3. 1. Extensions Upgrades
27 3 Enis Nuredini
28 4 Enis Nuredini
|_.Extension|_.Version|
29 2 Enis Nuredini
|  LDAP|  V3.7.1|
30
31 16 Enis Nuredini
h2. Punkt 2, 3 und 4 werden nicht mehr benötigt wenn aktuellste QFQ Dev Version verwendet wird! 
32
(Master Release noch in Arbeit).
33 2 Enis Nuredini
34 10 Enis Nuredini
h3. 2. File ext_localconf.php
35 1 Enis Nuredini
36
The configurePlugin block needs to be changed to following:
37
<pre>
38
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
39
    'IMATHUZH.qfq',
40
    'Qfq',
41
    [\IMATHUZH\Qfq\Controller\QfqController::class => 'show'],
42
    [\IMATHUZH\Qfq\Controller\QfqController::class => 'show'], // put here as well, if controller output must not be cached
43
    \TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
44
);
45
</pre>
46
47
48 10 Enis Nuredini
h3. 3. QFQ Class QfqController.php
49 1 Enis Nuredini
50
Two new needed Classes needs to be linked:
51
<pre>
52
use Psr\Http\Message\ResponseInterface;
53
use TYPO3\CMS\Core\Http\HtmlResponse;
54
</pre>
55
56
Changes for the showAction() function:
57
<pre>
58
    public function showAction(): ResponseInterface {
59
60
        $html = '';
61
        $origErrorReporting = '';
62
        $flagOk = false;
63
64
        try {
65
            $contentObject = $this->configurationManager->getContentObject();
66
67
            // By T3 default 'E_NOTICE' is unset. E.g. 'Undefined Index' will throw an exception.
68
            // QFQ like to see those 'E_NOTICE'
69
            $origErrorReporting = error_reporting();
70
            error_reporting($origErrorReporting | E_NOTICE);
71
72
            $qfq = new QuickFormQuery($contentObject->data);
73
            $html = $qfq->process();
74
            $flagOk = true;
75
76
        } catch (\UserFormException $e) {
77
            $html = $e->formatMessage();
78
79
        } catch (\UserReportException $e) {
80
            $html = $e->formatMessage();
81
82
        } catch (\CodeException $e) {
83
            $html = $e->formatMessage();
84
85
        } catch (\DbException $e) {
86
            $html = $e->formatMessage();
87
88
        } catch (\ShellException $e) {
89
            $html = $e->formatMessage();
90
91
        } catch (\DownloadException $e) {
92
            $html = $e->formatMessage();
93
94
        } catch (\Exception $e) {
95
            $ee = new \UserReportException(json_encode([
96
                ERROR_MESSAGE_TO_USER => "Generic Exception: " . $e->getMessage(),
97
                ERROR_MESSAGE_TO_DEVELOPER => $e->getTraceAsString()]), E_ERROR);
98
            $html = $ee->formatMessage();
99
        } catch (\Throwable $e) {
100
            $ee = new \UserReportException(json_encode([
101
                ERROR_MESSAGE_TO_USER => "Generic Error: " . $e->getMessage(),
102
                ERROR_MESSAGE_TO_DEVELOPER => $e->getTraceAsString()]), E_ERROR);
103
            $html = $ee->formatMessage();
104
        }
105
106
        if (isset($e) && $e->getCode() == ERROR_QUIT_QFQ_REGULAR) {
107
            $flagOk = true;
108
        }
109
110
        if (!$flagOk) {
111
            $html = "<div class='alert alert-warning'>$html</div>";
112
        }
113
114
        // Restore has to be outside of try/catch - E_NOTICE needs to unset for further T3 handling after an QFQ Exception.
115
        error_reporting($origErrorReporting);
116
117
        $this->view->assign('qfqOutput', $html);
118
        $content = $this->view->render();
119
        
120
        return new HtmlResponse($content);
121
    }
122
</pre>
123
124
We see that the new Typo3 versions are waiting for returned HtmlResponse Objects.
125 5 Enis Nuredini
126 10 Enis Nuredini
h3. 4. Services.yaml (necessary file)
127 5 Enis Nuredini
128 8 Enis Nuredini
For correct qfqController handling and preventing use of ObjectManager (which is deprecated in T3 V12) a Services.yaml file is needed. Location for this file is to set in /typo3conf/ext/qfq/Configuration
129 7 Enis Nuredini
130 5 Enis Nuredini
Content of the file:
131
<pre>
132
services:
133
  IMATHUZH\Qfq\Controller\QfqController:
134
    autowire: true
135
    autoconfigure: true
136 1 Enis Nuredini
    public: false
137
</pre>
138
139
Cache should be flushed after creating Services.yaml: Admin Tools > Maintenance > Flush TYPO3 and PHP Cache (Flush cache).
140 10 Enis Nuredini
141
h3. 5. Felogin with Fluid Template
142
143 17 Enis Nuredini
The actually used login template from uzh_cd extension sometimes doesnt work for Typo3 V11. Newly a fluid template is required and login/logout are separately defined. Current solution to get it work is to write the templates named with Login.html and Logout.html. These two files needs to overwrite the existing ones under following directory: typo3/sysext/felogin/Resources/Private/Templates/Login
144 10 Enis Nuredini
145
The better solution would be using own path for the templates, which didnt work to me, but maybe it works for someone:
146
147
<pre>
148
plugin.tx_felogin {
149
    view {
150
        templateRootPaths {
151
            100 = EXT:uzh_cd_template/Resources/Private/Templates
152
        }
153
    }
154
}
155
</pre> 
156
157
Template files with content for the default fluid versions of the uzh templates are uploaded here and should match the old design (little bit specified for the geolean tool, do your own changes). Its not dynamically customizable over Typo3 Backend like the old template.
158
159
Examples of currently not working typoScript configurations for felogin:
160
* Linking own template
161
* Using own message wraps commands like this one: plugin.tx_felogin_pi1.errorMessage_stdWrap.wrap =
162 12 Enis Nuredini
163
h3. 6. Custom CSS Files
164
165 13 Enis Nuredini
The given token 'cd.stylesheet =' from uzh_cd extension would not work correctly anymore with relative paths in newer Typo3 versions. The reason are used pageSlugs, which changes the path for the given custom CSS in every visited page. 
166
167
Here are two example results with following used TypoScript config: cd.stylesheet = fileadmin/templates/custom.css:
168 12 Enis Nuredini
169
Working version:
170
<pre>
171
Typo3 V8 with index.php and example page 
172
www.domain.com/index.php?id=10 -> www.domain.com/fileadmin/templates/custom.css
173
</pre>
174
175
Not working version:
176
<pre>
177
Typo3 V11 with pageSlug and example page
178 14 Enis Nuredini
www.domain.com/subpage -> www.domain.com/subpage/fileadmin/templates/custom.css
179 12 Enis Nuredini
</pre>
180
181
Solution: Use absolute paths for custom files in cd.stylesheet option.