From 1d38395c27a7320243a93b6a40396a05b140d64d Mon Sep 17 00:00:00 2001 From: Awilum Date: Sun, 23 Jun 2019 00:32:48 +0300 Subject: [PATCH] Admin Panel: Tools #170 #165 - Registry tab added --- .../admin/app/Controllers/ToolsController.php | 75 +++++++++++++++++++ .../templates/system/information/index.html | 63 ---------------- .../templates/system/tools/registry.html | 5 ++ 3 files changed, 80 insertions(+), 63 deletions(-) delete mode 100644 site/plugins/admin/views/templates/system/information/index.html create mode 100644 site/plugins/admin/views/templates/system/tools/registry.html diff --git a/site/plugins/admin/app/Controllers/ToolsController.php b/site/plugins/admin/app/Controllers/ToolsController.php index 24d91be9..57b1cd3d 100644 --- a/site/plugins/admin/app/Controllers/ToolsController.php +++ b/site/plugins/admin/app/Controllers/ToolsController.php @@ -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 = ''; + + return $retStr; + } + public function getDirectorySize($path) { $bytestotal = 0; diff --git a/site/plugins/admin/views/templates/system/information/index.html b/site/plugins/admin/views/templates/system/information/index.html deleted file mode 100644 index 9822da95..00000000 --- a/site/plugins/admin/views/templates/system/information/index.html +++ /dev/null @@ -1,63 +0,0 @@ -{% extends "plugins/admin/views/partials/base.html" %} - -{% block content %} -

{{ tr('admin_system') }}

- - - - - - - - - - - - - - - -
{{ tr('admin_flextype_version') }}{{ FLEXTYPE_VERSION }}
{{ tr('admin_debugging') }} - {% if registry.settings.errors.display %} - {{ tr('admin_on') }} - {% else %} - {{ tr('admin_off') }} - {% endif %} -
{{ tr('admin_cache') }} - {% if registry.settings.cache.enabled %} - {{ tr('admin_on') }} - {% else %} - {{ tr('admin_off') }} - {% endif %} -
- -

- -

{{ tr('admin_server') }}

- - - - - - - - - - - - - - - - - - - - {% if apache_mod_rewrite_installed %} - - {% else %} - - {% endif %} - -
{{ tr('admin_php_version') }}
{{ tr('admin_php_built_on') }}{{ php_uname }}
{{ tr('admin_web_server') }}{{ webserver }}
{{ tr('admin_web_server_php_interface') }}{{ php_sapi_name }}
Apache Mod Rewrite{{ tr('admin_installed') }}
Apache Mod Rewrite{{ tr('admin_not_installed') }}
-{% endblock %} diff --git a/site/plugins/admin/views/templates/system/tools/registry.html b/site/plugins/admin/views/templates/system/tools/registry.html new file mode 100644 index 00000000..5f6a6400 --- /dev/null +++ b/site/plugins/admin/views/templates/system/tools/registry.html @@ -0,0 +1,5 @@ +{% extends "plugins/admin/views/partials/base.html" %} + +{% block content %} + {{ registry_dump|raw }} +{% endblock %}