‪TYPO3CMS  9.5
Environment.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 namespace ‪TYPO3\CMS\Core\Core;
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
39 {
44  protected static ‪$supportedCgiServerApis = [
45  'fpm-fcgi',
46  'cgi',
47  'isapi',
48  'cgi-fcgi',
49  'srv', // HHVM with fastcgi
50  ];
51 
52  protected static ‪$cli;
53  protected static ‪$composerMode;
54  protected static ‪$context;
55  protected static ‪$projectPath;
56  protected static ‪$publicPath;
57  protected static ‪$currentScript;
58  protected static ‪$os;
59  protected static ‪$varPath;
60  protected static ‪$configPath;
61 
78  public static function ‪initialize(
80  bool ‪$cli,
81  bool ‪$composerMode,
82  string ‪$projectPath,
83  string ‪$publicPath,
84  string ‪$varPath,
85  string ‪$configPath,
86  string ‪$currentScript,
87  string ‪$os
88  ) {
89  self::$cli = ‪$cli;
90  self::$composerMode = ‪$composerMode;
91  self::$context = ‪$context;
92  self::$projectPath = ‪$projectPath;
93  self::$publicPath = ‪$publicPath;
94  self::$varPath = ‪$varPath;
95  self::$configPath = ‪$configPath;
96  self::$currentScript = ‪$currentScript;
97  self::$os = ‪$os;
98  }
99 
107  public static function ‪getContext(): ‪ApplicationContext
108  {
109  return ‪self::$context;
110  }
111 
118  public static function ‪isComposerMode(): bool
119  {
120  return ‪self::$composerMode;
121  }
122 
128  public static function ‪isCli(): bool
129  {
130  return ‪self::$cli;
131  }
132 
143  public static function ‪getProjectPath(): string
144  {
145  return ‪self::$projectPath;
146  }
147 
154  public static function ‪getPublicPath(): string
155  {
156  return ‪self::$publicPath;
157  }
158 
166  public static function ‪getVarPath(): string
167  {
168  return ‪self::$varPath;
169  }
170 
184  public static function ‪getConfigPath(): string
185  {
186  return ‪self::$configPath;
187  }
188 
194  public static function ‪getCurrentScript(): string
195  {
197  }
198 
210  public static function ‪getLabelsPath(): string
211  {
212  if (self::$publicPath === self::$projectPath) {
213  return ‪self::getPublicPath() . '/typo3conf/l10n';
214  }
215  return ‪self::getVarPath() . '/labels';
216  }
217 
224  public static function ‪getBackendPath(): string
225  {
226  return ‪self::getPublicPath() . '/typo3';
227  }
228 
235  public static function ‪getFrameworkBasePath(): string
236  {
237  return ‪self::getPublicPath() . '/typo3/sysext';
238  }
239 
246  public static function ‪getExtensionsPath(): string
247  {
248  return ‪self::getPublicPath() . '/typo3conf/ext';
249  }
250 
257  public static function ‪getLegacyConfigPath(): string
258  {
259  return ‪self::getPublicPath() . '/typo3conf';
260  }
261 
267  public static function ‪isWindows(): bool
268  {
269  return self::$os === 'WINDOWS';
270  }
271 
277  public static function ‪isUnix(): bool
278  {
279  return self::$os === 'UNIX';
280  }
281 
287  public static function ‪isRunningOnCgiServer(): bool
288  {
289  return in_array(PHP_SAPI, self::$supportedCgiServerApis, true);
290  }
291 }
‪TYPO3\CMS\Core\Core\Environment\getPublicPath
‪static string getPublicPath()
Definition: Environment.php:153
‪TYPO3\CMS\Core\Core\Environment\isRunningOnCgiServer
‪static bool isRunningOnCgiServer()
Definition: Environment.php:286
‪TYPO3\CMS\Core\Core\Environment\getLabelsPath
‪static string getLabelsPath()
Definition: Environment.php:209
‪TYPO3\CMS\Core\Core\ApplicationContext
Definition: ApplicationContext.php:36
‪TYPO3\CMS\Core\Core\Environment\$varPath
‪static $varPath
Definition: Environment.php:58
‪TYPO3\CMS\Core\Core\Environment\isUnix
‪static bool isUnix()
Definition: Environment.php:276
‪TYPO3\CMS\Core\Core\Environment\isWindows
‪static bool isWindows()
Definition: Environment.php:266
‪TYPO3\CMS\Core\Core\Environment\$os
‪static $os
Definition: Environment.php:57
‪TYPO3\CMS\Core\Core\Environment\getCurrentScript
‪static string getCurrentScript()
Definition: Environment.php:193
‪TYPO3\CMS\Core\Core\Environment\$cli
‪static $cli
Definition: Environment.php:51
‪TYPO3\CMS\Core\Core\Environment\$projectPath
‪static $projectPath
Definition: Environment.php:54
‪TYPO3\CMS\Core\Core\Environment\getFrameworkBasePath
‪static string getFrameworkBasePath()
Definition: Environment.php:234
‪TYPO3\CMS\Core\Core\Environment\getContext
‪static ApplicationContext getContext()
Definition: Environment.php:106
‪TYPO3\CMS\Core\Core\Environment\getProjectPath
‪static string getProjectPath()
Definition: Environment.php:142
‪TYPO3\CMS\Core\Core\Environment\initialize
‪static initialize(ApplicationContext $context, bool $cli, bool $composerMode, string $projectPath, string $publicPath, string $varPath, string $configPath, string $currentScript, string $os)
Definition: Environment.php:77
‪TYPO3\CMS\Core\Core\Environment\getBackendPath
‪static string getBackendPath()
Definition: Environment.php:223
‪TYPO3\CMS\Core\Core\Environment\$configPath
‪static $configPath
Definition: Environment.php:59
‪TYPO3\CMS\Core\Core\Environment\isComposerMode
‪static bool isComposerMode()
Definition: Environment.php:117
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:39
‪TYPO3\CMS\Core\Core
Definition: ApplicationContext.php:2
‪TYPO3\CMS\Core\Core\Environment\$supportedCgiServerApis
‪static array $supportedCgiServerApis
Definition: Environment.php:43
‪TYPO3\CMS\Core\Core\Environment\getConfigPath
‪static string getConfigPath()
Definition: Environment.php:183
‪TYPO3\CMS\Core\Core\Environment\$context
‪static $context
Definition: Environment.php:53
‪TYPO3\CMS\Core\Core\Environment\$currentScript
‪static $currentScript
Definition: Environment.php:56
‪TYPO3\CMS\Core\Core\Environment\$publicPath
‪static $publicPath
Definition: Environment.php:55
‪TYPO3\CMS\Core\Core\Environment\$composerMode
‪static $composerMode
Definition: Environment.php:52
‪TYPO3\CMS\Core\Core\Environment\isCli
‪static bool isCli()
Definition: Environment.php:127
‪TYPO3\CMS\Core\Core\Environment\getLegacyConfigPath
‪static string getLegacyConfigPath()
Definition: Environment.php:256
‪TYPO3\CMS\Core\Core\Environment\getVarPath
‪static string getVarPath()
Definition: Environment.php:165
‪TYPO3\CMS\Core\Core\Environment\getExtensionsPath
‪static string getExtensionsPath()
Definition: Environment.php:245