Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 and 403]

   1  <?php
   2  
   3  // * Miscellaneous settings
   4  
   5  if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
   6  
   7      // Experimental settings page
   8      $ADMIN->add('development', new admin_category('experimental', new lang_string('experimental','admin')));
   9  
  10      $temp = new admin_settingpage('experimentalsettings', new lang_string('experimentalsettings', 'admin'));
  11      //TODO: Re-enable cc-import once re-implemented in 2.0.x
  12      //$temp->add(new admin_setting_configcheckbox('enableimsccimport', new lang_string('enable_cc_import', 'imscc'), new lang_string('enable_cc_import_description', 'imscc'), 0));
  13  
  14      $temp->add(new admin_setting_configcheckbox('dndallowtextandlinks', new lang_string('dndallowtextandlinks', 'admin'), new lang_string('configdndallowtextandlinks', 'admin'), 0));
  15  
  16      $temp->add(new admin_setting_configexecutable('pathtosassc', new lang_string('pathtosassc', 'admin'), new lang_string('pathtosassc_help', 'admin'), ''));
  17  
  18      $temp->add(new admin_setting_configcheckbox('contextlocking', new lang_string('contextlocking', 'core_admin'),
  19          new lang_string('contextlocking_desc', 'core_admin'), 0));
  20  
  21      $temp->add(new admin_setting_configcheckbox(
  22              'contextlockappliestoadmin',
  23              new lang_string('contextlockappliestoadmin', 'core_admin'),
  24              new lang_string('contextlockappliestoadmin_desc', 'core_admin'),
  25              1
  26          ));
  27  
  28      $temp->add(new admin_setting_configcheckbox('forceclean', new lang_string('forceclean', 'core_admin'),
  29          new lang_string('forceclean_desc', 'core_admin'), 0));
  30  
  31      // Relative course dates mode setting.
  32      $temp->add(new admin_setting_configcheckbox('enablecourserelativedates',
  33          new lang_string('enablecourserelativedates', 'core_admin'),
  34          new lang_string('enablecourserelativedates_desc', 'core_admin'), 0));
  35  
  36      // Sharing to MoodleNet setting.
  37      $temp->add(new admin_setting_configcheckbox('enablesharingtomoodlenet',
  38          new lang_string('enablesharingtomoodlenet', 'core_admin'),
  39          new lang_string('enablesharingtomoodlenet_desc', 'core_admin'), 0));
  40  
  41      // New communication subsystem setting.
  42      $temp->add(new admin_setting_configcheckbox('enablecommunicationsubsystem',
  43          new lang_string('enablecommunicationsubsystem', 'core_admin'),
  44          new lang_string('enablecommunicationsubsystem_desc', 'core_admin'), 0));
  45  
  46      $ADMIN->add('experimental', $temp);
  47  
  48      // "debugging" settingpage
  49      $temp = new admin_settingpage('debugging', new lang_string('debugging', 'admin'));
  50      $temp->add(new admin_setting_special_debug());
  51      $temp->add(new admin_setting_configcheckbox('debugdisplay', new lang_string('debugdisplay', 'admin'),
  52          new lang_string('configdebugdisplay', 'admin'), 0));
  53      $temp->add(new admin_setting_configcheckbox('perfdebug', new lang_string('perfdebug', 'admin'), new lang_string('configperfdebug', 'admin'), '7', '15', '7'));
  54      $temp->add(new admin_setting_configcheckbox('debugstringids', new lang_string('debugstringids', 'admin'), new lang_string('debugstringids_desc', 'admin'), 0));
  55      $temp->add(new admin_setting_configselect('debugsqltrace',
  56              new lang_string('debugsqltrace', 'admin'),
  57              new lang_string('debugsqltrace_desc', 'admin'), 0, array(
  58                 0 => new lang_string('disabled', 'admin'),
  59                 1 => new lang_string('debugsqltrace1', 'admin'),
  60                 2 => new lang_string('debugsqltrace2', 'admin'),
  61               100 => new lang_string('debugsqltrace100', 'admin'))));
  62      $temp->add(new admin_setting_configcheckbox('debugvalidators', new lang_string('debugvalidators', 'admin'), new lang_string('configdebugvalidators', 'admin'), 0));
  63      $temp->add(new admin_setting_configcheckbox('debugpageinfo', new lang_string('debugpageinfo', 'admin'), new lang_string('configdebugpageinfo', 'admin'), 0));
  64      $temp->add(new admin_setting_configcheckbox('debugtemplateinfo', new lang_string('debugtemplateinfo', 'admin'), new lang_string('debugtemplateinfo_desc', 'admin'), 0));
  65      $ADMIN->add('development', $temp);
  66  
  67      // "Profiling" settingpage (conditionally if the 'xhprof' extension is available only).
  68      $xhprofenabled = extension_loaded('tideways_xhprof');
  69      $xhprofenabled = $xhprofenabled || extension_loaded('tideways');
  70      $xhprofenabled = $xhprofenabled || extension_loaded('xhprof');
  71      $temp = new admin_settingpage('profiling', new lang_string('profiling', 'admin'), 'moodle/site:config', !$xhprofenabled);
  72      // Main profiling switch.
  73      $temp->add(new admin_setting_configcheckbox('profilingenabled', new lang_string('profilingenabled', 'admin'), new lang_string('profilingenabled_help', 'admin'), false));
  74      // List of URLs that will be automatically profiled.
  75      $temp->add(new admin_setting_configtextarea('profilingincluded', new lang_string('profilingincluded', 'admin'), new lang_string('profilingincluded_help', 'admin'), ''));
  76      // List of URLs that won't be profiled ever.
  77      $temp->add(new admin_setting_configtextarea('profilingexcluded', new lang_string('profilingexcluded', 'admin'), new lang_string('profilingexcluded_help', 'admin'), ''));
  78      // Allow random profiling each XX requests.
  79      $temp->add(new admin_setting_configtext('profilingautofrec', new lang_string('profilingautofrec', 'admin'), new lang_string('profilingautofrec_help', 'admin'), 0, PARAM_INT));
  80      // Allow PROFILEME/DONTPROFILEME GPC.
  81      $temp->add(new admin_setting_configcheckbox('profilingallowme', new lang_string('profilingallowme', 'admin'), new lang_string('profilingallowme_help', 'admin'), false));
  82      // Allow PROFILEALL/PROFILEALLSTOP GPC.
  83      $temp->add(new admin_setting_configcheckbox('profilingallowall', new lang_string('profilingallowall', 'admin'), new lang_string('profilingallowall_help', 'admin'), false));
  84      $temp->add(new admin_setting_configtext('profilingslow', new lang_string('profilingslow', 'admin'),
  85          new lang_string('profilingslow_help', 'admin'), 0, PARAM_FLOAT));
  86      // TODO: Allow to skip PHP functions (XHPROF_FLAGS_NO_BUILTINS)
  87      // TODO: Allow to skip call_user functions (ignored_functions array)
  88      // Specify the life time (in minutes) of profiling runs.
  89      $temp->add(new admin_setting_configselect('profilinglifetime', new lang_string('profilinglifetime', 'admin'), new lang_string('profilinglifetime_help', 'admin'), 24*60, array(
  90                 0 => new lang_string('neverdeleteruns', 'admin'),
  91          30*24*60 => new lang_string('numdays', '', 30),
  92          15*24*60 => new lang_string('numdays', '', 15),
  93           7*24*60 => new lang_string('numdays', '', 7),
  94           4*24*60 => new lang_string('numdays', '', 4),
  95           2*24*60 => new lang_string('numdays', '', 2),
  96             24*60 => new lang_string('numhours', '', 24),
  97             16*80 => new lang_string('numhours', '', 16),
  98              8*60 => new lang_string('numhours', '', 8),
  99              4*60 => new lang_string('numhours', '', 4),
 100              2*60 => new lang_string('numhours', '', 2),
 101                60 => new lang_string('numminutes', '', 60),
 102                30 => new lang_string('numminutes', '', 30),
 103                15 => new lang_string('numminutes', '', 15))));
 104      // Define the prefix to be added to imported profiling runs.
 105      $temp->add(new admin_setting_configtext('profilingimportprefix',
 106              new lang_string('profilingimportprefix', 'admin'),
 107              new lang_string('profilingimportprefix_desc', 'admin'), '(I)', PARAM_TAG, 10));
 108  
 109      // Add the 'profiling' page to admin block.
 110      $ADMIN->add('development', $temp);
 111  
 112       // Web service test clients DO NOT COMMIT : THE EXTERNAL WEB PAGE IS NOT AN ADMIN PAGE !!!!!
 113      $ADMIN->add('development', new admin_externalpage('testclient', new lang_string('testclient', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/testclient.php"));
 114  
 115  
 116      if ($CFG->mnet_dispatcher_mode !== 'off') {
 117          $ADMIN->add('development', new admin_externalpage('mnettestclient', new lang_string('testclient', 'mnet'), "$CFG->wwwroot/$CFG->admin/mnet/testclient.php"));
 118      }
 119  
 120      $ADMIN->add('development', new admin_externalpage('purgecaches', new lang_string('purgecachespage', 'admin'),
 121              "$CFG->wwwroot/$CFG->admin/purgecaches.php"));
 122  
 123      $ADMIN->add('development', new admin_externalpage('thirdpartylibs', new lang_string('thirdpartylibs','admin'), "$CFG->wwwroot/$CFG->admin/thirdpartylibs.php"));
 124  
 125      $ADMIN->add('development', new admin_externalpage('hooksoverview',
 126          new lang_string('hooksoverview', 'admin'), "$CFG->wwwroot/$CFG->admin/hooks.php"));
 127  } // end of speedup