mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-24 09:30:34 +01:00
[ticket/15689] Handle storage stats outside template
PHPBB3-15689
This commit is contained in:
parent
50af5409a6
commit
f8423600b1
@ -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 %}
|
||||
|
@ -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,
|
||||
));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user