summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2018-09-12 11:27:49 (GMT)
committerAlex Pott2018-09-12 11:27:56 (GMT)
commit837247a2f546c7acc842169de87ce579a84543c1 (patch)
tree15fb98ea7e2e9edbe18836429a1904a51d1e5977
parent9130e65fbedcdeb3cb40f0fda8ca9983e5fbfc63 (diff)
Issue #2905109 by iainp999, gawaksh, msankhala, joachim, borisson_, alexpott: DrupalKernel::guessApplicationRoot() should document what the assumptions are and what it's doing
(cherry picked from commit 03a3058d690498b7b5356a30c831aa48e04f0fcc)
-rw-r--r--core/lib/Drupal/Core/DrupalKernel.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 73022a5..6bb1c24 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -298,12 +298,16 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
}
/**
- * Determine the application root directory based on assumptions.
+ * Determine the application root directory based on this file's location.
*
* @return string
* The application root.
*/
protected static function guessApplicationRoot() {
+ // Determine the application root by:
+ // - Removing the namespace directories from the path.
+ // - Getting the path to the directory two levels up from the path
+ // determined in the previous step.
return dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
}