[TASK] Inform about invalid index.php symlink 39/34339/3
authorMarkus Klein <klein.t3@reelworx.at>
Tue, 7 Oct 2014 22:24:06 +0000 (00:24 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 19 Nov 2014 20:01:11 +0000 (21:01 +0100)
Add a verbose message to inform the user about a possibly
wrong index.php symlink in case a wrong folder structure
is detected.

Resolves: #62089
Releases: master, 6.2
Change-Id: I9f7e70c2144fe2385751764f9d3abe32f199c030
Reviewed-on: http://review.typo3.org/34339
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php

index d0a2697..c5aaed1 100644 (file)
@@ -179,10 +179,14 @@ class SystemEnvironmentBuilder {
         */
        static protected function checkMainPathsExist() {
                if (!is_file(PATH_thisScript)) {
-                       die('Unable to determine path to entry script.');
+                       static::dieWithMessage('Unable to determine path to entry script.');
                }
                if (!is_dir(PATH_tslib)) {
-                       die('Calculated absolute path to tslib directory does not exist.');
+                       static::dieWithMessage('Calculated absolute path to tslib directory does not exist.' . LF . LF
+                               . 'Something in the main file, folder and link structure is wrong and must be fixed! A typical document root contains a couple of symbolic links:' . LF
+                               . '* A symlink "typo3_src" pointing to the TYPO3 CMS core.' . LF
+                               . '* A symlink "typo3" - the backend entry point - pointing to "typo3_src/typo3"' . LF
+                               . '* A symlink "index.php" - the frontend entry point - points to "typo3_src/index.php"');
                }
        }
 
@@ -455,7 +459,7 @@ class SystemEnvironmentBuilder {
                } elseif (substr(TYPO3_MOD_PATH, 0, strlen('../typo3conf/')) === '../typo3conf/') {
                        $pathPartRelativeToDocumentRoot = substr(TYPO3_MOD_PATH, 3);
                } else {
-                       die('Unable to determine TYPO3 document root.');
+                       static::dieWithMessage('Unable to determine TYPO3 document root.');
                }
                $entryScriptDirectory = self::getUnifiedDirectoryNameWithTrailingSlash(PATH_thisScript);
                return substr($entryScriptDirectory, 0, -strlen($pathPartRelativeToDocumentRoot));
@@ -490,4 +494,14 @@ class SystemEnvironmentBuilder {
                }
                return $directory . '/';
        }
+
+       /**
+        * Echo out a text message and die
+        *
+        * @param string $message
+        */
+       static protected function dieWithMessage($message) {
+               header('Content-type: text/plain');
+               die($message);
+       }
 }