Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * External database log store settings.
  19   *
  20   * @package    logstore_database
  21   * @copyright  2013 Petr Skoda {@link http://skodak.org}
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  defined('MOODLE_INTERNAL') || die();
  26  
  27  if ($hassiteconfig) {
  28      $testurl = new moodle_url('/admin/tool/log/store/database/test_settings.php', array('sesskey' => sesskey()));
  29      $test = new admin_externalpage('logstoredbtestsettings', get_string('testsettings', 'logstore_database'),
  30          $testurl, 'moodle/site:config', true);
  31      $ADMIN->add('logging', $test);
  32  
  33      $drivers = \logstore_database\helper::get_drivers();
  34      // Database settings.
  35      $link = html_writer::link($testurl, get_string('testsettings', 'logstore_database'), array('target' => '_blank'));
  36      $settings->add(new admin_setting_heading('dbsettings', get_string('databasesettings', 'logstore_database'),
  37          get_string('databasesettings_help', 'logstore_database', $link)));
  38      $settings->add(new admin_setting_configselect('logstore_database/dbdriver', get_string('databasetypehead', 'install'), '',
  39          '', $drivers));
  40  
  41      $settings->add(new admin_setting_configtext('logstore_database/dbhost', get_string('databasehost', 'install'), '', ''));
  42      $settings->add(new admin_setting_configtext('logstore_database/dbuser', get_string('databaseuser', 'install'), '', ''));
  43      $settings->add(new admin_setting_configpasswordunmask('logstore_database/dbpass', get_string('databasepass', 'install'), '', ''));
  44      $settings->add(new admin_setting_configtext('logstore_database/dbname', get_string('databasename', 'install'), '', ''));
  45      $settings->add(new admin_setting_configtext('logstore_database/dbtable', get_string('databasetable', 'logstore_database'),
  46          get_string('databasetable_help', 'logstore_database'), ''));
  47  
  48      $settings->add(new admin_setting_configcheckbox('logstore_database/dbpersist', get_string('databasepersist',
  49          'logstore_database'), '', '0'));
  50      $settings->add(new admin_setting_configtext('logstore_database/dbsocket', get_string('databasesocket', 'install'), '',
  51          ''));
  52      $settings->add(new admin_setting_configtext('logstore_database/dbport', get_string('databaseport', 'install'), '', ''));
  53      $settings->add(new admin_setting_configtext('logstore_database/dbschema', get_string('databaseschema',
  54          'logstore_database'), '', ''));
  55      $settings->add(new admin_setting_configtext('logstore_database/dbcollation', get_string('databasecollation',
  56          'logstore_database'), '', ''));
  57      $settings->add(new admin_setting_configcheckbox('logstore_database/dbhandlesoptions', get_string('databasehandlesoptions',
  58          'logstore_database'), get_string('databasehandlesoptions_help', 'logstore_database'), '0'));
  59      $settings->add(new admin_setting_configtext('logstore_database/buffersize', get_string('buffersize',
  60          'logstore_database'), get_string('buffersize_help', 'logstore_database'), 50));
  61  
  62      $settings->add(new admin_setting_configcheckbox('logstore_database/jsonformat',
  63              new lang_string('jsonformat', 'logstore_database'),
  64              new lang_string('jsonformat_desc', 'logstore_database'), 1));
  65  
  66      // Filters.
  67      $settings->add(new admin_setting_heading('filters', get_string('filters', 'logstore_database'), get_string('filters_help',
  68          'logstore_database')));
  69      $settings->add(new admin_setting_configcheckbox('logstore_database/logguests', get_string('logguests',
  70          'logstore_database'), '', '0'));
  71      $levels = \logstore_database\helper::get_level_options();
  72      $settings->add(new admin_setting_configmulticheckbox('logstore_database/includelevels', get_string('includelevels',
  73          'logstore_database'), '', $levels, $levels));
  74      $actions = \logstore_database\helper::get_action_options();
  75      $settings->add(new admin_setting_configmulticheckbox('logstore_database/includeactions', get_string('includeactions',
  76          'logstore_database'), '', $actions, $actions));
  77  }