1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-25 18:13:28 +01:00

[ticket/15342] Add method to storage to get number of tracked files

PHPBB3-15342
This commit is contained in:
Rubén Calvo 2018-06-10 13:57:07 +02:00
parent 83d559afc5
commit 80e5fe255b

View File

@ -299,8 +299,6 @@ class storage
/**
* Get total storage size.
*
* @param string $path The file
*
* @return int Size in bytes
*/
public function get_size()
@ -314,4 +312,21 @@ class storage
return $row;
}
/**
* Get number of storage files.
*
* @return int Number of files
*/
public function get_num_files()
{
$sql = 'SELECT COUNT(file_id) AS total
FROM ' . $this->storage_table . "
WHERE storage = '" . $this->get_name() . "'";
$result = $this->db->sql_query($sql);
$total = (int) $this->db->sql_fetchfield('total');
$this->db->sql_freeresult($result);
return $total;
}
}