Yii2 framework backup
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
1.9 KiB

11 years ago
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\debug\panels;
use Yii;
use yii\debug\Panel;
/**
* Debugger panel that collects and displays application configuration and environment.
*
11 years ago
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class ConfigPanel extends Panel
{
/**
* @inheritdoc
*/
11 years ago
public function getName()
{
11 years ago
return 'Configuration';
11 years ago
}
/**
* @inheritdoc
*/
11 years ago
public function getSummary()
{
return Yii::$app->view->render('panels/config/summary', ['panel' => $this]);
11 years ago
}
/**
* @inheritdoc
*/
11 years ago
public function getDetail()
{
return Yii::$app->view->render('panels/config/detail', ['panel' => $this]);
11 years ago
}
/**
* Returns data about extensions
*
* @return array
*/
public function getExtensions()
{
$data = [];
foreach ($this->data['extensions'] as $extension) {
11 years ago
$data[$extension['name']] = $extension['version'];
}
return $data;
}
11 years ago
/**
* Returns the BODY contents of the phpinfo() output
*
* @return array
*/
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 ', '<table class="table table-condensed table-bordered table-striped table-hover config-php-info-table"', $phpinfo);
11 years ago
return $phpinfo;
}
/**
* @inheritdoc
*/
11 years ago
public function save()
{
return [
11 years ago
'phpVersion' => PHP_VERSION,
'yiiVersion' => Yii::getVersion(),
'application' => [
11 years ago
'yii' => Yii::getVersion(),
'name' => Yii::$app->name,
'env' => YII_ENV,
'debug' => YII_DEBUG,
],
'php' => [
11 years ago
'version' => PHP_VERSION,
'xdebug' => extension_loaded('xdebug'),
'apc' => extension_loaded('apc'),
'memcache' => extension_loaded('memcache'),
],
'extensions' => Yii::$app->extensions,
];
11 years ago
}
}