1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 11:13:59 +02:00

[ticket/17361] Rewrite storage

PHPBB-17361
This commit is contained in:
Ruben Calvo
2024-11-24 00:15:10 +01:00
parent 688dbb0837
commit e9c445925b
24 changed files with 407 additions and 762 deletions

View File

@@ -279,7 +279,7 @@ class acp_database
try
{
$stream = $storage->read_stream($backup_info['file_name']);
$stream = $storage->read($backup_info['file_name']);
$fp = fopen($temp_file_name, 'w+b');
stream_copy_to_stream($stream, $fp);

View File

@@ -496,7 +496,7 @@ class acp_main
$upload_dir_size = get_formatted_filesize($config['upload_dir_size']);
$storage_avatar = $phpbb_container->get('storage.avatar');
$avatar_dir_size = get_formatted_filesize($storage_avatar->get_size());
$avatar_dir_size = get_formatted_filesize($storage_avatar->total_size());
if ($posts_per_day > $total_posts)
{

View File

@@ -431,8 +431,8 @@ class acp_storage
$storage_stats[] = [
'name' => $this->lang->lang('STORAGE_' . strtoupper($storage->get_name()) . '_TITLE'),
'files' => $storage->get_num_files(),
'size' => get_formatted_filesize($storage->get_size()),
'files' => $storage->total_files(),
'size' => get_formatted_filesize($storage->total_size()),
'free_space' => $free_space,
];
}
@@ -619,10 +619,18 @@ class acp_storage
*/
protected function validate_path(string $storage_name, array &$messages) : void
{
$current_provider = $this->storage_helper->get_current_provider($storage_name);
$options = $this->storage_helper->get_provider_options($current_provider);
if ($this->request->is_set_post('submit'))
{
$provider = $this->request->variable([$storage_name, 'provider'], '');
}
else
{
$provider = $this->storage_helper->get_current_provider($storage_name);
}
if ($this->provider_collection->get_by_class($current_provider)->get_name() == 'local' && isset($options['path']))
$options = $this->storage_helper->get_provider_options($provider);
if ($this->provider_collection->get_by_class($provider)->get_name() === 'local' && isset($options['path']))
{
$path = $this->request->is_set_post('submit') ? $this->request->variable([$storage_name, 'path'], '') : $this->storage_helper->get_current_definition($storage_name, 'path');

View File

@@ -2124,7 +2124,8 @@ function group_correct_avatar($group_id, $old_entry)
try
{
$storage->rename($old_filename, $new_filename);
$storage->write($new_filename, $storage->read($old_filename));
$storage->delete($old_filename);
$sql = 'UPDATE ' . GROUPS_TABLE . '
SET group_avatar = \'' . $db->sql_escape($new_entry) . "'