|
- <?php
-
-
- namespace yii\debug\panels;
-
- use Yii;
- use yii\debug\Panel;
-
-
- class ConfigPanel extends Panel
- {
-
-
- public function getName()
- {
- return 'Configuration';
- }
-
-
-
- public function getSummary()
- {
- return Yii::$app->view->render('panels/config/summary', ['panel' => $this]);
- }
-
-
-
- public function getDetail()
- {
- return Yii::$app->view->render('panels/config/detail', ['panel' => $this]);
- }
-
-
-
- public function getExtensions()
- {
- $data = [];
- foreach ($this->data['extensions'] as $extension) {
- $data[$extension['name']] = $extension['version'];
- }
- ksort($data);
-
- return $data;
- }
-
-
-
- public function getPhpInfo()
- {
- ob_start();
- phpinfo();
- $pinfo = ob_get_contents();
- ob_end_clean();
- $phpinfo = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $pinfo);
- $phpinfo = str_replace('<table', '<div class="table-responsive"><table class="table table-condensed table-bordered table-striped table-hover config-php-info-table" ', $phpinfo);
- $phpinfo = str_replace('</table>', '</table></div>', $phpinfo);
- return $phpinfo;
- }
-
-
-
- public function save()
- {
- return [
- 'phpVersion' => PHP_VERSION,
- 'yiiVersion' => Yii::getVersion(),
- 'application' => [
- 'yii' => Yii::getVersion(),
- 'name' => Yii::$app->name,
- 'version' => Yii::$app->version,
- 'env' => YII_ENV,
- 'debug' => YII_DEBUG,
- ],
- 'php' => [
- 'version' => PHP_VERSION,
- 'xdebug' => extension_loaded('xdebug'),
- 'apc' => extension_loaded('apc'),
- 'memcache' => extension_loaded('memcache'),
- 'memcached' => extension_loaded('memcached'),
- ],
- 'extensions' => Yii::$app->extensions,
- ];
- }
- }
|