Skip to content

Commit

Permalink
add ini environment
Browse files Browse the repository at this point in the history
  • Loading branch information
saeideng committed Feb 18, 2018
1 parent 064e4d9 commit bf076ec
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/Panel/EnvironmentPanel.php
Expand Up @@ -41,6 +41,15 @@ protected function _prepare()
);
unset($return['php']['argv']);

// ini Data
$return['ini'] = [
'intl.default_locale' => ini_get('intl.default_locale'),
'memory_limit' => ini_get('memory_limit'),
'error_reporting' => ini_get('error_reporting'),
'upload_max_filesize' => ini_get('upload_max_filesize'),
'post_max_size' => ini_get('post_max_size'),
];

// CakePHP Data
$return['cake'] = [
'APP' => APP,
Expand Down
25 changes: 25 additions & 0 deletions src/Template/Element/environment_panel.ctp
Expand Up @@ -75,6 +75,31 @@ use Cake\Error\Debugger;
</div>
<?php endif; ?>

<h2><?= __d('debug_kit', 'INI Environment') ?></h2>

<?php if (!empty($ini)): ?>
<table cellspacing="0" cellpadding="0" class="debug-table">
<thead>
<tr>
<th>INI Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($ini as $key => $val): ?>
<tr>
<td><?= h($key) ?></td>
<td><?= $this->Credentials->filter($val) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<div class="warning">
<?= __d('debug_kit', 'ini environment unavailable.'); ?>
</div>
<?php endif; ?>

<h2><?= __d('debug_kit', 'PHP Environment') ?></h2>

<?php if (!empty($php)): ?>
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Panel/EnvironmentPanelTest.php
Expand Up @@ -64,7 +64,7 @@ public function testShutdown()
$this->panel->shutdown($event);
$output = $this->panel->data();
$this->assertInternalType('array', $output);
$this->assertSame(['php', 'cake', 'app'], array_keys($output));
$this->assertSame(['php', 'ini', 'cake', 'app'], array_keys($output));
$this->assertEquals('mysql://user:password@localhost/my_db', $output['php']['TEST_URL_1']);
}
}

0 comments on commit bf076ec

Please sign in to comment.