From 2211258169a63a6b412a3937588555ad53658130 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Wed, 24 Feb 2010 21:00:36 +0000 Subject: [PATCH] Check memory_get_usage availability (bug #2957708) git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1331 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- adminer/sql.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adminer/sql.inc.php b/adminer/sql.inc.php index 6af08e5d..540a9f34 100644 --- a/adminer/sql.inc.php +++ b/adminer/sql.inc.php @@ -21,7 +21,9 @@ if (!$error && $_POST) { $query = get_file("sql_file", true); } if (is_string($query)) { // get_file() returns error as number, fread() as false - @ini_set("memory_limit", 2 * strlen($query) + memory_get_usage() + 8e6); // @ - may be disabled, 2 - substr and trim, 8e6 - other variables + if (function_exists('memory_get_usage')) { + @ini_set("memory_limit", 2 * strlen($query) + memory_get_usage() + 8e6); // @ - may be disabled, 2 - substr and trim, 8e6 - other variables + } if ($query != "" && strlen($query) < 1e6 && (!$history || end($history) != $query)) { // don't add repeated and big queries $history[] = $query; }