[TASK] Inform about invalid index.php symlink 97/33197/7
authorMarkus Klein <klein.t3@reelworx.at>
Tue, 7 Oct 2014 22:24:06 +0000 (00:24 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Wed, 19 Nov 2014 11:22:04 +0000 (12:22 +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/33197
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php

index fbc55c1..e20e5c2 100644 (file)
@@ -176,10 +176,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_typo3 . 'sysext')) {
-                       die('Calculated absolute path to typo3/sysext directory does not exist.');
+                       static::dieWithMessage('Calculated absolute path to typo3/sysext 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"');
                }
        }
 
@@ -452,7 +456,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));
@@ -487,4 +491,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);
+       }
 }