diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2012-11-16 10:29:22 -0500 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2012-11-16 10:29:22 -0500 |
commit | 1a2dfa6d4c74a769212aab64f74b0be40dcbc60a (patch) | |
tree | 1990087a553e52ae07606fdf9eb0629fc80afb64 /phpBB/includes/functions.php | |
parent | 9c86f70b4a5b34cbd9c2c58fe3d1614671765e15 (diff) | |
parent | af5d8b502ebf454e058794b8b082f62b4fa4cbe5 (diff) | |
download | forums-1a2dfa6d4c74a769212aab64f74b0be40dcbc60a.tar forums-1a2dfa6d4c74a769212aab64f74b0be40dcbc60a.tar.gz forums-1a2dfa6d4c74a769212aab64f74b0be40dcbc60a.tar.bz2 forums-1a2dfa6d4c74a769212aab64f74b0be40dcbc60a.tar.xz forums-1a2dfa6d4c74a769212aab64f74b0be40dcbc60a.zip |
Merge PR #1074 branch 'develop-olympus' into develop
* develop-olympus:
[ticket/11192] Merge dataProvider arrays because the test is the same now.
[ticket/11192] Update $value parameter description to support other types.
[ticket/11192] Mark negative byte numbers as unsupported.
[ticket/11192] Test strings not converted to int/float before.
[ticket/11192] Also test strings, e.g. sums returned by the database.
[ticket/11192] Also test powers of 10 / 1000.
[ticket/11192] Add tests.
[ticket/11192] Add Tebibyte to get_formatted_filesize().
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 804d89d1a2..3a5b100515 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -229,7 +229,8 @@ function phpbb_gmgetdate($time = false) /** * Return formatted string for filesizes * -* @param int $value filesize in bytes +* @param mixed $value filesize in bytes +* (non-negative number; int, float or string) * @param bool $string_only true if language string should be returned * @param array $allowed_units only allow these units (data array indexes) * @@ -241,6 +242,12 @@ function get_formatted_filesize($value, $string_only = true, $allowed_units = fa global $user; $available_units = array( + 'tb' => array( + 'min' => 1099511627776, // pow(2, 40) + 'index' => 4, + 'si_unit' => 'TB', + 'iec_unit' => 'TIB', + ), 'gb' => array( 'min' => 1073741824, // pow(2, 30) 'index' => 3, |