Merge branch 'MDL-38191-master' of git://github.com/sammarshallou/moodle

This commit is contained in:
Sam Hemelryk 2013-08-13 10:26:26 +12:00
commit 0c0efd71a1
4 changed files with 32 additions and 8 deletions

View File

@ -175,16 +175,25 @@ $ADMIN->add('server', new admin_externalpage('phpinfo', new lang_string('phpinfo
// "performance" settingpage
$temp = new admin_settingpage('performance', new lang_string('performance', 'admin'));
// Memory limit options for large administration tasks.
$memoryoptions = array(
'64M' => '64M',
'128M' => '128M',
'256M' => '256M',
'512M' => '512M',
'1024M' => '1024M',
'2048M' => '2048M');
// Allow larger memory usage for 64-bit sites only.
if (PHP_INT_SIZE === 8) {
$memoryoptions['3072M'] = '3072M';
$memoryoptions['4096M'] = '4096M';
}
$temp->add(new admin_setting_configselect('extramemorylimit', new lang_string('extramemorylimit', 'admin'),
new lang_string('configextramemorylimit', 'admin'), '512M',
// if this option is set to 0, default 128M will be used
array( '64M' => '64M',
'128M' => '128M',
'256M' => '256M',
'512M' => '512M',
'1024M' => '1024M',
'2048M' => '2048M',
)));
$memoryoptions));
$temp->add(new admin_setting_configtext('curlcache', new lang_string('curlcache', 'admin'),
new lang_string('configcurlcache', 'admin'), 120, PARAM_INT));

View File

@ -79,6 +79,10 @@ switch ($type) {
print_error('unknownbackuptype');
}
// Backup of large courses requires extra memory. Use the amount configured
// in admin settings.
raise_memory_limit(MEMORY_EXTRA);
if (!($bc = backup_ui::load_controller($backupid))) {
$bc = new backup_controller($type, $id, backup::FORMAT_MOODLE,
backup::INTERACTIVE_YES, backup::MODE_GENERAL, $USER->id);

View File

@ -17,6 +17,10 @@ $PAGE->set_pagelayout('standard');
require_login($course, null, $cm);
require_capability('moodle/restore:restorecourse', $context);
// Restore of large courses requires extra memory. Use the amount configured
// in admin settings.
raise_memory_limit(MEMORY_EXTRA);
if ($stage & restore_ui::STAGE_CONFIRM + restore_ui::STAGE_DESTINATION) {
$restore = restore_ui::engage_independent_stage($stage, $contextid);
} else {

View File

@ -1025,7 +1025,14 @@ function raise_memory_limit($newlimit) {
}
} else if ($newlimit == MEMORY_HUGE) {
// MEMORY_HUGE uses 2G or MEMORY_EXTRA, whichever is bigger.
$newlimit = get_real_size('2G');
if (!empty($CFG->extramemorylimit)) {
$extra = get_real_size($CFG->extramemorylimit);
if ($extra > $newlimit) {
$newlimit = $extra;
}
}
} else {
$newlimit = get_real_size($newlimit);