diff --git a/admin/tool/brickfield/classes/accessibility.php b/admin/tool/brickfield/classes/accessibility.php index 32d85681179..2655106682b 100644 --- a/admin/tool/brickfield/classes/accessibility.php +++ b/admin/tool/brickfield/classes/accessibility.php @@ -20,7 +20,6 @@ use context_system; use core\log\sql_reader; use moodle_url; use stdClass; -use tool_brickfield\event\plugin_installed; use tool_brickfield\local\tool\filter; /** @@ -109,14 +108,14 @@ class accessibility { /** * Get the relevant title. - * @param local\tool\filter $filter + * @param filter $filter * @param int $countdata * @return string * @throws \coding_exception * @throws \dml_exception * @throws \moodle_exception */ - public static function get_title(local\tool\filter $filter, int $countdata): string { + public static function get_title(filter $filter, int $countdata): string { global $DB; $tmp = new \stdClass(); @@ -471,43 +470,6 @@ class accessibility { return $courseids; } - /** - * Plugin installed. - * @throws coding_exception - * @throws dml_exception - */ - public static function plugin_installed() { - global $USER; - - $readers = get_log_manager()->get_readers(sql_reader::class); - $reader = reset($readers); - $select = 'eventname = :eventname AND action = :action AND target = :target'; - $params = [ - 'eventname' => '\\' . manager::PLUGINNAME . '\event\plugin_installed', - 'action' => 'installed', - 'target' => 'plugin' - ]; - $logplugininstalled = $reader->get_events_select($select, $params, 'timecreated ASC', 0, 1); - if (empty($logplugininstalled)) { - $context = context_system::instance(); - $pi = new stdClass(); - $pi->userid = empty($USER->id) ? 0 : $USER->id; - $pi->contextid = $context->id; - $pi->component = manager::PLUGINNAME; - $pi->modifierid = $pi->userid; - $pi->sortorder = 0; - $event = plugin_installed::create([ - 'context' => $context, - 'relateduserid' => $pi->userid, - 'other' => [ - 'plugin' => $pi->component, - 'installed' => 1 - ] - ]); - $event->trigger(); - } - } - /** * Get summary data for this site. * @param int $id diff --git a/admin/tool/brickfield/classes/event/plugin_installed.php b/admin/tool/brickfield/classes/event/plugin_installed.php deleted file mode 100644 index 8ba590594e2..00000000000 --- a/admin/tool/brickfield/classes/event/plugin_installed.php +++ /dev/null @@ -1,54 +0,0 @@ -. - -namespace tool_brickfield\event; -use coding_exception; -use core\event\base; -use tool_brickfield\manager; - -/** - * Class plugin_installed. - * - * @package tool_brickfield - * @author 2020 JM Tomas - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL - */ -class plugin_installed extends base { - - /** - * Init function. - */ - protected function init() { - $this->data['crud'] = 'u'; - $this->data['edulevel'] = self::LEVEL_OTHER; - } - - /** - * Get name. - * @return string - */ - public static function get_name(): string { - return get_string('installed', manager::PLUGINNAME); - } - - /** - * Get description. - * @return string - */ - public function get_description(): string { - return get_string('installeddescription', manager::PLUGINNAME); - } -} diff --git a/admin/tool/brickfield/classes/eventobservers.php b/admin/tool/brickfield/classes/eventobservers.php index 0fcab252208..685b90a6dc5 100644 --- a/admin/tool/brickfield/classes/eventobservers.php +++ b/admin/tool/brickfield/classes/eventobservers.php @@ -17,7 +17,6 @@ namespace tool_brickfield; use core\event\base; -use tool_brickfield\event\plugin_installed; use stdClass; /** @@ -420,19 +419,6 @@ class eventobservers { } } - /** - * Look for a plugin installed event. - * @param plugin_installed $event - * @throws \moodle_exception - */ - public static function plugin_installed(plugin_installed $event) { - // If this feature has been disabled, do nothing. - if (accessibility::is_accessibility_enabled()) { - $urlregistration = manager::registration_url(); - redirect($urlregistration->out()); - } - } - /** * Add an observer record if appropriate. * @param stdClass $data diff --git a/admin/tool/brickfield/db/events.php b/admin/tool/brickfield/db/events.php index 9c43c5c5c70..219237e2907 100644 --- a/admin/tool/brickfield/db/events.php +++ b/admin/tool/brickfield/db/events.php @@ -26,11 +26,6 @@ defined('MOODLE_INTERNAL') || die(); $observers = [ - [ - 'eventname' => '\tool_brickfield\event\plugin_installed', - 'callback' => '\tool_brickfield\eventobservers::plugin_installed', - 'priority' => 1 - ], [ 'eventname' => '\core\event\course_category_created', 'callback' => '\tool_brickfield\eventobservers::course_category_created', diff --git a/admin/tool/brickfield/settings.php b/admin/tool/brickfield/settings.php index 526cefece9e..e2cb632bbc0 100644 --- a/admin/tool/brickfield/settings.php +++ b/admin/tool/brickfield/settings.php @@ -97,17 +97,12 @@ if ($hassiteconfig) { PARAM_INT )); - // Need to leave this as last addition to setting variable, as it triggers a callback. - $lastitem = new admin_setting_configtext( + $settings->add(new admin_setting_configtext( manager::PLUGINNAME . '/perpage', get_string('perpage', manager::PLUGINNAME), '', 50, - PARAM_INT); - $lastitem->set_updatedcallback(static function(){ - accessibility::plugin_installed(); - }); - $settings->add($lastitem); + PARAM_INT)); $ADMIN->add('brickfieldfolder', $settings); diff --git a/admin/tool/brickfield/version.php b/admin/tool/brickfield/version.php index 4a00604d941..6adc42ff1ce 100644 --- a/admin/tool/brickfield/version.php +++ b/admin/tool/brickfield/version.php @@ -25,5 +25,5 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'tool_brickfield'; -$plugin->version = 2020101918; +$plugin->version = 2020101919; $plugin->requires = 2021042000;