diff --git a/phpBB/adm/style/acp_storage.html b/phpBB/adm/style/acp_storage.html index 5107385834..79bb1ad79d 100644 --- a/phpBB/adm/style/acp_storage.html +++ b/phpBB/adm/style/acp_storage.html @@ -16,22 +16,17 @@ </tr> </thead> <tbody> - {% for storage in STORAGES %} + {% for storage in STORAGE_STATS %} <tr> - <td>{{ lang('STORAGE_' ~ storage.get_name | upper ~ '_TITLE') }}</td> - <td>{{ storage.get_num_files }}</td> - <td>{{ storage.get_size | format_bytes }}</td> - {% if storage.free_space !== false %} - <td>{{ storage.free_space | format_bytes }}</td> - {% else %} - <td>{L_STORAGE_UNKNOWN}</td> - {% endif %} + <td>{{ storage.name }}</td> + <td>{{ storage.files }}</td> + <td>{{ storage.size }}</td> + <td>{{ storage.free_space }}</td> </tr> {% endfor %} </tbody> </table> - <form id="acp_storage" method="post" action="{{ U_ACTION }}"> {% for storage in STORAGES %} diff --git a/phpBB/includes/acp/acp_storage.php b/phpBB/includes/acp/acp_storage.php index 4348fb3b21..c08903f54e 100644 --- a/phpBB/includes/acp/acp_storage.php +++ b/phpBB/includes/acp/acp_storage.php @@ -162,8 +162,29 @@ class acp_storage trigger_error($this->lang->lang('STORAGE_NO_CHANGES') . adm_back_link($this->u_action), E_USER_WARNING); } + $storage_stats = []; + foreach ($this->storage_collection as $storage) + { + try + { + $free_space = get_formatted_filesize($storage->free_space()); + } + catch (\phpbb\storage\exception\exception $e) + { + $free_space = $this->lang->lang('STORAGE_UNKNOWN'); + } + + $storage_stats[] = [ + 'name' => $this->lang->lang('STORAGE_' . strtoupper($storage->get_name()) . '_TITLE'), + 'files' => $storage->get_num_files(), + 'size' => get_formatted_filesize($storage->get_size()), + 'free_space' => $free_space, + ]; + } + $this->template->assign_vars(array( 'STORAGES' => $this->storage_collection, + 'STORAGE_STATS' => $storage_stats, 'PROVIDERS' => $this->provider_collection, )); }