Przeglądaj źródła

Allowing the base path used by the build_bootstrap.php script to be configurable as an argument

This is especially useful if your entire Symfony vendor directory is a sunlink. The hardcoded path in build_bootstrap.php means that the target directory is actually the parent directory of where vendor directory symlink target is, not the actual project. This causes the bootstrap files to be built in the wrong directory.
Ryan Weaver 13 lat temu
rodzic
commit
dc8a195574
1 zmienionych plików z 9 dodań i 2 usunięć
  1. 9 2
      Resources/bin/build_bootstrap.php

+ 9 - 2
Resources/bin/build_bootstrap.php

@@ -10,8 +10,15 @@
  * file that was distributed with this source code.
  */
 
-if (!$baseDir = realpath(__DIR__.'/../../../../../../..')) {
-    exit('Looks like you don\'t have a standard layout.');
+$argv = $_SERVER['argv'];
+
+// allow the base path to be passed as the first argument, or default
+if (isset($argv[1])) {
+    $baseDir = $argv[1];
+} else {
+    if (!$baseDir = realpath(__DIR__.'/../../../../../../..')) {
+        exit('Looks like you don\'t have a standard layout.');
+    }
 }
 
 require_once $baseDir.'/vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';