mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/15342] Add method to storage to get number of tracked files
PHPBB3-15342
This commit is contained in:
parent
83d559afc5
commit
80e5fe255b
1 changed files with 17 additions and 2 deletions
|
@ -299,8 +299,6 @@ class storage
|
||||||
/**
|
/**
|
||||||
* Get total storage size.
|
* Get total storage size.
|
||||||
*
|
*
|
||||||
* @param string $path The file
|
|
||||||
*
|
|
||||||
* @return int Size in bytes
|
* @return int Size in bytes
|
||||||
*/
|
*/
|
||||||
public function get_size()
|
public function get_size()
|
||||||
|
@ -314,4 +312,21 @@ class storage
|
||||||
|
|
||||||
return $row;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue