|
@@ -24,17 +24,17 @@ discard block |
|
|
block discarded – undo |
|
24
|
24
|
|
|
25
|
25
|
$bootstrapDir = __DIR__; |
|
26
|
26
|
$levels = 2; |
|
27
|
|
-if(false !== stripos($bootstrapDir, 'vendor')) { |
|
|
27
|
+if (false !== stripos($bootstrapDir, 'vendor')) { |
|
28
|
28
|
$levels = 4; |
|
29
|
29
|
}// .../psfs/core/src |
|
30
|
|
-$vendorDir = dirname($bootstrapDir, $levels) . '/vendor'; |
|
|
30
|
+$vendorDir = dirname($bootstrapDir, $levels).'/vendor'; |
|
31
|
31
|
$projectRoot = dirname($bootstrapDir, $levels); // When running as vendor |
|
32
|
32
|
|
|
33
|
33
|
// Standalone mode: PSFS cloned and executed directly (no vendor/) |
|
34
|
34
|
$standaloneRoot = dirname($bootstrapDir, $levels - 1); // .../psfs-core |
|
35
|
35
|
|
|
36
|
36
|
// Detect vendor mode (framework inside vendor/) |
|
37
|
|
-$runningAsVendor = file_exists($vendorDir . '/autoload.php'); |
|
|
37
|
+$runningAsVendor = file_exists($vendorDir.'/autoload.php'); |
|
38
|
38
|
|
|
39
|
39
|
// Detect standalone mode |
|
40
|
40
|
$runningStandalone = !$runningAsVendor; |
|
@@ -47,21 +47,21 @@ discard block |
|
|
block discarded – undo |
|
47
|
47
|
defined('SOURCE_DIR') or define('SOURCE_DIR', $bootstrapDir); |
|
48
|
48
|
if ($runningAsVendor) { |
|
49
|
49
|
// PSFS is being executed as a dependency in another project |
|
50
|
|
- defined('BASE_DIR') or define('BASE_DIR', dirname($vendorDir, 1)); // The root of the host project |
|
51
|
|
- defined('CORE_DIR') or define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
|
50
|
+ defined('BASE_DIR') or define('BASE_DIR', dirname($vendorDir, 1)); // The root of the host project |
|
|
51
|
+ defined('CORE_DIR') or define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src'); |
|
52
|
52
|
defined('PSFS_AS_VENDOR') or define('PSFS_AS_VENDOR', true); |
|
53
|
|
-} else { |
|
|
53
|
+}else { |
|
54
|
54
|
// Standalone development mode |
|
55
|
55
|
defined('BASE_DIR') or define('BASE_DIR', $standaloneRoot); |
|
56
|
|
- defined('CORE_DIR') or define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
|
56
|
+ defined('CORE_DIR') or define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules'); |
|
57
|
57
|
defined('PSFS_AS_VENDOR') or define('PSFS_AS_VENDOR', false); |
|
58
|
58
|
} |
|
59
|
|
-defined('VENDOR_DIR') or define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
60
|
|
-defined('LOG_DIR') or define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
61
|
|
-defined('CACHE_DIR') or define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
62
|
|
-defined('CONFIG_DIR') or define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
63
|
|
-defined('WEB_DIR') or define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
64
|
|
-defined('LOCALE_DIR') or define('LOCALE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
|
59
|
+defined('VENDOR_DIR') or define('VENDOR_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'vendor'); |
|
|
60
|
+defined('LOG_DIR') or define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
|
61
|
+defined('CACHE_DIR') or define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache'); |
|
|
62
|
+defined('CONFIG_DIR') or define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config'); |
|
|
63
|
+defined('WEB_DIR') or define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html'); |
|
|
64
|
+defined('LOCALE_DIR') or define('LOCALE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
65
|
65
|
|
|
66
|
66
|
// ----------------------------------------------------------------------------- |
|
67
|
67
|
// 4. Load Composer autoload |
|
@@ -69,10 +69,10 @@ discard block |
|
|
block discarded – undo |
|
69
|
69
|
|
|
70
|
70
|
if ($runningAsVendor) { |
|
71
|
71
|
// Autoload from the host project's vendor directory |
|
72
|
|
- require_once $vendorDir . '/autoload.php'; |
|
73
|
|
-} else { |
|
|
72
|
+ require_once $vendorDir.'/autoload.php'; |
|
|
73
|
+}else { |
|
74
|
74
|
// Standalone mode: PSFS itself is the project root |
|
75
|
|
- $standaloneAutoload = BASE_DIR . '/vendor/autoload.php'; |
|
|
75
|
+ $standaloneAutoload = BASE_DIR.'/vendor/autoload.php'; |
|
76
|
76
|
if (!file_exists($standaloneAutoload)) { |
|
77
|
77
|
throw new RuntimeException( |
|
78
|
78
|
"Composer autoload not found. Run 'composer install' in the PSFS root directory." |
|
@@ -85,7 +85,7 @@ discard block |
|
|
block discarded – undo |
|
85
|
85
|
// ----------------------------------------------------------------------------- |
|
86
|
86
|
// 5. Global helper functions |
|
87
|
87
|
// ----------------------------------------------------------------------------- |
|
88
|
|
-require_once SOURCE_DIR . '/functions.php'; |
|
|
88
|
+require_once SOURCE_DIR.'/functions.php'; |
|
89
|
89
|
|
|
90
|
90
|
|
|
91
|
91
|
// ----------------------------------------------------------------------------- |