Skip to content

Commit

Permalink
Merge pull request #2 from jfcherng/feature-loaded-extensions
Browse files Browse the repository at this point in the history
Add row: Loaded extensions
  • Loading branch information
kmvan authored Sep 2, 2018
2 parents 80ed9a4 + bd41669 commit 1e5bedf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/I18n/Lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@
"%s enabled": {
"zh-CN": "%s 启用"
},
"Loaded extensions": {
"zh-CN": "加载的 PHP 扩展"
},
// Database
"Database": {
"zh-CN": "数据库"
Expand Down
19 changes: 18 additions & 1 deletion src/PhpExtensionInfo/PhpExtensionInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ private function getContent()
'label' => I18n::_('Zend Optimizer'),
'content' => Helper::getIni(0, \function_exists('zend_optimizer_version')),
),
array(
'col' => '1-1',
'label' => I18n::_('Loaded extensions'),
'title' => 'loaded_extensions',
'content' => \implode(', ', $this->getLoadedExtensions(true)) ?: '-',
),
);

// order
Expand All @@ -112,14 +118,25 @@ private function getContent()
<div class="form-group">
<div class="group-label" {$title}>{$item['label']}</div>
<div class="group-content" {$title} {$id}>{$item['content']}</div>
</div>
</div>
</div>
HTML;
}

return $content;
}

private function getLoadedExtensions($sorted = false)
{
$exts = \get_loaded_extensions();

if ($sorted) {
\sort($exts);
}

return $exts;
}

private function isOpcEnabled()
{
$isOpcEnabled = \function_exists('\\opcache_get_configuration');
Expand Down

0 comments on commit 1e5bedf

Please sign in to comment.