Permalink
Browse files

raise_memory() now uses get_real_size(), duplicate function return_by…

…tes() removed.

Issue discussed in 2202 (http://moodle.org/bugs/bug.php?op=show&bugid=2202).
Also seen as arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-424
  • Loading branch information...
1 parent 7a2596f commit 55f21d31e243fabc64fecbd7cdeb79760987aab6 martinlanghoff committed Nov 24, 2004
Showing with 2 additions and 30 deletions.
  1. +2 −30 lib/moodlelib.php
View
@@ -3390,45 +3390,17 @@ function raise_memory_limit ($newlimit) {
if ($cur == -1){
return true; // unlimited mem!
}
- $cur = return_bytes($cur);
+ $cur = get_real_size($cur);
}
- $new = return_bytes($newlimit);
+ $new = get_real_size($newlimit);
if ($new > $cur) {
ini_set('memory_limit', $newlimit);
return true;
}
return false;
}
-/**
-* Function to transform strings like 5M or 128k into bytes.
-* Taken from PHP's documentation (see entry for ini_get())
-*
-* Return integer (in bytes)
-*
-* @param value string with the value
-*/
-function return_bytes($val) {
- $val = trim($val);
- if (empty($val)) {
- return '';
- }
- $last = $val{strlen($val)-1};
- switch($last) {
- case 'k':
- case 'K':
- return (int) $val * 1024;
- break;
- case 'm':
- case 'M':
- return (int) $val * 1048576;
- break;
- default:
- return $val;
- }
-}
-
function unzip_show_status ($list,$removepath) {
//This function shows the results of the unzip execution
//depending of the value of the $CFG->zip, results will be

0 comments on commit 55f21d3

Please sign in to comment.