Skip to content

Commit

Permalink
Merge branch 'MDL-73397-master' of https://github.com/aanabit/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies committed Jan 4, 2022
2 parents bc8b1be + dd97955 commit 64915be
Show file tree
Hide file tree
Showing 94 changed files with 1,724 additions and 1,583 deletions.
2 changes: 1 addition & 1 deletion admin/index.php
Expand Up @@ -722,7 +722,7 @@

// Apply default preset, if it is defined in $CFG and has a valid value.
if (!empty($CFG->setsitepresetduringinstall)) {
\tool_admin_presets\helper::change_default_preset($CFG->setsitepresetduringinstall);
\core_adminpresets\helper::change_default_preset($CFG->setsitepresetduringinstall);
}

// we need this redirect to setup proper session
Expand Down
17 changes: 15 additions & 2 deletions admin/settings/security.php
Expand Up @@ -141,10 +141,23 @@
$temp->add(new admin_setting_configcheckbox('emailchangeconfirmation', new lang_string('emailchangeconfirmation', 'admin'), new lang_string('configemailchangeconfirmation', 'admin'), 1));
$temp->add(new admin_setting_configselect('rememberusername', new lang_string('rememberusername','admin'), new lang_string('rememberusername_desc','admin'), 2, array(1=>new lang_string('yes'), 0=>new lang_string('no'), 2=>new lang_string('optional'))));
$temp->add(new admin_setting_configcheckbox('strictformsrequired', new lang_string('strictformsrequired', 'admin'), new lang_string('configstrictformsrequired', 'admin'), 0));
$ADMIN->add('security', $temp);


$temp->add(new admin_setting_heading('adminpresets', new lang_string('siteadminpresetspluginname', 'core_adminpresets'), ''));
$sensiblesettingsdefault = 'recaptchapublickey@@none, recaptchaprivatekey@@none, googlemapkey3@@none, ';
$sensiblesettingsdefault .= 'secretphrase@@url, cronremotepassword@@none, smtpuser@@none, ';
$sensiblesettingsdefault .= 'smtppass@none, proxypassword@@none, quizpassword@@quiz, allowedip@@none, blockedip@@none, ';
$sensiblesettingsdefault .= 'dbpass@@logstore_database, messageinbound_hostpass@@none, ';
$sensiblesettingsdefault .= 'bind_pw@@auth_cas, pass@@auth_db, bind_pw@@auth_ldap, ';
$sensiblesettingsdefault .= 'dbpass@@enrol_database, bind_pw@@enrol_ldap, ';
$sensiblesettingsdefault .= 'server_password@@search_solr, ssl_keypassword@@search_solr, ';
$sensiblesettingsdefault .= 'alternateserver_password@@search_solr, alternatessl_keypassword@@search_solr, ';
$sensiblesettingsdefault .= 'test_password@@cachestore_redis, password@@mlbackend_python';
$temp->add(new admin_setting_configtextarea('adminpresets/sensiblesettings',
get_string('sensiblesettings', 'core_adminpresets'),
get_string('sensiblesettingstext', 'core_adminpresets'),
$sensiblesettingsdefault, PARAM_TEXT));

$ADMIN->add('security', $temp);

// "httpsecurity" settingpage
$temp = new admin_settingpage('httpsecurity', new lang_string('httpsecurity', 'admin'));
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/admin_presets/classes/event/preset_deleted.php
Expand Up @@ -43,6 +43,6 @@ public function get_legacy_logdata(): array {
protected function init(): void {
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'tool_admin_presets';
$this->data['objecttable'] = 'adminpresets';
}
}
Expand Up @@ -44,6 +44,6 @@ public function get_url(): \moodle_url {
protected function init(): void {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'tool_admin_presets';
$this->data['objecttable'] = 'adminpresets';
}
}
2 changes: 1 addition & 1 deletion admin/tool/admin_presets/classes/event/preset_exported.php
Expand Up @@ -48,6 +48,6 @@ public function get_legacy_logdata(): array {
protected function init(): void {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'tool_admin_presets';
$this->data['objecttable'] = 'adminpresets';
}
}
2 changes: 1 addition & 1 deletion admin/tool/admin_presets/classes/event/preset_imported.php
Expand Up @@ -48,6 +48,6 @@ public function get_legacy_logdata(): array {
protected function init(): void {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'tool_admin_presets';
$this->data['objecttable'] = 'adminpresets';
}
}
2 changes: 1 addition & 1 deletion admin/tool/admin_presets/classes/event/preset_loaded.php
Expand Up @@ -48,6 +48,6 @@ public function get_legacy_logdata(): array {
protected function init(): void {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'tool_admin_presets';
$this->data['objecttable'] = 'adminpresets';
}
}
Expand Up @@ -44,6 +44,6 @@ public function get_url(): \moodle_url {
protected function init(): void {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'tool_admin_presets';
$this->data['objecttable'] = 'adminpresets';
}
}
2 changes: 1 addition & 1 deletion admin/tool/admin_presets/classes/event/preset_reverted.php
Expand Up @@ -43,6 +43,6 @@ public function get_legacy_logdata(): array {
protected function init(): void {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'tool_admin_presets';
$this->data['objecttable'] = 'adminpresets';
}
}
2 changes: 1 addition & 1 deletion admin/tool/admin_presets/classes/event/presets_listed.php
Expand Up @@ -47,6 +47,6 @@ public function get_legacy_logdata(): array {
protected function init(): void {
$this->data['crud'] = 'r';
$this->data['edulevel'] = self::LEVEL_OTHER;
$this->data['objecttable'] = 'tool_admin_presets';
$this->data['objecttable'] = 'adminpresets';
}
}
162 changes: 0 additions & 162 deletions admin/tool/admin_presets/classes/helper.php

