Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ConfigDataCollector.php
001 <?php
002
003 /*
004 * This file is part of the Symfony package.
005 *
006 * (c) Fabien Potencier <fabien@symfony.com>
007 *
008 * For the full copyright and license information, please view the LICENSE
009 * file that was distributed with this source code.
010 */
011
012 namespace Symfony\Component\HttpKernel\DataCollector;
013
014 use Symfony\Component\HttpKernel\KernelInterface;
015 use Symfony\Component\HttpKernel\Kernel;
016 use Symfony\Component\HttpFoundation\Request;
017 use Symfony\Component\HttpFoundation\Response;
018
019 /**
020 * ConfigDataCollector.
021 *
022 * @author Fabien Potencier <fabien@symfony.com>
023 */
024 class ConfigDataCollector extends DataCollector
025 {
026 /**
027 * @var KernelInterface
028 */
029 private $kernel;
030 private $name;
031 private $version;
032 private $cacheVersionInfo = true;
033
034 /**
035 * Constructor.
036 *
037 * @param string $name The name of the application using the web profiler
038 * @param string $version The version of the application using the web profiler
039 */
040 public function __construct($name = null, $version = null)
041 {
042 $this->name = $name;
043 $this->version = $version;
044 }
045
046 /**
047 * Sets the Kernel associated with this Request.
048 *
049 * @param KernelInterface $kernel A KernelInterface instance
050 */
051 public function setKernel(KernelInterface $kernel = null)
052 {
053 $this->kernel = $kernel;
054 }
055
056 /**
057 * {@inheritdoc}
058 */
059 public function collect(Request $request, Response $response, \Exception $exception = null)
060 {
061 $this->data = array(
062 'app_name' => $this->name,
063 'app_version' => $this->version,
064 'token' => $response->headers->get('X-Debug-Token'),
065 'symfony_version' => Kernel::VERSION,
066 'symfony_state' => 'unknown',
067 'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a',
068 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a',
069 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
070 'php_version' => PHP_VERSION,
071 'xdebug_enabled' => extension_loaded('xdebug'),
072 'eaccel_enabled' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'),
073 'apc_enabled' => extension_loaded('apc') && ini_get('apc.enabled'),
074 'xcache_enabled' => extension_loaded('xcache') && ini_get('xcache.cacher'),
075 'wincache_enabled' => extension_loaded('wincache') && ini_get('wincache.ocenabled'),
076 'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'),
077 'bundles' => array(),
078 'sapi_name' => PHP_SAPI,
079 );
080
081 if (isset($this->kernel)) {
082 foreach ($this->kernel->getBundles() as $name => $bundle) {
083 $this->data['bundles'][$name] = $bundle->getPath();
084 }
085
086 $this->data['symfony_state'] = $this->determineSymfonyState();
087 }
088 }
089
090 public function getApplicationName()
091 {
092 return $this->data['app_name'];
093 }
094
095 public function getApplicationVersion()
096 {
097 return $this->data['app_version'];
098 }
099
100 /**
101 * Gets the token.
102 *
103 * @return string The token
104 */
105 public function getToken()
106 {
107 return $this->data['token'];
108 }
109
110 /**
111 * Gets the Symfony version.
112 *
113 * @return string The Symfony version
114 */
115 public function getSymfonyVersion()
116 {
117 return $this->data['symfony_version'];
118 }
119
120 /**
121 * Returns the state of the current Symfony release.
122 *
123 * @return string One of: unknown, dev, stable, eom, eol
124 */
125 public function getSymfonyState()
126 {
127 return $this->data['symfony_state'];
128 }
129
130 public function setCacheVersionInfo($cacheVersionInfo)
131 {
132 $this->cacheVersionInfo = $cacheVersionInfo;
133 }
134
135 /**
136 * Gets the PHP version.
137 *
138 * @return string The PHP version
139 */
140 public function getPhpVersion()
141 {
142 return $this->data['php_version'];
143 }
144
145 /**
146 * Gets the application name.
147 *
148 * @return string The application name
149 */
150 public function getAppName()
151 {
152 return $this->data['name'];
153 }
154
155 /**
156 * Gets the environment.
157 *
158 * @return string The environment
159 */
160 public function getEnv()
161 {
162 return $this->data['env'];
163 }
164
165 /**
166 * Returns true if the debug is enabled.
167 *
168 * @return bool true if debug is enabled, false otherwise
169 */
170 public function isDebug()
171 {
172 return $this->data['debug'];
173 }
174
175 /**
176 * Returns true if the XDebug is enabled.
177 *
178 * @return bool true if XDebug is enabled, false otherwise
179 */
180 public function hasXDebug()
181 {
182 return $this->data['xdebug_enabled'];
183 }
184
185 /**
186 * Returns true if EAccelerator is enabled.
187 *
188 * @return bool true if EAccelerator is enabled, false otherwise
189 */
190 public function hasEAccelerator()
191 {
192 return $this->data['eaccel_enabled'];
193 }
194
195 /**
196 * Returns true if APC is enabled.
197 *
198 * @return bool true if APC is enabled, false otherwise
199 */
200 public function hasApc()
201 {
202 return $this->data['apc_enabled'];
203 }
204
205 /**
206 * Returns true if Zend OPcache is enabled.
207 *
208 * @return bool true if Zend OPcache is enabled, false otherwise
209 */
210 public function hasZendOpcache()
211 {
212 return $this->data['zend_opcache_enabled'];
213 }
214
215 /**
216 * Returns true if XCache is enabled.
217 *
218 * @return bool true if XCache is enabled, false otherwise
219 */
220 public function hasXCache()
221 {
222 return $this->data['xcache_enabled'];
223 }
224
225 /**
226 * Returns true if WinCache is enabled.
227 *
228 * @return bool true if WinCache is enabled, false otherwise
229 */
230 public function hasWinCache()
231 {
232 return $this->data['wincache_enabled'];
233 }
234
235 /**
236 * Returns true if any accelerator is enabled.
237 *
238 * @return bool true if any accelerator is enabled, false otherwise
239 */
240 public function hasAccelerator()
241 {
242 return $this->hasApc() || $this->hasZendOpcache() || $this->hasEAccelerator() || $this->hasXCache() || $this->hasWinCache();
243 }
244
245 public function getBundles()
246 {
247 return $this->data['bundles'];
248 }
249
250 /**
251 * Gets the PHP SAPI name.
252 *
253 * @return string The environment
254 */
255 public function getSapiName()
256 {
257 return $this->data['sapi_name'];
258 }
259
260 /**
261 * {@inheritdoc}
262 */
263 public function getName()
264 {
265 return 'config';
266 }
267
268 /**
269 * Tries to retrieve information about the current Symfony version.
270 *
271 * @return string One of: dev, stable, eom, eol
272 */
273 private function determineSymfonyState()
274 {
275 $now = new \DateTime();
276 $eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE)->modify('last day of this month');
277 $eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE)->modify('last day of this month');
278
279 if ($now > $eol) {
280 $versionState = 'eol';
281 } elseif ($now > $eom) {
282 $versionState = 'eom';
283 } elseif ('' !== Kernel::EXTRA_VERSION) {
284 $versionState = 'dev';
285 } else {
286 $versionState = 'stable';
287 }
288
289 return $versionState;
290 }
291 }
292