1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-23 21:33:01 +02:00

Admin Panel: Tools #170 #165

- Registry tab added
This commit is contained in:
Awilum
2019-06-23 00:32:48 +03:00
parent a26df886ab
commit 1d38395c27
3 changed files with 80 additions and 63 deletions

View File

@@ -68,6 +68,11 @@ class ToolsController extends Controller
'title' => __('admin_cache'),
'attributes' => ['class' => 'navbar-item']
],
'registry' => [
'link' => $this->router->pathFor('admin.tools.registry'),
'title' => __('admin_registry'),
'attributes' => ['class' => 'navbar-item']
],
]
]
);
@@ -107,6 +112,11 @@ class ToolsController extends Controller
'title' => __('admin_cache'),
'attributes' => ['class' => 'navbar-item active']
],
'registry' => [
'link' => $this->router->pathFor('admin.tools.registry'),
'title' => __('admin_registry'),
'attributes' => ['class' => 'navbar-item']
],
],
'buttons' => [
'tools_clear_cache' => [
@@ -122,6 +132,55 @@ class ToolsController extends Controller
}
/**
* Information page
*
* @param Request $request PSR7 request
* @param Response $response PSR7 response
*
* @return Response
*/
public function registry(Request $request, Response $response) : Response
{
if (function_exists('apache_get_modules')) {
if (!in_array('mod_rewrite', apache_get_modules())) {
$apache_mod_rewrite_installed = false;
} else {
$apache_mod_rewrite_installed = true;
}
} else {
$apache_mod_rewrite_installed = true;
}
return $this->view->render(
$response,
'plugins/admin/views/templates/system/tools/registry.html',
[
'menu_item' => 'tools',
'registry_dump' => $this->niceArray($this->registry->dump()),
'links' => [
'information' => [
'link' => $this->router->pathFor('admin.tools.index'),
'title' => __('admin_information'),
'attributes' => ['class' => 'navbar-item']
],
'cache' => [
'link' => $this->router->pathFor('admin.tools.cache'),
'title' => __('admin_cache'),
'attributes' => ['class' => 'navbar-item']
],
'registry' => [
'link' => $this->router->pathFor('admin.tools.registry'),
'title' => __('admin_registry'),
'attributes' => ['class' => 'navbar-item active']
],
]
]
);
}
public function clearCacheProcess($request, $response)
{
$id = $request->getParsedBody()['cache-id'];
@@ -143,6 +202,22 @@ class ToolsController extends Controller
}
function niceArray($arr){
$retStr = '<ul>';
if (is_array($arr)){
foreach ($arr as $key=>$val){
if (is_array($val)){
$retStr .= '<li> <b>' . $key . '</b> => array(' . $this->niceArray($val) . ')</li>';
}else{
$retStr .= '<li>' . $key . ' => ' . ($val == '' ? '""' : $val) . '</li>';
}
}
}
$retStr .= '</ul>';
return $retStr;
}
public function getDirectorySize($path)
{
$bytestotal = 0;

View File

@@ -1,63 +0,0 @@
{% extends "plugins/admin/views/partials/base.html" %}
{% block content %}
<h3 class="h3">{{ tr('admin_system') }}</h3>
<table class="table no-margin">
<tbody>
<tr>
<td width="200">{{ tr('admin_flextype_version') }}</td>
<td>{{ FLEXTYPE_VERSION }}</td>
</tr>
<tr>
<td>{{ tr('admin_debugging') }}</td>
<td>
{% if registry.settings.errors.display %}
{{ tr('admin_on') }}
{% else %}
{{ tr('admin_off') }}
{% endif %}
</td>
</tr>
<tr>
<td>{{ tr('admin_cache') }}</td>
<td>
{% if registry.settings.cache.enabled %}
{{ tr('admin_on') }}
{% else %}
{{ tr('admin_off') }}
{% endif %}
</td>
</tr>
</tbody>
</table>
<br><br>
<h3 class="h3">{{ tr('admin_server') }}</h3>
<table class="table no-margin">
<tbody>
<tr>
<td width="180">{{ tr('admin_php_version') }}</td>
<td></td>
</tr>
<tr>
<td>{{ tr('admin_php_built_on') }}</td>
<td>{{ php_uname }}</td>
</tr>
<tr>
<td>{{ tr('admin_web_server') }}</td>
<td>{{ webserver }}</td>
</tr>
<tr>
<td>{{ tr('admin_web_server_php_interface') }}</td>
<td>{{ php_sapi_name }}</td>
</tr>
{% if apache_mod_rewrite_installed %}
<tr><td>Apache Mod Rewrite</td><td>{{ tr('admin_installed') }}</td></tr>
{% else %}
<tr><td>Apache Mod Rewrite</td><td>{{ tr('admin_not_installed') }}</td></tr>
{% endif %}
</tbody>
</table>
{% endblock %}

View File

@@ -0,0 +1,5 @@
{% extends "plugins/admin/views/partials/base.html" %}
{% block content %}
{{ registry_dump|raw }}
{% endblock %}