Merge pull request #5243 from rubencm/ticket/15689

[ticket/15689] Show statistics of storages on acp_storage
This commit is contained in:
Marc Alexander 2018-07-15 10:59:07 +02:00
commit e240a6fb23
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
3 changed files with 47 additions and 0 deletions

View file

@ -6,6 +6,27 @@
<p>{{ lang('STORAGE_TITLE_EXPLAIN') }}</p>
<table class="table1 zebra-table">
<thead>
<tr>
<th>{{ lang('STORAGE_NAME') }}</th>
<th>{{ lang('STORAGE_NUM_FILES') }}</th>
<th>{{ lang('STORAGE_SIZE') }}</th>
<th>{{ lang('STORAGE_FREE') }}</th>
</tr>
</thead>
<tbody>
{% for storage in STORAGE_STATS %}
<tr>
<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 %}

View file

@ -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,
));
}

View file

@ -43,6 +43,11 @@ $lang = array_merge($lang, array(
'STORAGE_TITLE_EXPLAIN' => 'Change storage providers for the file storage types of phpBB. Choose local or remote providers to store files added to or created by phpBB.',
'STORAGE_SELECT' => 'Select storage',
'STORAGE_SELECT_DESC' => 'Select a storage from the list.',
'STORAGE_NAME' => 'Storage name',
'STORAGE_NUM_FILES' => 'Number of files',
'STORAGE_SIZE' => 'Size',
'STORAGE_FREE' => 'Available space',
'STORAGE_UNKNOWN' => 'Unknown',
// Storage names
'STORAGE_ATTACHMENT_TITLE' => 'Attachments storage',