This file was deleted.

4 changes: 2 additions & 2 deletions admin/tool/admin_presets/classes/local/action/base.php
Expand Up @@ -18,7 +18,7 @@

use context_system;
use moodle_url;
use tool_admin_presets\manager;
use core_adminpresets\manager;
use tool_admin_presets\output\presets_list;
use tool_admin_presets\output\export_import;

Expand Down Expand Up @@ -84,7 +84,7 @@ public function show(): void {
$options = new export_import();
$this->outputs = $OUTPUT->render($options);

$presets = $DB->get_records('tool_admin_presets');
$presets = $DB->get_records('adminpresets');
$list = new presets_list($presets, true);
$this->outputs .= $OUTPUT->render($list);
}
Expand Down
6 changes: 3 additions & 3 deletions admin/tool/admin_presets/classes/local/action/delete.php
Expand Up @@ -35,7 +35,7 @@ public function show(): void {
global $DB, $OUTPUT;

// Getting the preset name.
$presetdata = $DB->get_record('tool_admin_presets', ['id' => $this->id], 'name');
$presetdata = $DB->get_record('adminpresets', ['id' => $this->id], 'name');

if ($presetdata) {
$deletetext = get_string('deletepreset', 'tool_admin_presets', $presetdata->name);
Expand All @@ -46,7 +46,7 @@ public function show(): void {
$cancelurl = new \moodle_url('/admin/tool/admin_presets/index.php');

// If the preset was applied add a warning text.
if ($DB->get_records('tool_admin_presets_app', ['adminpresetid' => $this->id])) {
if ($DB->get_records('adminpresets_app', ['adminpresetid' => $this->id])) {
$deletetext .= '<p><strong>' .
get_string("deletepreviouslyapplied", "tool_admin_presets") . '</strong></p>';
}
Expand All @@ -56,7 +56,7 @@ public function show(): void {
];
$this->outputs = $OUTPUT->confirm($deletetext, $confirmurl, $cancelurl, $displayoptions);
} else {
throw new moodle_exception('errordeleting', 'tool_admin_presets');
throw new moodle_exception('errordeleting', 'core_adminpresets');
}
}

Expand Down
4 changes: 2 additions & 2 deletions admin/tool/admin_presets/classes/local/action/load.php
Expand Up @@ -100,8 +100,8 @@ public function show(): void {
$data->id = $this->id;

// Preset data.
if (!$preset = $DB->get_record('tool_admin_presets', ['id' => $data->id])) {
throw new moodle_exception('errornopreset', 'tool_admin_presets');
if (!$preset = $DB->get_record('adminpresets', ['id' => $data->id])) {
throw new moodle_exception('errornopreset', 'core_adminpresets');
}

// Print preset basic data.
Expand Down
6 changes: 3 additions & 3 deletions admin/tool/admin_presets/classes/local/action/rollback.php
Expand Up @@ -36,11 +36,11 @@ public function show(): void {
global $DB, $OUTPUT;

// Preset data.
$preset = $DB->get_record('tool_admin_presets', ['id' => $this->id]);
$preset = $DB->get_record('adminpresets', ['id' => $this->id]);

// Applications data.
$context = new stdClass();
$applications = $DB->get_records('tool_admin_presets_app', ['adminpresetid' => $this->id], 'time DESC');
$applications = $DB->get_records('adminpresets_app', ['adminpresetid' => $this->id], 'time DESC');
$context->noapplications = !empty($applications);
$context->applications = [];
foreach ($applications as $application) {
Expand Down Expand Up @@ -106,7 +106,7 @@ protected function get_title(): string {
global $DB;

$title = '';
if ($preset = $DB->get_record('tool_admin_presets', ['id' => $this->id])) {
if ($preset = $DB->get_record('adminpresets', ['id' => $this->id])) {
$title = get_string($this->action . $this->mode, 'tool_admin_presets', $preset->name);
}

Expand Down
2 changes: 1 addition & 1 deletion admin/tool/admin_presets/classes/output/presets_list.php
Expand Up @@ -118,7 +118,7 @@ public function export_for_template(renderer_base $output): stdClass {
}

// Look for preset applications.
if ($DB->get_records('tool_admin_presets_app', ['adminpresetid' => $preset->id])) {
if ($DB->get_records('adminpresets_app', ['adminpresetid' => $preset->id])) {
$params = ['action' => 'rollback', 'id' => $preset->id];
$rollbacklink = new \moodle_url('/admin/tool/admin_presets/index.php', $params);
$actionsmenu->add(new \action_menu_link_secondary(
Expand Down

0 comments on commit 64915be

Please sign in to comment.