@@ -62,6 +62,8 @@ public function serves($sitePath, $siteName, $uri)
6262 */
6363 public function isStaticFile ($ sitePath , $ siteName , $ uri )
6464 {
65+ $ uri = $ this ->isVersionNumberInFilename ($ sitePath . $ this ->documentRoot . $ uri , $ uri );
66+
6567 if (file_exists ($ filePath = $ sitePath . $ this ->documentRoot . $ uri )
6668 && ! is_dir ($ filePath )
6769 && pathinfo ($ filePath )['extension ' ] !== 'php ' )
@@ -84,6 +86,7 @@ public function isStaticFile($sitePath, $siteName, $uri)
8486 */
8587 public function frontControllerPath ($ sitePath , $ siteName , $ uri )
8688 {
89+ $ this ->directLoginToInstallTool ($ uri );
8790 $ this ->authorizeAccess ($ uri );
8891 $ uri = rtrim ($ uri , '/ ' );
8992 $ absoluteFilePath = $ sitePath . $ this ->documentRoot . $ uri ;
@@ -156,4 +159,38 @@ private function authorizeAccess($uri)
156159 }
157160 }
158161 }
162+
163+
164+ /**
165+ * Rule for versioned static files, configured through:
166+ * - $GLOBALS['TYPO3_CONF_VARS']['BE']['versionNumberInFilename']
167+ * - $GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename']
168+ *
169+ * @param string $filePath
170+ * @param string $uri
171+ * @return string $uri
172+ */
173+ private function isVersionNumberInFilename ($ filePath , $ uri ) {
174+ if ( ! file_exists ($ filePath ) &&
175+ preg_match ("/^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$/ " , $ uri )
176+ ) {
177+ return preg_replace ("/^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$/ " , "$1.$3 " , $ uri );
178+ }
179+
180+ return $ uri ;
181+ }
182+
183+ /**
184+ * Direct access to installtool via domain.dev/typo3/install/
185+ * Will be redirected to the sysext install script
186+ *
187+ * @param string $uri
188+ */
189+ private function directLoginToInstallTool ($ uri ) {
190+ if (preg_match ("/^\/typo3\/install$/ " , rtrim ($ uri )))
191+ {
192+ header ('Location: /typo3/sysext/install/Start/Install.php ' );
193+ die ();
194+ }
195+ }
159196}
0 commit comments