diff --git a/admin/cli/install_database.php b/admin/cli/install_database.php index 87202f29ca3..17f6d59309d 100644 --- a/admin/cli/install_database.php +++ b/admin/cli/install_database.php @@ -85,7 +85,7 @@ if ($DB->get_tables() ) { $CFG->early_install_lang = true; get_string_manager(true); -@raise_memory_limit('128M'); +raise_memory_limit(MEMORY_EXTRA); // now get cli options list($options, $unrecognized) = cli_get_params( diff --git a/admin/health.php b/admin/health.php index 385792604d0..e18a052c059 100644 --- a/admin/health.php +++ b/admin/health.php @@ -330,7 +330,7 @@ class problem_000008 extends problem_base { global $CFG; $oldmemlimit = @ini_get('memory_limit'); - if(empty($oldmemlimit)) { + if (empty($oldmemlimit)) { // PHP not compiled with memory limits, this means that it's // probably limited to 8M or in case of Windows not at all. // We can ignore it for now - there is not much to test anyway @@ -338,12 +338,9 @@ class problem_000008 extends problem_base { return false; } $oldmemlimit = get_real_size($oldmemlimit); - //now lets change the memory limit to something unique below 128M==134217728 - if (empty($CFG->extramemorylimit)) { - raise_memory_limit('128M'); - } else { - raise_memory_limit($CFG->extramemorylimit); - } + //now lets change the memory limit to something higher + $newmemlimit = ($oldmemlimit + 1024*1024*5); + raise_memory_limit($newmemlimit); $testmemlimit = get_real_size(@ini_get('memory_limit')); //verify the change had any effect at all if ($oldmemlimit == $testmemlimit) { diff --git a/admin/report/security/index.php b/admin/report/security/index.php index d4415eb0e63..ddb96d73097 100644 --- a/admin/report/security/index.php +++ b/admin/report/security/index.php @@ -39,7 +39,7 @@ if (array_search($issue, $issues, true) === false) { } // we may need a bit more memory and this may take a long time to process -@raise_memory_limit('128M'); +raise_memory_limit(MEMORY_EXTRA); @set_time_limit(0); // Print the header. diff --git a/admin/report/unittest/index.php b/admin/report/unittest/index.php index 0f56a167467..6ccc938caf6 100644 --- a/admin/report/unittest/index.php +++ b/admin/report/unittest/index.php @@ -18,7 +18,7 @@ require_once('ex_reporter.php'); // Always run the unit tests in developer debug mode. $CFG->debug = DEBUG_DEVELOPER; error_reporting($CFG->debug); -raise_memory_limit('256M'); +raise_memory_limit(MEMORY_EXTRA); // page parameters $path = optional_param('path', null, PARAM_PATH); diff --git a/backup/lib.php b/backup/lib.php index 2ced1d52180..885c7caeb51 100644 --- a/backup/lib.php +++ b/backup/lib.php @@ -556,11 +556,7 @@ return false; } @ini_set("max_execution_time","3000"); - if (empty($CFG->extramemorylimit)) { - raise_memory_limit('128M'); - } else { - raise_memory_limit($CFG->extramemorylimit); - } + raise_memory_limit(MEMORY_EXTRA); if (!$backup_unique_code = restore_precheck($destinationcourse,$pathtofile,$errorstr,true)) { mtrace($debuginfo.'Failed restore_precheck (error was '.$errorstr.')'); diff --git a/enrol/database/lib.php b/enrol/database/lib.php index 185d5fc3aa0..b99090ce319 100644 --- a/enrol/database/lib.php +++ b/enrol/database/lib.php @@ -244,7 +244,7 @@ class enrol_database_plugin extends enrol_plugin { // we may need a lot of memory here @set_time_limit(0); - @raise_memory_limit("512M"); + raise_memory_limit(MEMORY_HUGE); $extdb = $this->db_init(); @@ -477,7 +477,7 @@ class enrol_database_plugin extends enrol_plugin { // we may need a lot of memory here @set_time_limit(0); - @raise_memory_limit("512M"); + raise_memory_limit(MEMORY_HUGE); $extdb = $this->db_init(); diff --git a/enrol/ldap/lib.php b/enrol/ldap/lib.php index 86be4665aa5..04472b086b8 100644 --- a/enrol/ldap/lib.php +++ b/enrol/ldap/lib.php @@ -138,7 +138,7 @@ class enrol_ldap_plugin extends enrol_plugin { // We may need a lot of memory here @set_time_limit(0); - @raise_memory_limit("512M"); + raise_memory_limit(MEMORY_HUGE); // Get enrolments for each type of role. $roles = get_all_roles(); @@ -297,7 +297,7 @@ class enrol_ldap_plugin extends enrol_plugin { // we may need a lot of memory here @set_time_limit(0); - @raise_memory_limit("512M"); + raise_memory_limit(MEMORY_HUGE); // Get enrolments for each type of role. $roles = get_all_roles(); diff --git a/grade/import/csv/index.php b/grade/import/csv/index.php index 69d147d7b5f..4cd70b3dd45 100755 --- a/grade/import/csv/index.php +++ b/grade/import/csv/index.php @@ -100,7 +100,7 @@ if ($formdata = $mform->get_data()) { // that we'll take longer, and that the process should be recycled soon // to free up memory. @set_time_limit(0); - @raise_memory_limit("192M"); + raise_memory_limit(MEMORY_EXTRA); // use current (non-conflicting) time stamp $importcode = get_new_importcode(); @@ -205,7 +205,7 @@ if ($formdata = $mform->get_data()) { // that we'll take longer, and that the process should be recycled soon // to free up memory. @set_time_limit(0); - @raise_memory_limit("192M"); + raise_memory_limit(MEMORY_EXTRA); // we only operate if file is readable if ($fp = fopen($filename, "r")) { diff --git a/grade/import/xml/import.php b/grade/import/xml/import.php index baf7510c450..3c941f090f1 100644 --- a/grade/import/xml/import.php +++ b/grade/import/xml/import.php @@ -44,7 +44,7 @@ require_capability('gradeimport/xml:view', $context); // that we'll take longer, and that the process should be recycled soon // to free up memory. @set_time_limit(0); -@raise_memory_limit("256M"); +raise_memory_limit(MEMORY_EXTRA); $text = download_file_content($url); if ($text === false) { diff --git a/grade/import/xml/index.php b/grade/import/xml/index.php index efa2f2ab332..5ce766b4331 100755 --- a/grade/import/xml/index.php +++ b/grade/import/xml/index.php @@ -48,7 +48,7 @@ if ($data = $mform->get_data()) { // that we'll take longer, and that the process should be recycled soon // to free up memory. @set_time_limit(0); - @raise_memory_limit("256M"); + raise_memory_limit(MEMORY_EXTRA); if ($text = $mform->get_file_content('userfile')) { print_grade_page_head($COURSE->id, 'import', 'xml', get_string('importxml', 'grades')); diff --git a/lib/cronlib.php b/lib/cronlib.php index 76b6e61b798..d1904879550 100644 --- a/lib/cronlib.php +++ b/lib/cronlib.php @@ -52,7 +52,7 @@ function cron_run() { $starttime = microtime(); /// increase memory limit (PHP 5.2 does different calculation, we need more memory now) - @raise_memory_limit('128M'); + raise_memory_limit(MEMORY_EXTRA); /// emulate normal session cron_setup_user(); @@ -333,7 +333,7 @@ function cron_run() { //Execute backup's cron //Perhaps a long time and memory could help in large sites @set_time_limit(0); - @raise_memory_limit("192M"); + raise_memory_limit(MEMORY_EXTRA); if (file_exists("$CFG->dirroot/backup/backup_scheduled.php") and file_exists("$CFG->dirroot/backup/backuplib.php") and file_exists("$CFG->dirroot/backup/lib.php") and diff --git a/mod/assignment/type/online/assignment.class.php b/mod/assignment/type/online/assignment.class.php index fce9463f28f..7317f3e0c8b 100644 --- a/mod/assignment/type/online/assignment.class.php +++ b/mod/assignment/type/online/assignment.class.php @@ -385,7 +385,7 @@ class assignment_online extends assignment_base { public function download_submissions() { global $CFG, $DB; - @raise_memory_limit('256M'); + raise_memory_limit(MEMORY_EXTRA); $submissions = $this->get_submissions('',''); if (empty($submissions)) { @@ -403,7 +403,7 @@ class assignment_online extends assignment_base { } else { $groupmode = $this->course->groupmode; } - + $groupid = 0; // All users $groupname = ''; if ($groupmode) { diff --git a/mod/data/import.php b/mod/data/import.php index 8352780c76b..346c54ff692 100755 --- a/mod/data/import.php +++ b/mod/data/import.php @@ -107,7 +107,7 @@ if (!$formdata = $form->get_data()) { // that we'll take longer, and that the process should be recycled soon // to free up memory. @set_time_limit(0); - @raise_memory_limit("96M"); + raise_memory_limit(MEMORY_EXTRA); $iid = csv_import_reader::get_new_iid('moddata'); $cir = new csv_import_reader($iid, 'moddata'); diff --git a/search/cron_php5.php b/search/cron_php5.php index 276147332b8..fa53cc17408 100644 --- a/search/cron_php5.php +++ b/search/cron_php5.php @@ -2,7 +2,7 @@ /* * Moodle global search engine * This is a special externalized code for cron handling in PHP5. -* Should never be called by a php 4.3.0 implementation. +* Should never be called by a php 4.3.0 implementation. * @package search * @category core * @subpackage search_engine @@ -14,11 +14,7 @@ try{ ini_set('max_execution_time', 300); - if (empty($CFG->extramemorylimit)) { - raise_memory_limit('128M'); - } else { - raise_memory_limit($CFG->extramemorylimit); - } + raise_memory_limit(MEMORY_EXTRA); mtrace("\n--DELETE----"); require_once($CFG->dirroot.'/search/delete.php'); diff --git a/webservice/lib.php b/webservice/lib.php index 1b4f9f002e5..bc9c4ce6999 100644 --- a/webservice/lib.php +++ b/webservice/lib.php @@ -701,7 +701,7 @@ abstract class webservice_zend_server extends webservice_server { */ public function run() { // we will probably need a lot of memory in some functions - @raise_memory_limit('128M'); + raise_memory_limit(MEMORY_EXTRA); // set some longer timeout, this script is not sending any output, // this means we need to manually extend the timeout operations @@ -1141,7 +1141,7 @@ abstract class webservice_base_server extends webservice_server { */ public function run() { // we will probably need a lot of memory in some functions - @raise_memory_limit('128M'); + raise_memory_limit(MEMORY_EXTRA); // set some longer timeout, this script is not sending any output, // this means we need to manually extend the timeout operations