Commit 039564a5 authored by Nigel Cunningham's avatar Nigel Cunningham Committed by Gerrit Code Review

(Bug785472) Remove unneeded raise_memory_limit calls

On the basis of my profiling and testing over the last week,
all of the scripts affected by this patch don't need their
raise_memory_limit calls. Ensure_sanity currently sets the
memory limit to 128MB, which has been seen to be more than
sufficient for each of these use cases.

Tests have involved at least 1000 records being imported in
each case, and sometimes as many as 20,000. I would have
liked to have tested with some really full profiles (eg
lots of pictures and content), but am satisfied that there's
enough margin to cover those cases. In any case, such files
are often handled using external apps and therefore won't
be counted toward PHP's memory use anyway. Finally, the
limit can easily be increased by the user if necessary for
a particular case.

Change-Id: Ifecc83fd47da51268bae6cbd6960735eb91f9403
Signed-off-by: default avatarNigel Cunningham <nigelc@catalyst-au.net>
parent 5cdd1f45
...@@ -18,7 +18,6 @@ require_once('pieforms/pieform.php'); ...@@ -18,7 +18,6 @@ require_once('pieforms/pieform.php');
require_once(get_config('libroot') . 'group.php'); require_once(get_config('libroot') . 'group.php');
require_once(get_config('libroot') . 'institution.php'); require_once(get_config('libroot') . 'institution.php');
safe_require('artefact', 'internal'); safe_require('artefact', 'internal');
raise_memory_limit("512M");
// Turn on autodetecting of line endings, so mac newlines (\r) will work // Turn on autodetecting of line endings, so mac newlines (\r) will work
ini_set('auto_detect_line_endings', 1); ini_set('auto_detect_line_endings', 1);
......
...@@ -18,7 +18,6 @@ require_once('pieforms/pieform.php'); ...@@ -18,7 +18,6 @@ require_once('pieforms/pieform.php');
require_once(get_config('libroot') . 'group.php'); require_once(get_config('libroot') . 'group.php');
require_once(get_config('libroot') . 'institution.php'); require_once(get_config('libroot') . 'institution.php');
safe_require('artefact', 'internal'); safe_require('artefact', 'internal');
raise_memory_limit("512M");
// Turn on autodetecting of line endings, so mac newlines (\r) will work // Turn on autodetecting of line endings, so mac newlines (\r) will work
ini_set('auto_detect_line_endings', 1); ini_set('auto_detect_line_endings', 1);
......
...@@ -122,8 +122,6 @@ $localsuccess = json_encode(get_string('localdatasuccess', 'admin')); ...@@ -122,8 +122,6 @@ $localsuccess = json_encode(get_string('localdatasuccess', 'admin'));
// Check if Mahara is being installed. An extra hook is required to insert core // Check if Mahara is being installed. An extra hook is required to insert core
// data if so. // data if so.
if (!empty($upgrades['core']->install)) { if (!empty($upgrades['core']->install)) {
raise_time_limit(120);
raise_memory_limit('256M');
$upgrades['firstcoredata'] = true; $upgrades['firstcoredata'] = true;
$upgrades['localpreinst'] = true; $upgrades['localpreinst'] = true;
$upgrades['lastcoredata'] = true; $upgrades['lastcoredata'] = true;
......
...@@ -17,8 +17,6 @@ require_once('institution.php'); ...@@ -17,8 +17,6 @@ require_once('institution.php');
require_once(get_config('docroot') . '/lib/htmloutput.php'); require_once(get_config('docroot') . '/lib/htmloutput.php');
safe_require('artefact', 'internal'); safe_require('artefact', 'internal');
safe_require('artefact', 'file'); safe_require('artefact', 'file');
raise_memory_limit('1024M');
set_time_limit(300); // 5 minutes
define('TITLE', get_string('bulkleap2aimport', 'admin')); define('TITLE', get_string('bulkleap2aimport', 'admin'));
......
...@@ -18,7 +18,6 @@ require_once('pieforms/pieform.php'); ...@@ -18,7 +18,6 @@ require_once('pieforms/pieform.php');
require_once('institution.php'); require_once('institution.php');
require_once('phpmailer/class.phpmailer.php'); require_once('phpmailer/class.phpmailer.php');
safe_require('artefact', 'internal'); safe_require('artefact', 'internal');
raise_memory_limit("512M");
// Turn on autodetecting of line endings, so mac newlines (\r) will work // Turn on autodetecting of line endings, so mac newlines (\r) will work
ini_set('auto_detect_line_endings', 1); ini_set('auto_detect_line_endings', 1);
......
...@@ -37,9 +37,6 @@ define('SECTION_PLUGINNAME', 'import'); ...@@ -37,9 +37,6 @@ define('SECTION_PLUGINNAME', 'import');
define('SECTION_PAGE', 'index'); define('SECTION_PAGE', 'index');
//TODO: Optimize!
raise_memory_limit("512M");
define('PRINTUPLOADFORM_ACT', 0); define('PRINTUPLOADFORM_ACT', 0);
define('PRINTIMPORTITEMSFORM_ACT', 1); define('PRINTIMPORTITEMSFORM_ACT', 1);
define('DOIMPORT_ACT', 2); define('DOIMPORT_ACT', 2);
......
...@@ -28,7 +28,6 @@ $fake = isset($argv[1]); ...@@ -28,7 +28,6 @@ $fake = isset($argv[1]);
$start = $fake ? strtotime($argv[1]) : $realstart; $start = $fake ? strtotime($argv[1]) : $realstart;
log_info('---------- cron running ' . date('r', $start) . ' ----------'); log_info('---------- cron running ' . date('r', $start) . ' ----------');
raise_memory_limit('128M');
if (!is_writable(get_config('dataroot'))) { if (!is_writable(get_config('dataroot'))) {
log_warn("Unable to write to dataroot directory."); log_warn("Unable to write to dataroot directory.");
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
*/ */
defined('INTERNAL') || die(); defined('INTERNAL') || die();
raise_memory_limit("512M");
define('MAX_LINE_LENGTH', 1024); define('MAX_LINE_LENGTH', 1024);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment