MDL-55188 events: First deprecation of eventslib.php

This commit is contained in:
Adrian Greeve 2018-07-16 10:21:16 +08:00
parent 2769bf315b
commit 5454e72c21
18 changed files with 144 additions and 174 deletions

View File

@ -35,7 +35,6 @@ define('NO_DEBUG_DISPLAY', true);
// @codingStandardsIgnoreLine This script does not require login. // @codingStandardsIgnoreLine This script does not require login.
require("../../config.php"); require("../../config.php");
require_once("lib.php"); require_once("lib.php");
require_once($CFG->libdir.'/eventslib.php');
require_once($CFG->libdir.'/enrollib.php'); require_once($CFG->libdir.'/enrollib.php');
require_once($CFG->libdir . '/filelib.php'); require_once($CFG->libdir . '/filelib.php');

View File

@ -1,7 +1,6 @@
<?php <?php
require('../config.php'); require('../config.php');
require_once($CFG->libdir.'/eventslib.php');
// Form submitted, do not check referer (original page unknown). // Form submitted, do not check referer (original page unknown).
if ($form = data_submitted()) { if ($form = data_submitted()) {

View File

@ -234,9 +234,6 @@ function uninstall_plugin($type, $name) {
// delete the capabilities that were defined by this module // delete the capabilities that were defined by this module
capabilities_cleanup($component); capabilities_cleanup($component);
// remove event handlers and dequeue pending events
events_uninstall($component);
// Delete all remaining files in the filepool owned by the component. // Delete all remaining files in the filepool owned by the component.
$fs = get_file_storage(); $fs = get_file_storage();
$fs->delete_component_files($component); $fs->delete_component_files($component);

View File

@ -6607,3 +6607,136 @@ function groups_get_all_groups_for_courses($courses) {
return $groups; return $groups;
} }
/**
* Gets the capabilities that have been cached in the database for this
* component.
* @deprecated since Moodle 3.6. Please use the Events 2 API.
* @todo final deprecation. To be removed in Moodle 4.0
*
* @access protected To be used from eventslib only
*
* @param string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'
* @return array of events
*/
function events_get_cached($component) {
global $DB;
debugging('Events API using $handlers array has been deprecated in favour of Events 2 API, please use it instead.',
DEBUG_DEVELOPER);
$cachedhandlers = array();
if ($storedhandlers = $DB->get_records('events_handlers', array('component'=>$component))) {
foreach ($storedhandlers as $handler) {
$cachedhandlers[$handler->eventname] = array (
'id' => $handler->id,
'handlerfile' => $handler->handlerfile,
'handlerfunction' => $handler->handlerfunction,
'schedule' => $handler->schedule,
'internal' => $handler->internal);
}
}
return $cachedhandlers;
}
/**
* Remove all event handlers and queued events
* @deprecated since Moodle 3.6. Please use the Events 2 API.
* @todo final deprecation. To be removed in Moodle 4.0
*
* @category event
* @param string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'
*/
function events_uninstall($component) {
debugging('Events API using $handlers array has been deprecated in favour of Events 2 API, please use it instead.',
DEBUG_DEVELOPER);
$cachedhandlers = events_get_cached($component);
events_cleanup($component, $cachedhandlers);
events_get_handlers('reset');
}
/**
* Deletes cached events that are no longer needed by the component.
* @deprecated since Moodle 3.6. Please use the Events 2 API.
* @todo final deprecation. To be removed in Moodle 4.0
*
* @access protected To be used from eventslib only
*
* @param string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'
* @param array $cachedhandlers array of the cached events definitions that will be
* @return int number of unused handlers that have been removed
*/
function events_cleanup($component, $cachedhandlers) {
global $DB;
debugging('Events API using $handlers array has been deprecated in favour of Events 2 API, please use it instead.',
DEBUG_DEVELOPER);
$deletecount = 0;
foreach ($cachedhandlers as $eventname => $cachedhandler) {
if ($qhandlers = $DB->get_records('events_queue_handlers', array('handlerid'=>$cachedhandler['id']))) {
//debugging("Removing pending events from queue before deleting of event handler: $component - $eventname");
foreach ($qhandlers as $qhandler) {
events_dequeue($qhandler);
}
}
$DB->delete_records('events_handlers', array('eventname'=>$eventname, 'component'=>$component));
$deletecount++;
}
return $deletecount;
}
/**
* Removes this queued handler from the events_queued_handler table
*
* Removes events_queue record from events_queue if no more references to this event object exists
* @deprecated since Moodle 3.6. Please use the Events 2 API.
* @todo final deprecation. To be removed in Moodle 4.0
*
* @access protected To be used from eventslib only
*
* @param stdClass $qhandler A row from the events_queued_handler table
*/
function events_dequeue($qhandler) {
global $DB;
debugging('Events API using $handlers array has been deprecated in favour of Events 2 API, please use it instead.',
DEBUG_DEVELOPER);
// first delete the queue handler
$DB->delete_records('events_queue_handlers', array('id'=>$qhandler->id));
// if no more queued handler is pointing to the same event - delete the event too
if (!$DB->record_exists('events_queue_handlers', array('queuedeventid'=>$qhandler->queuedeventid))) {
$DB->delete_records('events_queue', array('id'=>$qhandler->queuedeventid));
}
}
/**
* Returns handlers for given event. Uses caching for better perf.
* @deprecated since Moodle 3.6. Please use the Events 2 API.
* @todo final deprecation. To be removed in Moodle 4.0
*
* @access protected To be used from eventslib only
*
* @staticvar array $handlers
* @param string $eventname name of event or 'reset'
* @return array|false array of handlers or false otherwise
*/
function events_get_handlers($eventname) {
global $DB;
static $handlers = array();
debugging('Events API using $handlers array has been deprecated in favour of Events 2 API, please use it instead.',
DEBUG_DEVELOPER);
if ($eventname === 'reset') {
$handlers = array();
return false;
}
if (!array_key_exists($eventname, $handlers)) {
$handlers[$eventname] = $DB->get_records('events_handlers', array('eventname'=>$eventname));
}
return $handlers[$eventname];
}

View File

@ -1,141 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Library of functions for events manipulation.
*
* The public API is all at the end of this file.
*
* @package core
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Gets the capabilities that have been cached in the database for this
* component.
*
* @access protected To be used from eventslib only
*
* @param string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'
* @return array of events
*/
function events_get_cached($component) {
global $DB;
$cachedhandlers = array();
if ($storedhandlers = $DB->get_records('events_handlers', array('component'=>$component))) {
foreach ($storedhandlers as $handler) {
$cachedhandlers[$handler->eventname] = array (
'id' => $handler->id,
'handlerfile' => $handler->handlerfile,
'handlerfunction' => $handler->handlerfunction,
'schedule' => $handler->schedule,
'internal' => $handler->internal);
}
}
return $cachedhandlers;
}
/**
* Remove all event handlers and queued events
*
* @category event
* @param string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'
*/
function events_uninstall($component) {
$cachedhandlers = events_get_cached($component);
events_cleanup($component, $cachedhandlers);
events_get_handlers('reset');
}
/**
* Deletes cached events that are no longer needed by the component.
*
* @access protected To be used from eventslib only
*
* @param string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'
* @param array $cachedhandlers array of the cached events definitions that will be
* @return int number of unused handlers that have been removed
*/
function events_cleanup($component, $cachedhandlers) {
global $DB;
$deletecount = 0;
foreach ($cachedhandlers as $eventname => $cachedhandler) {
if ($qhandlers = $DB->get_records('events_queue_handlers', array('handlerid'=>$cachedhandler['id']))) {
//debugging("Removing pending events from queue before deleting of event handler: $component - $eventname");
foreach ($qhandlers as $qhandler) {
events_dequeue($qhandler);
}
}
$DB->delete_records('events_handlers', array('eventname'=>$eventname, 'component'=>$component));
$deletecount++;
}
return $deletecount;
}
/**
* Removes this queued handler from the events_queued_handler table
*
* Removes events_queue record from events_queue if no more references to this event object exists
*
* @access protected To be used from eventslib only
*
* @param stdClass $qhandler A row from the events_queued_handler table
*/
function events_dequeue($qhandler) {
global $DB;
// first delete the queue handler
$DB->delete_records('events_queue_handlers', array('id'=>$qhandler->id));
// if no more queued handler is pointing to the same event - delete the event too
if (!$DB->record_exists('events_queue_handlers', array('queuedeventid'=>$qhandler->queuedeventid))) {
$DB->delete_records('events_queue', array('id'=>$qhandler->queuedeventid));
}
}
/**
* Returns handlers for given event. Uses caching for better perf.
*
* @access protected To be used from eventslib only
*
* @staticvar array $handlers
* @param string $eventname name of event or 'reset'
* @return array|false array of handlers or false otherwise
*/
function events_get_handlers($eventname) {
global $DB;
static $handlers = array();
if ($eventname === 'reset') {
$handlers = array();
return false;
}
if (!array_key_exists($eventname, $handlers)) {
$handlers[$eventname] = $DB->get_records('events_handlers', array('eventname'=>$eventname));
}
return $handlers[$eventname];
}

View File

@ -210,7 +210,6 @@ class phpunit_util extends testing_util {
accesslib_clear_all_caches(true); accesslib_clear_all_caches(true);
get_string_manager()->reset_caches(true); get_string_manager()->reset_caches(true);
reset_text_filters_cache(true); reset_text_filters_cache(true);
events_get_handlers('reset');
core_text::reset_caches(); core_text::reset_caches();
get_message_processors(false, true, true); get_message_processors(false, true, true);
filter_manager::reset_caches(); filter_manager::reset_caches();

View File

@ -606,7 +606,6 @@ require_once($CFG->libdir .'/moodlelib.php'); // Other general-purpose fun
require_once($CFG->libdir .'/enrollib.php'); // Enrolment related functions require_once($CFG->libdir .'/enrollib.php'); // Enrolment related functions
require_once($CFG->libdir .'/pagelib.php'); // Library that defines the moodle_page class, used for $PAGE require_once($CFG->libdir .'/pagelib.php'); // Library that defines the moodle_page class, used for $PAGE
require_once($CFG->libdir .'/blocklib.php'); // Library for controlling blocks require_once($CFG->libdir .'/blocklib.php'); // Library for controlling blocks
require_once($CFG->libdir .'/eventslib.php'); // Events functions
require_once($CFG->libdir .'/grouplib.php'); // Groups functions require_once($CFG->libdir .'/grouplib.php'); // Groups functions
require_once($CFG->libdir .'/sessionlib.php'); // All session and cookie related stuff require_once($CFG->libdir .'/sessionlib.php'); // All session and cookie related stuff
require_once($CFG->libdir .'/editorlib.php'); // All text editor related functions and classes require_once($CFG->libdir .'/editorlib.php'); // All text editor related functions and classes

View File

@ -53,7 +53,7 @@ class core_eventslib_testcase extends advanced_testcase {
global $DB; global $DB;
events_update_definition('unittest'); events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER); $this->assertDebuggingCalledCount(4);
$dbcount = $DB->count_records('events_handlers', array('component'=>'unittest')); $dbcount = $DB->count_records('events_handlers', array('component'=>'unittest'));
$handlers = array(); $handlers = array();
@ -68,9 +68,10 @@ class core_eventslib_testcase extends advanced_testcase {
global $DB; global $DB;
events_update_definition('unittest'); events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER); $this->assertDebuggingCalledCount(4);
events_uninstall('unittest'); events_uninstall('unittest');
$this->assertDebuggingCalledCount(4);
$this->assertEquals(0, $DB->count_records('events_handlers', array('component'=>'unittest')), 'All handlers should be uninstalled: %s'); $this->assertEquals(0, $DB->count_records('events_handlers', array('component'=>'unittest')), 'All handlers should be uninstalled: %s');
} }
@ -81,7 +82,7 @@ class core_eventslib_testcase extends advanced_testcase {
global $DB; global $DB;
events_update_definition('unittest'); events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER); $this->assertDebuggingCalledCount(4);
// First modify directly existing handler. // First modify directly existing handler.
$handler = $DB->get_record('events_handlers', array('component'=>'unittest', 'eventname'=>'test_instant')); $handler = $DB->get_record('events_handlers', array('component'=>'unittest', 'eventname'=>'test_instant'));
@ -93,7 +94,7 @@ class core_eventslib_testcase extends advanced_testcase {
// Update the definition, it should revert the handler back. // Update the definition, it should revert the handler back.
events_update_definition('unittest'); events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER); $this->assertDebuggingCalledCount(4);
$handler = $DB->get_record('events_handlers', array('component'=>'unittest', 'eventname'=>'test_instant')); $handler = $DB->get_record('events_handlers', array('component'=>'unittest', 'eventname'=>'test_instant'));
$this->assertSame($handler->handlerfunction, $original, 'update should sync db with file definition: %s'); $this->assertSame($handler->handlerfunction, $original, 'update should sync db with file definition: %s');
} }

