From 8fbc17c392b596b48551ec53d4817f9262bed937 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Wed, 20 Jul 2022 16:18:25 +0200 Subject: [PATCH] Add last calculated cache size to Dashboard Storage chart (#1580) issue #1580 Add last calculated cache size to Dashboard Storage chart Size of cached files with all derivatives and representatives may be as large as all image files, actually doubling the needed storage size. So it may be nice to see it represented in the storage chart, if one remembers to occasionally recalculate it under Tools -> Maintenance.. Also make it possible to deactivate this setting. --- admin/intro.php | 13 +++++++++++++ include/config_default.inc.php | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/admin/intro.php b/admin/intro.php index 72b4754ea..cfb362600 100644 --- a/admin/intro.php +++ b/admin/intro.php @@ -443,6 +443,19 @@ if (isset($result[0]['SUM(filesize)'])) $data_storage['Formats'] = $result[0]['SUM(filesize)']; } +// Add cache size if requested and known. +if ($conf['add_cache_to_storage_chart'] && isset($conf['cache_sizes'])) +{ + $cache_sizes = unserialize($conf['cache_sizes']); + if (isset($cache_sizes)) + { + if (isset($cache_sizes[0]) && isset($cache_sizes[0]['value'])) + { + $data_storage['Cache'] = $cache_sizes[0]['value']/1024; + } + } +} + //Calculate total storage $total_storage = 0; foreach ($data_storage as $value) diff --git a/include/config_default.inc.php b/include/config_default.inc.php index 368d943fa..54a44d751 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -740,6 +740,11 @@ $conf['album_move_delay_before_auto_opening'] = 3*1000; // This variable is used to show or hide the template tab in the side menu $conf['show_template_in_side_menu'] = false; +// Add last calculated cache size to Dashboard Storage chart if true. +// To recalculate use Tools -> Maintenance, Refresh. +// To disable, set to false. +$conf['add_cache_to_storage_chart'] = true; + // +-----------------------------------------------------------------------+ // | Filter | // +-----------------------------------------------------------------------+