From b5dd3f200bf642341840d7b59528ba5dcb8432f3 Mon Sep 17 00:00:00 2001 From: Mosen Date: Fri, 5 Jan 2024 14:14:41 +1100 Subject: [PATCH] Generate the Laravel Queue migration in case you want to use database queues. Provide that as a default in config example. Rewrite system/status page using blade templates because the XHR/Ajax didnt really add anything useful except a delay. Create new route for just displaying phpinfo which we used instead of parsing the output into a table which can be bad for generating errors. Disabled routes /system/DataBaseInfo and /system/phpInfo because they are server side now. Don't do client side sorting of navigation menus (listings) Database upgrade page really didnt need a disclosure control because having it minimised means nothing at all. Move all the system diag functions into App\SystemInformation so they dont live in controllers Migrated the system summary widgets into a blade component based system, provided the "table" widget as an example. --- .env.example | 4 +- app/Http/Controllers/ClientsController.php | 26 +-- app/Http/Controllers/SystemController.php | 107 +++-------- app/SystemInformation.php | 115 ++++++++++++ app/View/Components/Widget/Detail/Legacy.php | 41 +++++ .../Components/Widget/{ => Detail}/Table.php | 16 +- app/lib/munkireport/Listing.php | 23 ++- app/lib/munkireport/Modules.php | 5 +- app/lib/munkireport/Widgets.php | 77 +++++++- .../2024_01_05_030915_create_jobs_table.php | 32 ++++ public/assets/css/system/database.css | 22 +-- public/assets/js/munkireport.js | 2 - public/assets/locales/en.json | 9 +- resources/views/client/summary_tab.blade.php | 10 ++ resources/views/clients/detail.blade.php | 17 +- .../components/widget/detail/legacy.blade.php | 1 + .../widget/{ => detail}/table.blade.php | 30 ++-- .../widget/detail/unknown.blade.php | 1 + resources/views/system/database.blade.php | 40 +---- resources/views/system/phpinfo.blade.php | 1 + resources/views/system/status.blade.php | 169 ++++-------------- routes/admin.php | 5 +- 22 files changed, 433 insertions(+), 320 deletions(-) create mode 100644 app/SystemInformation.php create mode 100644 app/View/Components/Widget/Detail/Legacy.php rename app/View/Components/Widget/{ => Detail}/Table.php (59%) create mode 100644 database/migrations/2024_01_05_030915_create_jobs_table.php create mode 100644 resources/views/client/summary_tab.blade.php create mode 100644 resources/views/components/widget/detail/legacy.blade.php rename resources/views/components/widget/{ => detail}/table.blade.php (51%) create mode 100644 resources/views/components/widget/detail/unknown.blade.php create mode 100644 resources/views/system/phpinfo.blade.php diff --git a/.env.example b/.env.example index c2cf032b84..a028531af6 100644 --- a/.env.example +++ b/.env.example @@ -201,8 +201,8 @@ REDIS_PORT=6379 # The default Queue driver, "sync" just doesn't use any Queue and invokes the job right now. # This is probably not what you want, but it allows people to use Queues without setting anything up. -QUEUE_CONNECTION=sync -#QUEUE_CONNECTION=database +#QUEUE_CONNECTION=sync +QUEUE_CONNECTION=database # Mailer configuration # So far, no MunkiReport functionality uses this, but there is an outgoing mail integration available diff --git a/app/Http/Controllers/ClientsController.php b/app/Http/Controllers/ClientsController.php index 74fbc8dd43..9ed08f2694 100644 --- a/app/Http/Controllers/ClientsController.php +++ b/app/Http/Controllers/ClientsController.php @@ -155,16 +155,9 @@ public function detail(Request $request, string $sn = '') // Optionally: // 'view_vars' => array with variables to pass to the views // 'badge' => id of a badge for this tab - $tab_list = [ - 'summary' => [ - 'view' => 'client/summary_tab', - 'view_vars' => [ - 'widget_list' => [], - ], - 'i18n' => 'client.tab.summary', - ], - ]; + // 'blade' => truthy value means "use a blade template instead of a .php one" (Added in v6) + $tab_list = []; // Include module tabs $modules = app(Modules::class)->loadInfo(); $modules->addTabs($tab_list); @@ -172,13 +165,26 @@ public function detail(Request $request, string $sn = '') // Add custom tabs $tab_list = array_merge($tab_list, conf('client_tabs', [])); + ksort($tab_list); + + // Prepend the summary after items are sorted by name so it appears at the top. + $tab_list = array_merge([ + 'summary' => [ + 'blade' => true, + 'view' => 'client/summary_tab', + 'view_vars' => [ + 'widget_list' => [], + ], + 'i18n' => 'client.tab.summary', + ], + ], $tab_list); + // Add widgets to summary tab $modules->addWidgets( $tab_list['summary']['view_vars']['widget_list'], conf('detail_widget_list', []) ); - $data['tab_list'] = $tab_list; return view("clients.detail", $data); diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index 9970196b41..5c50eb33b4 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -2,9 +2,13 @@ namespace App\Http\Controllers; +use App\SystemInformation; +use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Gate; use munkireport\lib\Dashboard; use Compatibility\Kiss\Database; use munkireport\lib\Modules; +use Munkireport\Osquery\Tables\SystemInfo; /** * Class SystemController @@ -16,84 +20,6 @@ */ class SystemController extends Controller { - /** - * DataBase - * - * Get Database info and status - * - */ - public function DataBaseInfo() - { - $out = array( - 'db.driver' => '', - 'db.connectable' => false, - 'db.writable' => false, - 'db.size' => '', - 'error' => '', - 'version' => '' - ); - - $db = new Database(conf('connection')); - //echo '
'; var_dump($db);
-        if ($db->connect()) {
-            $out['db.connectable'] = true;
-            $out['db.driver'] = $db->get_driver();
-
-            if ($db->isWritable()) {
-                $out['db.writable'] = true;
-            } else {
-                $out['error'] = $db->getError();
-            }
-            $out['db.size'] = $db->size();
-            $out['version'] = $db->get_version();
-
-        } else {
-            $out['error'] = $db->getError();
-        }
-        //echo '
'; var_dump($db);
-        // Get engine
-        // Get permissions
-        // Do a write
-        // Do a read
-        // Get tables
-        // Get size
-
-        return response()->json($out);
-    }
-
-    /**
-     * php information
-     *
-     * Retrieve information about php
-     *
-     */
-    public function phpInfo()
-    {
-        ob_start();
-        phpinfo(11);
-        $raw = ob_get_clean();
-        $phpinfo = array('phpinfo' => array());
-
-        // Remove credits
-        $nocreds = preg_replace('#

PHP Credits.*#s', '', $raw); - if (preg_match_all('#(?:

(?:)?(.*?)(?:)?

)|(?:(.*?)\s*(?:(.*?)\s*(?:(.*?)\s*)?)?)#s', $nocreds, $matches, PREG_SET_ORDER)) { - foreach ($matches as $match) { - if (strlen($match[1])) { - $phpinfo[$match[1]] = array(); - } elseif (isset($match[3])) { - $keys1 = array_keys($phpinfo); - $phpinfo[end($keys1)][$match[2]] = isset($match[4]) ? $match[3] . ' ('.$match[4].')' : str_replace(',', ', ', $match[3]); - } else { - $keys1 = array_keys($phpinfo); - $phpinfo[end($keys1)][] = trim(strip_tags($match[2])); - } - } - } - //echo '
';print_r($phpinfo);return;
-
-        return response()->json($phpinfo);
-    }
-
     /**
      * Display the Widget Gallery
      */
