aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authornickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-13 15:58:41 +0000
committernickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-13 15:58:41 +0000
commit52fb3578b3e4758b0887f3c423ed02e2d77ff65e (patch)
tree751ee5053019cf284e1ee9f5a1bab43a4d9b0249 /engine
parent786ab616a6cca7b15926a87b35165b3a994f53d0 (diff)
downloadelgg-52fb3578b3e4758b0887f3c423ed02e2d77ff65e.tar.gz
elgg-52fb3578b3e4758b0887f3c423ed02e2d77ff65e.tar.bz2
Creating a helper function to return INI values in bytes.
git-svn-id: http://code.elgg.org/elgg/trunk@3804 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/elgglib.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index c0d19743a..3224fe4e2 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -2447,6 +2447,32 @@ function elgg_validate_action_url($link) {
return elgg_http_build_url($url);
}
+/**
+ * Returns the PHP INI setting in bytes
+ *
+ * @param str $setting
+ * @return int
+ * @since 1.7
+ * @link http://www.php.net/manual/en/function.ini-get.php
+ */
+function elgg_get_ini_setting_in_bytes($setting) {
+ // retrieve INI setting
+ $val = ini_get($setting);
+
+ // convert INI setting when shorthand notation is used
+ $last = strtolower($val[strlen($val)-1]);
+ switch($last) {
+ case 'g':
+ $val *= 1024;
+ case 'm':
+ $val *= 1024;
+ case 'k':
+ $val *= 1024;
+ }
+
+ // return byte value
+ return $val;
+}
/**
* Server javascript pages.