View File

@ -23,6 +23,12 @@ information provided here is intended especially for developers.
- I set the field "<field_string>" to multiline - I set the field "<field_string>" to multiline
- I follow "<link_string>"" in the open menu - I follow "<link_string>"" in the open menu
* Removed the lib/password_compat/lib/password.php file. * Removed the lib/password_compat/lib/password.php file.
* The eventslib.php file has been deleted and its functions have been moved to deprecatedlib.php. The affected functions are:
- events_get_cached()
- events_uninstall()
- events_cleanup()
- events_dequeue()
- events_get_handlers()
=== 3.5 === === 3.5 ===

View File

@ -573,7 +573,6 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
update_capabilities($component); update_capabilities($component);
log_update_descriptions($component); log_update_descriptions($component);
external_update_descriptions($component); external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component); \core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component); message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component); \core\message\inbound\manager::update_handlers_for_component($component);
@ -612,7 +611,6 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
update_capabilities($component); update_capabilities($component);
log_update_descriptions($component); log_update_descriptions($component);
external_update_descriptions($component); external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component); \core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component); message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component); \core\message\inbound\manager::update_handlers_for_component($component);
@ -646,7 +644,6 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
update_capabilities($component); update_capabilities($component);
log_update_descriptions($component); log_update_descriptions($component);
external_update_descriptions($component); external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component); \core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component); message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component); \core\message\inbound\manager::update_handlers_for_component($component);
@ -754,7 +751,6 @@ function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
update_capabilities($component); update_capabilities($component);
log_update_descriptions($component); log_update_descriptions($component);
external_update_descriptions($component); external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component); \core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component); message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component); \core\message\inbound\manager::update_handlers_for_component($component);
@ -789,7 +785,6 @@ function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
update_capabilities($component); update_capabilities($component);
log_update_descriptions($component); log_update_descriptions($component);
external_update_descriptions($component); external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component); \core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component); message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component); \core\message\inbound\manager::update_handlers_for_component($component);
@ -826,7 +821,6 @@ function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
update_capabilities($component); update_capabilities($component);
log_update_descriptions($component); log_update_descriptions($component);
external_update_descriptions($component); external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component); \core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component); message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component); \core\message\inbound\manager::update_handlers_for_component($component);
@ -948,7 +942,6 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
update_capabilities($component); update_capabilities($component);
log_update_descriptions($component); log_update_descriptions($component);
external_update_descriptions($component); external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component); \core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component); message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component); \core\message\inbound\manager::update_handlers_for_component($component);
@ -989,7 +982,6 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
update_capabilities($component); update_capabilities($component);
log_update_descriptions($component); log_update_descriptions($component);
external_update_descriptions($component); external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component); \core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component); message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component); \core\message\inbound\manager::update_handlers_for_component($component);
@ -1025,7 +1017,6 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
update_capabilities($component); update_capabilities($component);
log_update_descriptions($component); log_update_descriptions($component);
external_update_descriptions($component); external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component); \core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component); message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component); \core\message\inbound\manager::update_handlers_for_component($component);
@ -1742,7 +1733,6 @@ function install_core($version, $verbose) {
// Continue with the installation // Continue with the installation
log_update_descriptions('moodle'); log_update_descriptions('moodle');
external_update_descriptions('moodle'); external_update_descriptions('moodle');
events_update_definition('moodle');
\core\task\manager::reset_scheduled_tasks_for_component('moodle'); \core\task\manager::reset_scheduled_tasks_for_component('moodle');
message_update_providers('moodle'); message_update_providers('moodle');
\core\message\inbound\manager::update_handlers_for_component('moodle'); \core\message\inbound\manager::update_handlers_for_component('moodle');
@ -1810,7 +1800,6 @@ function upgrade_core($version, $verbose) {
update_capabilities('moodle'); update_capabilities('moodle');
log_update_descriptions('moodle'); log_update_descriptions('moodle');
external_update_descriptions('moodle'); external_update_descriptions('moodle');
events_update_definition('moodle');
\core\task\manager::reset_scheduled_tasks_for_component('moodle'); \core\task\manager::reset_scheduled_tasks_for_component('moodle');
message_update_providers('moodle'); message_update_providers('moodle');
\core\message\inbound\manager::update_handlers_for_component('moodle'); \core\message\inbound\manager::update_handlers_for_component('moodle');

View File

@ -22,8 +22,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
require_once($CFG->libdir.'/eventslib.php');
define('MESSAGE_SHORTLENGTH', 300); define('MESSAGE_SHORTLENGTH', 300);
define('MESSAGE_HISTORY_ALL', 1); define('MESSAGE_HISTORY_ALL', 1);

View File

@ -87,7 +87,6 @@ require_once($CFG->dirroot . '/mod/assign/feedbackplugin.php');
require_once($CFG->dirroot . '/mod/assign/submissionplugin.php'); require_once($CFG->dirroot . '/mod/assign/submissionplugin.php');
require_once($CFG->dirroot . '/mod/assign/renderable.php'); require_once($CFG->dirroot . '/mod/assign/renderable.php');
require_once($CFG->dirroot . '/mod/assign/gradingtable.php'); require_once($CFG->dirroot . '/mod/assign/gradingtable.php');
require_once($CFG->libdir . '/eventslib.php');
require_once($CFG->libdir . '/portfolio/caller.php'); require_once($CFG->libdir . '/portfolio/caller.php');
use \mod_assign\output\grading_app; use \mod_assign\output\grading_app;

View File

@ -24,8 +24,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
require_once($CFG->libdir.'/eventslib.php');
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
// File areas for file submission assignment. // File areas for file submission assignment.

View File

@ -25,8 +25,6 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
/** Include eventslib.php */
require_once($CFG->libdir.'/eventslib.php');
// Include forms lib. // Include forms lib.
require_once($CFG->libdir.'/formslib.php'); require_once($CFG->libdir.'/formslib.php');

View File

@ -25,7 +25,6 @@ defined('MOODLE_INTERNAL') || die();
/** Include required files */ /** Include required files */
require_once(__DIR__ . '/deprecatedlib.php'); require_once(__DIR__ . '/deprecatedlib.php');
require_once($CFG->libdir.'/filelib.php'); require_once($CFG->libdir.'/filelib.php');
require_once($CFG->libdir.'/eventslib.php');
/// CONSTANTS /////////////////////////////////////////////////////////// /// CONSTANTS ///////////////////////////////////////////////////////////

View File

@ -27,7 +27,6 @@ require_once('../../config.php');
require_once($CFG->dirroot.'/mod/lesson/locallib.php'); require_once($CFG->dirroot.'/mod/lesson/locallib.php');
require_once($CFG->dirroot.'/mod/lesson/pagetypes/essay.php'); require_once($CFG->dirroot.'/mod/lesson/pagetypes/essay.php');
require_once($CFG->dirroot.'/mod/lesson/essay_form.php'); require_once($CFG->dirroot.'/mod/lesson/essay_form.php');
require_once($CFG->libdir.'/eventslib.php');
$id = required_param('id', PARAM_INT); // Course Module ID $id = required_param('id', PARAM_INT); // Course Module ID
$mode = optional_param('mode', 'display', PARAM_ALPHA); $mode = optional_param('mode', 'display', PARAM_ALPHA);

View File

@ -28,7 +28,6 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/eventslib.php');
require_once($CFG->dirroot . '/calendar/lib.php'); require_once($CFG->dirroot . '/calendar/lib.php');

View File

@ -37,7 +37,6 @@ require_once($CFG->dirroot . '/mod/quiz/accessmanager_form.php');
require_once($CFG->dirroot . '/mod/quiz/renderer.php'); require_once($CFG->dirroot . '/mod/quiz/renderer.php');
require_once($CFG->dirroot . '/mod/quiz/attemptlib.php'); require_once($CFG->dirroot . '/mod/quiz/attemptlib.php');
require_once($CFG->libdir . '/completionlib.php'); require_once($CFG->libdir . '/completionlib.php');
require_once($CFG->libdir . '/eventslib.php');
require_once($CFG->libdir . '/filelib.php'); require_once($CFG->libdir . '/filelib.php');
require_once($CFG->libdir . '/questionlib.php'); require_once($CFG->libdir . '/questionlib.php');