mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/15689] Handle storage stats outside template
PHPBB3-15689
This commit is contained in:
parent
50af5409a6
commit
f8423600b1
2 changed files with 26 additions and 10 deletions
|
@ -16,22 +16,17 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for storage in STORAGES %}
|
{% for storage in STORAGE_STATS %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ lang('STORAGE_' ~ storage.get_name | upper ~ '_TITLE') }}</td>
|
<td>{{ storage.name }}</td>
|
||||||
<td>{{ storage.get_num_files }}</td>
|
<td>{{ storage.files }}</td>
|
||||||
<td>{{ storage.get_size | format_bytes }}</td>
|
<td>{{ storage.size }}</td>
|
||||||
{% if storage.free_space !== false %}
|
<td>{{ storage.free_space }}</td>
|
||||||
<td>{{ storage.free_space | format_bytes }}</td>
|
|
||||||
{% else %}
|
|
||||||
<td>{L_STORAGE_UNKNOWN}</td>
|
|
||||||
{% endif %}
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
<form id="acp_storage" method="post" action="{{ U_ACTION }}">
|
<form id="acp_storage" method="post" action="{{ U_ACTION }}">
|
||||||
|
|
||||||
{% for storage in STORAGES %}
|
{% 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);
|
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(
|
$this->template->assign_vars(array(
|
||||||
'STORAGES' => $this->storage_collection,
|
'STORAGES' => $this->storage_collection,
|
||||||
|
'STORAGE_STATS' => $storage_stats,
|
||||||
'PROVIDERS' => $this->provider_collection,
|
'PROVIDERS' => $this->provider_collection,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue