From 5a1b4f559d53f65befdd894c678536113c5415ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Sun, 11 Feb 2018 13:22:18 +0100 Subject: [PATCH] [ticket/15342] Add avatar storage size to acp_main PHPBB3-15342 --- phpBB/includes/acp/acp_main.php | 6 ++++-- phpBB/phpbb/storage/storage.php | 16 +++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 99675e2b29..b914b6adf5 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -500,10 +500,12 @@ class acp_main $users_per_day = sprintf('%.2f', $total_users / $boarddays); $files_per_day = sprintf('%.2f', $total_files / $boarddays); + //$storage_attachment = $phpbb_container->get('storage.attachments'); + //$upload_dir_size = get_formatted_filesize($storage_attachment->get_size()); $upload_dir_size = get_formatted_filesize($config['upload_dir_size']); - // Couldn't open Avatar dir. - $avatar_dir_size = $user->lang['NOT_AVAILABLE']; + $storage_avatar = $phpbb_container->get('storage.avatar'); + $avatar_dir_size = get_formatted_filesize($storage_avatar->get_size()); if ($posts_per_day > $total_posts) { diff --git a/phpBB/phpbb/storage/storage.php b/phpBB/phpbb/storage/storage.php index cab2b26b4e..73b9218d93 100644 --- a/phpBB/phpbb/storage/storage.php +++ b/phpBB/phpbb/storage/storage.php @@ -306,18 +306,20 @@ class storage if ($row) { - $sql = 'UPDATE ' . $this->storage_table . ' - SET filesize = filesize + ' . strlen($content) . ' - WHERE ' . $this->db->sql_build_array('SELECT', $sql_ary); - $this->db->sql_query($sql); + //$sql = 'UPDATE ' . $this->storage_table . ' + // SET filesize = filesize + ' . strlen($content) . ' + // WHERE ' . $this->db->sql_build_array('SELECT', $sql_ary); + //$this->db->sql_query($sql); } else { - $sql_ary['filesize'] = strlen($content); + //$sql_ary['filesize'] = strlen($content); + $sql_ary['filesize'] = 0; $sql = 'INSERT INTO ' . $this->storage_table . $this->db->sql_build_array('INSERT', $sql_ary); $this->db->sql_query($sql); } + } else { @@ -363,8 +365,8 @@ class storage public function get_size() { $sql = 'SELECT SUM(filesize) AS total - FROM ' . $this->storage_table . ' - WHERE storage = ' . $this->get_name(); + FROM ' . $this->storage_table . " + WHERE storage = '" . $this->get_name() . "'"; $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); $this->db->sql_freeresult($result);