@@ -121,16 +47,35 @@ public function widgets()
      */
     public function status()
     {
-        $data['page'] = 'clients';
-        $data['scripts'] = array("clients/client_list.js");
+        Gate::authorize('global');
+
+        $data = [
+            'connection' => SystemInformation::getDatabaseInformation(),
+            'php' => SystemInformation::getPhpInformationByFunc(),
+        ];
+
         return view('system.status', $data);
     }
 
     /**
-     * Display database tools
+     * Get the content of phpinfo() behind an admin gate
+     *
+     * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Foundation\Application|null
+     */
+    public function php_info()
+    {
+        Gate::authorize('global');
+
+        return view('system.phpinfo');
+    }
+
+    /**
+     * Display database migration tools
      */
     public function database()
     {
+        Gate::authorize('global');
+
         return view('system.database');
     }
 }
diff --git a/app/SystemInformation.php b/app/SystemInformation.php
new file mode 100644
index 0000000000..aef8449d89
--- /dev/null
+++ b/app/SystemInformation.php
@@ -0,0 +1,115 @@
+getPdo()?->getAttribute(\PDO::ATTR_SERVER_VERSION);
+        $info = $connection->getPdo()?->getAttribute(\PDO::ATTR_SERVER_INFO);
+        $status = $connection->getPdo()?->getAttribute(\PDO::ATTR_CONNECTION_STATUS);
+        $client = $connection->getPdo()?->getAttribute(\PDO::ATTR_CLIENT_VERSION);
+
+        try {
+            $timeout = $connection->getPdo()?->getAttribute(\PDO::ATTR_TIMEOUT);
+        } catch (\PDOException $e) {
+            $timeout = null;
+        }
+
+        $data = [
+            'db.driver' => $connection->getDriverName(),
+            'database' => $connection->getDatabaseName(),
+            'db.prefix' => $connection->getTablePrefix(),
+            'version' => $version,
+            'db.method' => $status,
+            'db.client.version' => $client,
+            'db.info' => $info,
+            'timeout' => $timeout,
+        ];
+
+        switch ($connection->getDriverName()) {
+            case 'mysql':
+                $size = DB::table('information_schema.tables', 't')
+                    ->select(DB::raw('SUM(ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024 ), 2)) AS size'))
+                    ->where('table_schema', '=', $connection->getDatabaseName())
+                    ->first()->size;
+                $data['db.size'] = "{$size} MB";
+                break;
+            case 'sqlite':
+                $pageSize = DB::select('PRAGMA PAGE_SIZE');
+                $pageCount = DB::select('PRAGMA PAGE_COUNT');
+                break;
+        }
+
+        return $data;
+    }
+
+    /**
+     * Get information about the current PHP runtime and its configuration by parsing the HTML output of phpinfo().
+     *
+     * This is not very sustainable and some variables may use php functions in future to avoid the HTML output change
+     * causing breakage.
+     *
+     * @return array PHP information scraped from the phpinfo() output buffer.
+     */
+    public static function getPhpInformation(): array
+    {
+        ob_start();
+        phpinfo(11);
+        $raw = ob_get_clean();
+        $phpinfo = array('phpinfo' => array());
+
+        // Remove credits
+        $nocreds = preg_replace('#

PHP Credits.*#s', '', $raw); + if (preg_match_all('#(?:

(?:)?(.*?)(?:)?

)|(?:(.*?)\s*(?:(.*?)\s*(?:(.*?)\s*)?)?)#s', $nocreds, $matches, PREG_SET_ORDER)) { + foreach ($matches as $match) { + if (strlen($match[1])) { + $phpinfo[$match[1]] = array(); + } elseif (isset($match[3])) { + $keys1 = array_keys($phpinfo); + $phpinfo[end($keys1)][$match[2]] = isset($match[4]) ? $match[3] . ' ('.$match[4].')' : str_replace(',', ', ', $match[3]); + } else { + $keys1 = array_keys($phpinfo); + $phpinfo[end($keys1)][] = trim(strip_tags($match[2])); + } + } + } + + return $phpinfo; + } + + /** + * Get information about the current PHP runtime and configuration using runtime function calls instead of + * HTML parsing. Should be used in place of getPhpInformation() + * + * @return array + */ + public static function getPhpInformationByFunc(): array + { + return [ + 'php.version' => phpversion(), + 'php.uname' => php_uname(), + 'php.loaded_extensions' => get_loaded_extensions(), + 'php.ini_loaded_file' => php_ini_loaded_file(), + 'php.ini_scanned_files' => php_ini_scanned_files(), + 'php.memory_peak_usage' => memory_get_peak_usage(), + ]; + } +} diff --git a/app/View/Components/Widget/Detail/Legacy.php b/app/View/Components/Widget/Detail/Legacy.php new file mode 100644 index 0000000000..a4ffeb376c --- /dev/null +++ b/app/View/Components/Widget/Detail/Legacy.php @@ -0,0 +1,41 @@ +name = $name; + $this->data = $data; + } + + /** + * Get the view / contents that represent the component. + * + * @return string + */ + public function render(): string + { + $obj = new View(); + $widget = app(Widgets::class)->getDetail($this->data); + $output = $obj->viewFetch($widget['file'], $widget['vars'], $widget['path']); + return $output; + } +} diff --git a/app/View/Components/Widget/Table.php b/app/View/Components/Widget/Detail/Table.php similarity index 59% rename from app/View/Components/Widget/Table.php rename to app/View/Components/Widget/Detail/Table.php index f57442d10d..ee5bbe236f 100644 --- a/app/View/Components/Widget/Table.php +++ b/app/View/Components/Widget/Detail/Table.php @@ -1,6 +1,6 @@ name = $name; + $this->data = $data; } /** @@ -28,6 +36,6 @@ public function __construct() */ public function render() { - return view('components.widget.table'); + return view('components.widget.detail.table', $this->data); } } diff --git a/app/lib/munkireport/Listing.php b/app/lib/munkireport/Listing.php index dd55643891..425deeca75 100644 --- a/app/lib/munkireport/Listing.php +++ b/app/lib/munkireport/Listing.php @@ -11,14 +11,17 @@ */ class Listing { - private $listingData; + private object $listingData; /** * @var string The template to render (usually for .yaml listings only). */ - private $template; + private string $template; - public function __construct($listingData) + /** + * @param object $listingData A stdClass type object with properties for 'module', 'view', and 'view_path' + */ + public function __construct(object $listingData) { $this->listingData = $listingData; $this->template = 'listings/default'; @@ -42,7 +45,15 @@ public function render($data = []) } } - private function _renderPHP($listingData, $data) + /** + * Render a listing which uses a plain PHP template by capturing the KISSMVC view's output buffer + * and returning it. + * + * @param object $listingData Information about the path and view name to render. + * @param array $data Data to be passed to the view template. + * @return string + */ + private function _renderPHP(object $listingData, array $data): string { return mr_view_output($listingData->view, $data, $listingData->view_path); } @@ -61,12 +72,12 @@ private function _renderPageNotFound() exit; } - private function _getType($pathComponents) + private function _getType($pathComponents): string { return is_readable($this->_getPath($pathComponents, 'yml')) ? 'yaml' : 'php'; } - private function _getPath($pathComponents, $extension) + private function _getPath($pathComponents, $extension): string { return $pathComponents->view_path . $pathComponents->view . '.' . $extension; } diff --git a/app/lib/munkireport/Modules.php b/app/lib/munkireport/Modules.php index 5e0e522185..5db2f56bb5 100644 --- a/app/lib/munkireport/Modules.php +++ b/app/lib/munkireport/Modules.php @@ -87,6 +87,7 @@ protected function addCoreModules() ], 'listings' => array( 'clients' => array('view' => 'clients_listing', 'i18n' => 'client.clients'), +// 'clients' => array('url' => url('/clients'), 'i18n' => 'client.clients'), ), // 'widgets' => array() // 'client' => array('view' => 'client_widget'), @@ -485,7 +486,9 @@ public function getDropdownData(string $kind, string $baseUrl, string $page): ar } } - return $out; + $sorted = collect($out)->sortBy('name', SORT_NATURAL)->toArray(); + + return $sorted; } /** diff --git a/app/lib/munkireport/Widgets.php b/app/lib/munkireport/Widgets.php index a344900bca..a3f999eb57 100644 --- a/app/lib/munkireport/Widgets.php +++ b/app/lib/munkireport/Widgets.php @@ -91,6 +91,39 @@ public function get($widgetName, $data = []) return $widget; } + /** + * Get information about a `detail` widget (used on client detail summary page), similar to Widgets::get(). + * + * The output array is mapped into the same format as a dashboard widget so that all widget data + * appears the same, even though client detail widgets are declared using a totally different structure in v5. + * + * @param array $data Widget data, including the widget name. + * @param string|null $name Optional name to override the widget to render. + * @return array Widget info which will be used to render the widget. + */ + public function getDetail(array $data, ?string $name = null): array + { + $widget = [ + 'widget' => $data['widget'] ?? $name, + 'vars' => $data['view_vars'] ?? [], + 'path' => $data['view_path'], + 'file' => $data['view'], + ]; + +// $view = $data['view']; +// $view_path = $data['view_path'] ?? resource_path('views'); +// $view_vars = $data['view_vars'] ?? []; +// +// // Check if Yaml +// if(is_readable($view_path . $view . '.yml')){ +// $view_vars = Yaml::parseFile($view_path . $view . '.yml'); +// $view = 'detail_widgets/' . $view_vars['type'] . '_widget'; +// $view_path = conf('view_path'); +// } + + return $widget; + } + public function view($viewObj, $widgetName, $data = []) { $widget = $this->get($widgetName, $data); @@ -162,7 +195,49 @@ public function getComponent(string $widgetName, ?array $data = null): array } } - public function addComponent(string $widgetName, string $component, ?array $data = null) + /** + * Get the name of a Laravel Blade View Component (For the client detail summary) that matches the name of the widget. + * + * If a newer style component can be found, it will be returned, otherwise you will get the x-widget.legacy component + * which just wraps over the Widget->view(). + * + * @param array $data Data to merge that will be passed to the widget view. + * @return array ['component name', $data] + */ + public function getDetailComponent(array $data){ + + $widget = $this->getDetail($data); + + if (isset($widget['version']) && $widget['version'] == 6) { + return [$widget['component'], $data]; + } else { + if ($this->getType($widget['path'], $widget['file']) == 'yaml') { + try { + $data = array_merge($data ?? [], Yaml::parseFile($widget['path'] . $widget['file'] . '.yml')); + + switch ($data['type']) { + case 'table': + return ['widget.detail.table', $data]; + case 'unknown': + default: + return ['widget.detail.unknown', $data]; + } + } catch (\Throwable $th) { + $data = [ + 'type' => 'error', + 'title' => 'YAML error', + 'msg' => $th->getMessage() + ]; + + return ['widget.detail.unknown', $data]; + } + } else { + return ['widget.detail.legacy', $data]; + } + } + } + + public function addComponent(string $widgetName, string $component, ?array $data = null): void { $this->widgetList[$widgetName] = (object) [ 'vars' => '', diff --git a/database/migrations/2024_01_05_030915_create_jobs_table.php b/database/migrations/2024_01_05_030915_create_jobs_table.php new file mode 100644 index 0000000000..6098d9b123 --- /dev/null +++ b/database/migrations/2024_01_05_030915_create_jobs_table.php @@ -0,0 +1,32 @@ +bigIncrements('id'); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedTinyInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('jobs'); + } +}; diff --git a/public/assets/css/system/database.css b/public/assets/css/system/database.css index b48cf86008..79a5ad8ae0 100644 --- a/public/assets/css/system/database.css +++ b/public/assets/css/system/database.css @@ -1,14 +1,11 @@ .table-console { - color: darkgrey; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; - font-size: 1.4rem; - + font-size: 1rem; padding: 1rem; } .table-console > tbody { /*overflow-y: scroll;*/ - display: none; } .table-console td { @@ -24,23 +21,6 @@ color: darkgrey; } -.disclosure { - cursor: pointer; -} - -.disclosure > .glyphicon { - transition-property: transform; - transition-duration: 100ms; -} - -.disclosure-active > .glyphicon { - transform: rotate(90deg); -} - -.table-console.disclosure-active tbody { - display: block; -} - .loading { opacity: 0.5; transition-property: opacity; diff --git a/public/assets/js/munkireport.js b/public/assets/js/munkireport.js index fcb7d9f11a..bf6af8a140 100644 --- a/public/assets/js/munkireport.js +++ b/public/assets/js/munkireport.js @@ -62,8 +62,6 @@ $( document ).ready(function() { // Sort menus mr.sortMenu('ul.report'); - mr.sortMenu('ul.listing'); - mr.sortMenu('ul.client-tabs'); // Put summary on top $('ul.client-tabs').prepend($('ul.client-tabs a[href="#summary"]').closest('li')); diff --git a/public/assets/locales/en.json b/public/assets/locales/en.json index 5c5ed854c7..c03b2dd26c 100644 --- a/public/assets/locales/en.json +++ b/public/assets/locales/en.json @@ -133,8 +133,14 @@ "db": { "connectable": "Connectable", "driver": "Driver", + "info": "Information", "writable": "Writable", - "size": "Size" + "size": "Size", + "prefix": "Table Prefix", + "method": "Connection Method", + "client": { + "version": "Client Version" + } }, "delete": "Delete", "description": "Description", @@ -405,6 +411,7 @@ "tag": "Tag" }, "text": "Text", + "timeout": "Timeout", "total_clients": "Total Clients", "trackpad": "Trackpad", "type": "Type", diff --git a/resources/views/client/summary_tab.blade.php b/resources/views/client/summary_tab.blade.php new file mode 100644 index 0000000000..706d7e7d9f --- /dev/null +++ b/resources/views/client/summary_tab.blade.php @@ -0,0 +1,10 @@ +
+ + @foreach($widget_list as $widget_id => $data) + + @php + list($component, $mergedData) = app(\munkireport\lib\Widgets::class)->getDetailComponent($data); + @endphp + + @endforeach +
diff --git a/resources/views/clients/detail.blade.php b/resources/views/clients/detail.blade.php index 20d81fe658..040567d7bc 100644 --- a/resources/views/clients/detail.blade.php +++ b/resources/views/clients/detail.blade.php @@ -67,19 +67,22 @@
@foreach($tab_list as $name => $data)
-{{-- @isset($data['module'])--}} -{{-- {{ "{$data['module']}::{$data['view']}" }}--}} -{{-- @include("{$data['module']}::{$data['view']}", $data['view_vars'] ?? [])--}} -{{-- @else--}} -{{-- @include($data['view'], $data['view_vars'] ?? [])--}} -{{-- @endisset--}} - + @isset($data['blade']) + @isset($data['module']) + + @include("{$data['module']}::{$data['view']}", $data['view_vars'] ?? []) + @else + + @include($data['view'], $data['view_vars'] ?? []) + @endisset + @else + @endisset
@endforeach
diff --git a/resources/views/components/widget/detail/legacy.blade.php b/resources/views/components/widget/detail/legacy.blade.php new file mode 100644 index 0000000000..33ece119b7 --- /dev/null +++ b/resources/views/components/widget/detail/legacy.blade.php @@ -0,0 +1 @@ + diff --git a/resources/views/components/widget/table.blade.php b/resources/views/components/widget/detail/table.blade.php similarity index 51% rename from resources/views/components/widget/table.blade.php rename to resources/views/components/widget/detail/table.blade.php index b3f585946f..9448d823c7 100644 --- a/resources/views/components/widget/table.blade.php +++ b/resources/views/components/widget/detail/table.blade.php @@ -10,20 +10,22 @@ > - @foreach($table as $row) - - - - - @endforeach + @isset($table) + @foreach($table as $row) + + + + + @endforeach + @endisset
- @isset($row['prepend']) - {{ $row['prepend'] }} - @endisset - - @isset($row['append']) - {{ $row['append'] }} - @endisset -
+ @isset($row['prepend']) + {!! $row['prepend'] !!} + @endisset + + @isset($row['append']) + {!! $row['append'] !!} + @endisset +
diff --git a/resources/views/components/widget/detail/unknown.blade.php b/resources/views/components/widget/detail/unknown.blade.php new file mode 100644 index 0000000000..344d046ce2 --- /dev/null +++ b/resources/views/components/widget/detail/unknown.blade.php @@ -0,0 +1 @@ + diff --git a/resources/views/system/database.blade.php b/resources/views/system/database.blade.php index bb220f09bc..86bc085f98 100644 --- a/resources/views/system/database.blade.php +++ b/resources/views/system/database.blade.php @@ -8,8 +8,10 @@
-

Upgrade Database

-

Click the update button to begin database upgrade.

+

Upgrade Database + +

+ Click the update button to begin a database upgrade.
@@ -27,9 +29,7 @@ - - Upgrade Log - + Upgrade Log @@ -41,8 +41,7 @@
- - + @endsection @push('scripts') @@ -55,26 +54,6 @@ function log (message, level) { tbody.append('' + message + ''); } - function disclose () { - var logDiv = $('#database-upgrade-log'); - var disclosureEl = logDiv.find('.disclosure'); - var logTbl = logDiv.find('table'); - - if (!disclosureEl.hasClass('disclosure-active')) { - disclosureEl.addClass('disclosure-active'); - } - - if (!logTbl.hasClass('disclosure-active')) { - logTbl.addClass('disclosure-active'); - } - } - - // Show/Hide the upgrade log - $('.disclosure').click(function () { - $(this).toggleClass('disclosure-active'); - $(this).closest('table').toggleClass('disclosure-active'); - }); - $('#db-upgrade').click(function (e) { $(this).attr('disabled', true); $(this).find('#db-upgrade-label').html('Upgrading…'); @@ -97,14 +76,7 @@ function done () { } } - if (data.notes) { - for (var i = 0; i < data.notes.length; i++) { - tbody.append($('' + data.notes[i] + '')); // .text(data.notes[i]) - } - } - if (data.error) { - disclose(); log(data.error, 'error'); if (data.error_trace) { diff --git a/resources/views/system/phpinfo.blade.php b/resources/views/system/phpinfo.blade.php new file mode 100644 index 0000000000..1538285dfd --- /dev/null +++ b/resources/views/system/phpinfo.blade.php @@ -0,0 +1 @@ +@php phpinfo() @endphp diff --git a/resources/views/system/status.blade.php b/resources/views/system/status.blade.php index 74fde02e49..7098f3ed4e 100644 --- a/resources/views/system/status.blade.php +++ b/resources/views/system/status.blade.php @@ -1,149 +1,50 @@ @extends('layouts.mr') -@push('stylesheets') -@endpush - -@push('scripts') - - -@endpush - @section('content')
-

+

MunkiReport System Status

-

-
+

PHP

+ + + + + + + + + + + + + + + + + + + + + +
PHP Version{{ $php['php.version'] }}
Operating System{{ $php['php.uname'] }}
INI File{{ $php['php.ini_loaded_file'] }}
Additional scanned INI files{{ $php['php.ini_scanned_files'] }}
Memory Peak Usage{{ $php['php.memory_peak_usage'] }}
+ + Extended PHP info
-

-
+

Database

+ + @foreach ($connection as $name => $value) + + + + + @endforeach +
{{ $name }}{{ $value }}
diff --git a/routes/admin.php b/routes/admin.php index 0eaaf71e6d..759fa1061e 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -26,8 +26,9 @@ // TODO: Deprecated /system/show for /system, add redirect //Route::get('/system/show/{which?}', 'SystemController@show'); - Route::get('/system/DataBaseInfo', 'SystemController@DataBaseInfo'); - Route::get('/system/phpInfo', 'SystemController@phpInfo'); +// Route::get('/system/DataBaseInfo', 'SystemController@DataBaseInfo'); +// Route::get('/system/phpInfo', 'SystemController@phpInfo'); // Ajax/XHR deprecated for actual phpinfo page because zero parsing errors or maintenance. + Route::get('/system/php_info', 'SystemController@php_info'); Route::get('/system/status', 'SystemController@status'); Route::get('/system/database', 'SystemController@database'); Route::get('/system/widgets', 'SystemController@widgets');