Skip to content

Commit

Permalink
MDL-71390 core: raise max_input_vars requirement for Moodle 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed May 3, 2021
1 parent 05b03a4 commit b3261d7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions admin/environment.xml
Expand Up @@ -3527,6 +3527,8 @@
<ON_CHECK message="sixtyfourbitswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
2 changes: 2 additions & 0 deletions lang/en/admin.php
Expand Up @@ -1050,6 +1050,8 @@
$string['sessionhandling'] = 'Session handling';
$string['sessiontimeout'] = 'Timeout';
$string['settingfileuploads'] = 'File uploading is required for normal operation, please enable it in PHP configuration.';
$string['settingmaxinputvars'] = 'PHP setting max_input_vars is recommended to be at least 5000.';
$string['settingmaxinputvarsrequired'] = 'PHP setting max_input_vars must be at least 5000.';
$string['settingmemorylimit'] = 'Insufficient memory detected, please set higher memory limit in PHP settings.';
$string['settingsafemode'] = 'Moodle is not fully compatible with safe mode, please ask server administrator to turn it off. Running Moodle under safe mode is not supported, please expect various problems if you do so.';
$string['setupsearchengine'] = 'Setup search engine';
Expand Down
24 changes: 24 additions & 0 deletions lib/upgradelib.php
Expand Up @@ -2717,3 +2717,27 @@ function upgrade_find_theme_location($themename) {

return $dir;
}

/**
* Environment check for the php setting max_input_vars
*
* @param environment_results $result
* @return environment_results|null
*/
function check_max_input_vars(environment_results $result) {
$max = (int)ini_get('max_input_vars');
if ($max < 5000) {
$result->setInfo('max_input_vars');
$result->setStatus(false);
if (PHP_VERSION_ID >= 80000) {
// For PHP8 this check is required.
$result->setLevel('required');
$result->setFeedbackStr('settingmaxinputvarsrequired');
} else {
// For PHP7 this check is optional (recommended).
$result->setFeedbackStr('settingmaxinputvars');
}
return $result;
}
return null;
}

0 comments on commit b3261d7

Please sign in to comment.