Merge branch 'MDL-55188-master' of git://github.com/abgreeve/moodle

This commit is contained in:
David Monllao
2018-07-30 17:33:21 +02:00
22 changed files with 178 additions and 996 deletions
-1
View File
@@ -35,7 +35,6 @@ define('NO_DEBUG_DISPLAY', true);
// @codingStandardsIgnoreLine This script does not require login.
require("../../config.php");
require_once("lib.php");
require_once($CFG->libdir.'/eventslib.php');
require_once($CFG->libdir.'/enrollib.php');
require_once($CFG->libdir . '/filelib.php');
-1
View File
@@ -1,7 +1,6 @@
<?php
require('../config.php');
require_once($CFG->libdir.'/eventslib.php');
// Form submitted, do not check referer (original page unknown).
if ($form = data_submitted()) {
-3
View File
@@ -234,9 +234,6 @@ function uninstall_plugin($type, $name) {
// delete the capabilities that were defined by this module
capabilities_cleanup($component);
// remove event handlers and dequeue pending events
events_uninstall($component);
// Delete all remaining files in the filepool owned by the component.
$fs = get_file_storage();
$fs->delete_component_files($component);
-4
View File
@@ -834,10 +834,6 @@ abstract class base implements \IteratorAggregate {
\core\event\manager::dispatch($this);
$this->dispatched = true;
if ($legacyeventname = static::get_legacy_eventname()) {
events_trigger_legacy($legacyeventname, $this->get_legacy_eventdata());
}
}
/**
-48
View File
@@ -1,48 +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/>.
/**
* A scheduled task.
*
* @package core
* @copyright 2013 onwards Martin Dougiamas http://dougiamas.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core\task;
/**
* Simple task to run the events cron.
*/
class events_cron_task extends scheduled_task {
/**
* Get a descriptive name for this task (shown to admins).
*
* @return string
*/
public function get_name() {
return get_string('taskeventscron', 'admin');
}
/**
* Do the job.
* Throw exceptions on errors (the job will be retried).
*/
public function execute() {
events_cron();
}
}
-9
View File
@@ -149,15 +149,6 @@ $tasks = array(
'dayofweek' => '*',
'month' => '*'
),
array(
'classname' => 'core\task\events_cron_task',
'blocking' => 0,
'minute' => '*',
'hour' => '*',
'day' => '*',
'dayofweek' => '*',
'month' => '*'
),
array(
'classname' => 'core\task\completion_regular_task',
'blocking' => 0,
+157 -457
View File
@@ -58,17 +58,10 @@ function add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user
}
/**
* Function to call all event handlers when triggering an event
*
* @deprecated since 2.6
*
* @param string $eventname name of the event
* @param mixed $eventdata event data object
* @return int number of failed events
*/
function events_trigger($eventname, $eventdata) {
debugging('events_trigger() is deprecated, please use new events instead', DEBUG_DEVELOPER);
return events_trigger_legacy($eventname, $eventdata);
function events_trigger() {
throw new coding_exception('events_trigger() has been deprecated along with all Events 1 API in favour of Events 2 API.');
}
/**
@@ -3484,497 +3477,71 @@ function tag_cloud_sort($a, $b) {
}
/**
* Loads the events definitions for the component (from file). If no
* events are defined for the component, we simply return an empty array.
*
* @access protected To be used from eventslib only
* @deprecated since Moodle 3.1
* @param string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'
* @return array Array of capabilities or empty array if not exists
*/
function events_load_def($component) {
global $CFG;
if ($component === 'unittest') {
$defpath = $CFG->dirroot.'/lib/tests/fixtures/events.php';
} else {
$defpath = core_component::get_component_directory($component).'/db/events.php';
}
function events_load_def() {
throw new coding_exception('events_load_def() has been deprecated along with all Events 1 API in favour of Events 2 API.');
$handlers = array();
if (file_exists($defpath)) {
require($defpath);
}
// make sure the definitions are valid and complete; tell devs what is wrong
foreach ($handlers as $eventname => $handler) {
if ($eventname === 'reset') {
debugging("'reset' can not be used as event name.");
unset($handlers['reset']);
continue;
}
if (!is_array($handler)) {
debugging("Handler of '$eventname' must be specified as array'");
unset($handlers[$eventname]);
continue;
}
if (!isset($handler['handlerfile'])) {
debugging("Handler of '$eventname' must include 'handlerfile' key'");
unset($handlers[$eventname]);
continue;
}
if (!isset($handler['handlerfunction'])) {
debugging("Handler of '$eventname' must include 'handlerfunction' key'");
unset($handlers[$eventname]);
continue;
}
if (!isset($handler['schedule'])) {
$handler['schedule'] = 'instant';
}
if ($handler['schedule'] !== 'instant' and $handler['schedule'] !== 'cron') {
debugging("Handler of '$eventname' must include valid 'schedule' type (instant or cron)'");
unset($handlers[$eventname]);
continue;
}
if (!isset($handler['internal'])) {
$handler['internal'] = 1;
}
$handlers[$eventname] = $handler;
}
return $handlers;
}
/**
* Puts a handler on queue
*
* @access protected To be used from eventslib only
* @deprecated since Moodle 3.1
* @param stdClass $handler event handler object from db
* @param stdClass $event event data object
* @param string $errormessage The error message indicating the problem
* @return int id number of new queue handler
*/
function events_queue_handler($handler, $event, $errormessage) {
global $DB;
if ($qhandler = $DB->get_record('events_queue_handlers', array('queuedeventid'=>$event->id, 'handlerid'=>$handler->id))) {
debugging("Please check code: Event id $event->id is already queued in handler id $qhandler->id");
return $qhandler->id;
}
// make a new queue handler
$qhandler = new stdClass();
$qhandler->queuedeventid = $event->id;
$qhandler->handlerid = $handler->id;
$qhandler->errormessage = $errormessage;
$qhandler->timemodified = time();
if ($handler->schedule === 'instant' and $handler->status == 1) {
$qhandler->status = 1; //already one failed attempt to dispatch this event
} else {
$qhandler->status = 0;
}
return $DB->insert_record('events_queue_handlers', $qhandler);
function events_queue_handler() {
throw new coding_exception('events_queue_handler() has been deprecated along with all Events 1 API in favour of Events 2 API.');
}
/**
* trigger a single event with a specified handler
*
* @access protected To be used from eventslib only
* @deprecated since Moodle 3.1
* @param stdClass $handler This shoudl be a row from the events_handlers table.
* @param stdClass $eventdata An object containing information about the event
* @param string $errormessage error message indicating problem
* @return bool|null True means event processed, false means retry event later; may throw exception, NULL means internal error
*/
function events_dispatch($handler, $eventdata, &$errormessage) {
global $CFG;
debugging('Events API using $handlers array has been deprecated in favour of Events 2 API, please use it instead.', DEBUG_DEVELOPER);
$function = unserialize($handler->handlerfunction);
if (is_callable($function)) {
// oki, no need for includes
} else if (file_exists($CFG->dirroot.$handler->handlerfile)) {
include_once($CFG->dirroot.$handler->handlerfile);
} else {
$errormessage = "Handler file of component $handler->component: $handler->handlerfile can not be found!";
return null;
}
// checks for handler validity
if (is_callable($function)) {
$result = call_user_func($function, $eventdata);
if ($result === false) {
$errormessage = "Handler function of component $handler->component: $handler->handlerfunction requested resending of event!";
return false;
}
return true;
} else {
$errormessage = "Handler function of component $handler->component: $handler->handlerfunction not callable function or class method!";
return null;
}
function events_dispatch() {
throw new coding_exception('events_dispatch() has been deprecated along with all Events 1 API in favour of Events 2 API.');
}
/**
* given a queued handler, call the respective event handler to process the event
*
* @access protected To be used from eventslib only
* @deprecated since Moodle 3.1
* @param stdClass $qhandler events_queued_handler row from db
* @return boolean true means event processed, false means retry later, NULL means fatal failure
*/
function events_process_queued_handler($qhandler) {
global $DB;
// get handler
if (!$handler = $DB->get_record('events_handlers', array('id'=>$qhandler->handlerid))) {
debugging("Error processing queue handler $qhandler->id, missing handler id: $qhandler->handlerid");
//irrecoverable error, remove broken queue handler
events_dequeue($qhandler);
return NULL;
}
// get event object
if (!$event = $DB->get_record('events_queue', array('id'=>$qhandler->queuedeventid))) {
// can't proceed with no event object - might happen when two crons running at the same time
debugging("Error processing queue handler $qhandler->id, missing event id: $qhandler->queuedeventid");
//irrecoverable error, remove broken queue handler
events_dequeue($qhandler);
return NULL;
}
// call the function specified by the handler
try {
$errormessage = 'Unknown error';
if (events_dispatch($handler, unserialize(base64_decode($event->eventdata)), $errormessage)) {
//everything ok
events_dequeue($qhandler);
return true;
}
} catch (Exception $e) {
// the problem here is that we do not want one broken handler to stop all others,
// cron handlers are very tricky because the needed data might have been deleted before the cron execution
$errormessage = "Handler function of component $handler->component: $handler->handlerfunction threw exception :" .
$e->getMessage() . "\n" . format_backtrace($e->getTrace(), true);
if (!empty($e->debuginfo)) {
$errormessage .= $e->debuginfo;
}
}
//dispatching failed
$qh = new stdClass();
$qh->id = $qhandler->id;
$qh->errormessage = $errormessage;
$qh->timemodified = time();
$qh->status = $qhandler->status + 1;
$DB->update_record('events_queue_handlers', $qh);
debugging($errormessage);
return false;
function events_process_queued_handler() {
throw new coding_exception(
'events_process_queued_handler() has been deprecated along with all Events 1 API in favour of Events 2 API.'
);
}
/**
* Updates all of the event definitions within the database.
*
* Unfortunately this isn't as simple as removing them all and then readding
* the updated event definitions. Chances are queued items are referencing the
* existing definitions.
*
* Note that the absence of the db/events.php event definition file
* will cause any queued events for the component to be removed from
* the database.
*
* @category event
* @deprecated since Moodle 3.1
* @param string $component examples: 'moodle', 'mod_forum', 'block_quiz_results'
* @return boolean always returns true
*/
function events_update_definition($component='moodle') {
global $DB;
// load event definition from events.php
$filehandlers = events_load_def($component);
if ($filehandlers) {
debugging('Events API using $handlers array has been deprecated in favour of Events 2 API, please use it instead.', DEBUG_DEVELOPER);
}
// load event definitions from db tables
// if we detect an event being already stored, we discard from this array later
// the remaining needs to be removed
$cachedhandlers = events_get_cached($component);
foreach ($filehandlers as $eventname => $filehandler) {
if (!empty($cachedhandlers[$eventname])) {
if ($cachedhandlers[$eventname]['handlerfile'] === $filehandler['handlerfile'] &&
$cachedhandlers[$eventname]['handlerfunction'] === serialize($filehandler['handlerfunction']) &&
$cachedhandlers[$eventname]['schedule'] === $filehandler['schedule'] &&
$cachedhandlers[$eventname]['internal'] == $filehandler['internal']) {
// exact same event handler already present in db, ignore this entry
unset($cachedhandlers[$eventname]);
continue;
} else {
// same event name matches, this event has been updated, update the datebase
$handler = new stdClass();
$handler->id = $cachedhandlers[$eventname]['id'];
$handler->handlerfile = $filehandler['handlerfile'];
$handler->handlerfunction = serialize($filehandler['handlerfunction']); // static class methods stored as array
$handler->schedule = $filehandler['schedule'];
$handler->internal = $filehandler['internal'];
$DB->update_record('events_handlers', $handler);
unset($cachedhandlers[$eventname]);
continue;
}
} else {
// if we are here, this event handler is not present in db (new)
// add it
$handler = new stdClass();
$handler->eventname = $eventname;
$handler->component = $component;
$handler->handlerfile = $filehandler['handlerfile'];
$handler->handlerfunction = serialize($filehandler['handlerfunction']); // static class methods stored as array
$handler->schedule = $filehandler['schedule'];
$handler->status = 0;
$handler->internal = $filehandler['internal'];
$DB->insert_record('events_handlers', $handler);
}
}
// clean up the left overs, the entries in cached events array at this points are deprecated event handlers
// and should be removed, delete from db
events_cleanup($component, $cachedhandlers);
events_get_handlers('reset');
return true;
function events_update_definition() {
throw new coding_exception(
'events_update_definition has been deprecated along with all Events 1 API in favour of Events 2 API.'
);
}
/**
* Events cron will try to empty the events queue by processing all the queued events handlers
*
* @access public Part of the public API
* @deprecated since Moodle 3.1
* @category event
* @param string $eventname empty means all
* @return int number of dispatched events
*/
function events_cron($eventname='') {
global $DB;
$failed = array();
$processed = 0;
if ($eventname) {
$sql = "SELECT qh.*
FROM {events_queue_handlers} qh, {events_handlers} h
WHERE qh.handlerid = h.id AND h.eventname=?
ORDER BY qh.id";
$params = array($eventname);
} else {
$sql = "SELECT *
FROM {events_queue_handlers}
ORDER BY id";
$params = array();
}
$rs = $DB->get_recordset_sql($sql, $params);
if ($rs->valid()) {
debugging('Events API using $handlers array has been deprecated in favour of Events 2 API, please use it instead.', DEBUG_DEVELOPER);
}
foreach ($rs as $qhandler) {
if (isset($failed[$qhandler->handlerid])) {
// do not try to dispatch any later events when one already asked for retry or ended with exception
continue;
}
$status = events_process_queued_handler($qhandler);
if ($status === false) {
// handler is asking for retry, do not send other events to this handler now
$failed[$qhandler->handlerid] = $qhandler->handlerid;
} else if ($status === NULL) {
// means completely broken handler, event data was purged
$failed[$qhandler->handlerid] = $qhandler->handlerid;
} else {
$processed++;
}
}
$rs->close();
// remove events that do not have any handlers waiting
$sql = "SELECT eq.id
FROM {events_queue} eq
LEFT JOIN {events_queue_handlers} qh ON qh.queuedeventid = eq.id
WHERE qh.id IS NULL";
$rs = $DB->get_recordset_sql($sql);
foreach ($rs as $event) {
//debugging('Purging stale event '.$event->id);
$DB->delete_records('events_queue', array('id'=>$event->id));
}
$rs->close();
return $processed;
function events_cron() {
throw new coding_exception('events_cron() has been deprecated along with all Events 1 API in favour of Events 2 API.');
}
/**
* Do not call directly, this is intended to be used from new event base only.
*
* @private
* @deprecated since Moodle 3.1
* @param string $eventname name of the event
* @param mixed $eventdata event data object
* @return int number of failed events
*/
function events_trigger_legacy($eventname, $eventdata) {
global $CFG, $USER, $DB;
$failedcount = 0; // number of failed events.
// pull out all registered event handlers
if ($handlers = events_get_handlers($eventname)) {
foreach ($handlers as $handler) {
$errormessage = '';
if ($handler->schedule === 'instant') {
if ($handler->status) {
//check if previous pending events processed
if (!$DB->record_exists('events_queue_handlers', array('handlerid'=>$handler->id))) {
// ok, queue is empty, lets reset the status back to 0 == ok
$handler->status = 0;
$DB->set_field('events_handlers', 'status', 0, array('id'=>$handler->id));
// reset static handler cache
events_get_handlers('reset');
}
}
// dispatch the event only if instant schedule and status ok
if ($handler->status or (!$handler->internal and $DB->is_transaction_started())) {
// increment the error status counter
$handler->status++;
$DB->set_field('events_handlers', 'status', $handler->status, array('id'=>$handler->id));
// reset static handler cache
events_get_handlers('reset');
} else {
$errormessage = 'Unknown error';
$result = events_dispatch($handler, $eventdata, $errormessage);
if ($result === true) {
// everything is fine - event dispatched
continue;
} else if ($result === false) {
// retry later - set error count to 1 == send next instant into cron queue
$DB->set_field('events_handlers', 'status', 1, array('id'=>$handler->id));
// reset static handler cache
events_get_handlers('reset');
} else {
// internal problem - ignore the event completely
$failedcount ++;
continue;
}
}
// update the failed counter
$failedcount ++;
} else if ($handler->schedule === 'cron') {
//ok - use queueing of events only
} else {
// unknown schedule - ignore event completely
debugging("Unknown handler schedule type: $handler->schedule");
$failedcount ++;
continue;
}
// if even type is not instant, or dispatch asked for retry, queue it
$event = new stdClass();
$event->userid = $USER->id;
$event->eventdata = base64_encode(serialize($eventdata));
$event->timecreated = time();
if (debugging()) {
$dump = '';
$callers = debug_backtrace();
foreach ($callers as $caller) {
if (!isset($caller['line'])) {
$caller['line'] = '?';
}
if (!isset($caller['file'])) {
$caller['file'] = '?';
}
$dump .= 'line ' . $caller['line'] . ' of ' . substr($caller['file'], strlen($CFG->dirroot) + 1);
if (isset($caller['function'])) {
$dump .= ': call to ';
if (isset($caller['class'])) {
$dump .= $caller['class'] . $caller['type'];
}
$dump .= $caller['function'] . '()';
}
$dump .= "\n";
}
$event->stackdump = $dump;
} else {
$event->stackdump = '';
}
$event->id = $DB->insert_record('events_queue', $event);
events_queue_handler($handler, $event, $errormessage);
}
} else {
// No handler found for this event name - this is ok!
}
return $failedcount;
function events_trigger_legacy() {
throw new coding_exception('events_trigger_legacy() has been deprecated along with all Events 1 API in favour of Events 2 API.');
}
/**
* checks if an event is registered for this component
*
* @access public Part of the public API
* @deprecated since Moodle 3.1
* @param string $eventname name of the event
* @param string $component component name, can be mod/data or moodle
* @return bool
*/
function events_is_registered($eventname, $component) {
global $DB;
debugging('events_is_registered() has been deprecated along with all Events 1 API in favour of Events 2 API,' .
' please use it instead.', DEBUG_DEVELOPER);
return $DB->record_exists('events_handlers', array('component'=>$component, 'eventname'=>$eventname));
function events_is_registered() {
throw new coding_exception('events_is_registered() has been deprecated along with all Events 1 API in favour of Events 2 API.');
}
/**
* checks if an event is queued for processing - either cron handlers attached or failed instant handlers
*
* @access public Part of the public API
* @deprecated since Moodle 3.1
* @param string $eventname name of the event
* @return int number of queued events
*/
function events_pending_count($eventname) {
global $DB;
debugging('events_pending_count() has been deprecated along with all Events 1 API in favour of Events 2 API,' .
' please use it instead.', DEBUG_DEVELOPER);
$sql = "SELECT COUNT('x')
FROM {events_queue_handlers} qh
JOIN {events_handlers} h ON h.id = qh.handlerid
WHERE h.eventname = ?";
return $DB->count_records_sql($sql, array($eventname));
function events_pending_count() {
throw new coding_exception('events_pending_count() has been deprecated along with all Events 1 API in favour of Events 2 API.');
}
/**
@@ -6613,3 +6180,136 @@ function groups_get_all_groups_for_courses($courses) {
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];
}
-141
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];
}
-1
View File
@@ -210,7 +210,6 @@ class phpunit_util extends testing_util {
accesslib_clear_all_caches(true);
get_string_manager()->reset_caches(true);
reset_text_filters_cache(true);
events_get_handlers('reset');
core_text::reset_caches();
get_message_processors(false, true, true);
filter_manager::reset_caches();
-1
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 .'/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 .'/eventslib.php'); // Events 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 .'/editorlib.php'); // All text editor related functions and classes
+4 -5
View File
@@ -592,10 +592,12 @@ class core_event_testcase extends advanced_testcase {
);
$DB->delete_records('log', array());
$this->expectException('coding_exception');
events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$DB->delete_records_select('events_handlers', "component <> 'unittest'");
events_get_handlers('reset');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$this->assertEquals(3, $DB->count_records('events_handlers'));
set_config('loglifetime', 60*60*24*5);
@@ -604,20 +606,17 @@ class core_event_testcase extends advanced_testcase {
$event1 = \core_tests\event\unittest_executed::create(array('context'=>\context_system::instance(), 'other'=>array('sample'=>5, 'xx'=>10)));
$event1->trigger();
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$event2 = \core_tests\event\unittest_executed::create(array('context'=>\context_system::instance(), 'other'=>array('sample'=>6, 'xx'=>11)));
$event2->nest = true;
$event2->trigger();
$this->assertDebuggingCalledCount(2, array(self::DEBUGGING_MSG, self::DEBUGGING_MSG), array(DEBUG_DEVELOPER, DEBUG_DEVELOPER));
$this->assertSame(
array('observe_all-5', 'observe_one-5', 'legacy_handler-0', 'observe_all-nesting-6', 'legacy_handler-0', 'observe_one-6', 'observe_all-666', 'observe_one-666', 'legacy_handler-0'),
array('observe_all-5', 'observe_one-5', 'observe_all-nesting-6', 'observe_one-6', 'observe_all-666', 'observe_one-666'),
\core_tests\event\unittest_observer::$info);
$this->assertSame($event1, \core_tests\event\unittest_observer::$event[0]);
$this->assertSame($event1, \core_tests\event\unittest_observer::$event[1]);
$this->assertSame(array(0, 5), \core_tests\event\unittest_observer::$event[2]);
$logs = $DB->get_records('log', array(), 'id ASC');
$this->assertCount(0, $logs);
-303
View File
@@ -1,303 +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/>.
/**
* Tests events subsystem.
*
* @package core_event
* @subpackage phpunit
* @copyright 2007 onwards Martin Dougiamas (http://dougiamas.com)
* @author Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
class core_eventslib_testcase extends advanced_testcase {
const DEBUGGING_MSG = 'Events API using $handlers array has been deprecated in favour of Events 2 API, please use it instead.';
/**
* Create temporary entries in the database for these tests.
* These tests have to work no matter the data currently in the database
* (meaning they should run on a brand new site). This means several items of
* data have to be artificially inseminated (:-) in the DB.
*/
protected function setUp() {
parent::setUp();
// Set global category settings to -1 (not force).
eventslib_sample_function_handler('reset');
eventslib_sample_handler_class::static_method('reset');
$this->resetAfterTest();
}
/**
* Tests the installation of event handlers from file
*/
public function test_events_update_definition__install() {
global $DB;
events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$dbcount = $DB->count_records('events_handlers', array('component'=>'unittest'));
$handlers = array();
require(__DIR__.'/fixtures/events.php');
$this->assertCount($dbcount, $handlers, 'Equal number of handlers in file and db: %s');
}
/**
* Tests the uninstallation of event handlers from file.
*/
public function test_events_update_definition__uninstall() {
global $DB;
events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
events_uninstall('unittest');
$this->assertEquals(0, $DB->count_records('events_handlers', array('component'=>'unittest')), 'All handlers should be uninstalled: %s');
}
/**
* Tests the update of event handlers from file.
*/
public function test_events_update_definition__update() {
global $DB;
events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
// First modify directly existing handler.
$handler = $DB->get_record('events_handlers', array('component'=>'unittest', 'eventname'=>'test_instant'));
$original = $handler->handlerfunction;
// Change handler in db.
$DB->set_field('events_handlers', 'handlerfunction', serialize('some_other_function_handler'), array('id'=>$handler->id));
// Update the definition, it should revert the handler back.
events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$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');
}
/**
* Tests events_trigger_is_registered() function.
*/
public function test_events_is_registered() {
events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$this->assertTrue(events_is_registered('test_instant', 'unittest'));
$this->assertDebuggingCalled('events_is_registered() has been deprecated along with all Events 1 API in favour of Events 2' .
' API, please use it instead.', DEBUG_DEVELOPER);
}
/**
* Tests events_trigger_legacy() function.
*/
public function test_events_trigger_legacy_instant() {
events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$this->assertEquals(0, events_trigger_legacy('test_instant', 'ok'));
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$this->assertEquals(0, events_trigger_legacy('test_instant', 'ok'));
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$this->assertEquals(2, eventslib_sample_function_handler('status'));
}
/**
* Tests events_trigger_legacy() function.
*/
public function test_events_trigger__cron() {
events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$this->assertEquals(0, events_trigger_legacy('test_cron', 'ok'));
$this->assertEquals(0, eventslib_sample_handler_class::static_method('status'));
events_cron('test_cron');
// The events_cron one + one for each triggered event above (triggered in events_dispatch).
$this->assertDebuggingCalledCount(2, array(self::DEBUGGING_MSG, self::DEBUGGING_MSG),
array(DEBUG_DEVELOPER, DEBUG_DEVELOPER));
$this->assertEquals(1, eventslib_sample_handler_class::static_method('status'));
}
/**
* Tests events_pending_count() function.
*/
public function test_events_pending_count() {
events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
events_trigger_legacy('test_cron', 'ok');
$this->assertDebuggingNotCalled();
events_trigger_legacy('test_cron', 'ok');
$this->assertDebuggingNotCalled();
events_cron('test_cron');
// The events_cron one + one for each triggered event above (triggered in events_dispatch).
$this->assertDebuggingCalledCount(3);
$this->assertEquals(0, events_pending_count('test_cron'), 'all messages should be already dequeued: %s');
$this->assertDebuggingCalled('events_pending_count() has been deprecated along with all Events 1 API in favour of Events 2' .
' API, please use it instead.', DEBUG_DEVELOPER);
}
/**
* Tests events_trigger_legacy() function when instant handler fails.
*/
public function test_events_trigger__failed_instant() {
global $CFG;
events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$olddebug = $CFG->debug;
$this->assertEquals(1, events_trigger_legacy('test_instant', 'fail'), 'fail first event: %s');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$this->assertEquals(1, events_trigger_legacy('test_instant', 'ok'), 'this one should fail too: %s');
$this->assertDebuggingNotCalled();
$this->assertEquals(0, events_cron('test_instant'), 'all events should stay in queue: %s');
// events_cron + one for each dispatched event.
$this->assertDebuggingCalledCount(3);
$this->assertEquals(2, events_pending_count('test_instant'), 'two events should in queue: %s');
$this->assertDebuggingCalled('events_pending_count() has been deprecated along with all Events 1 API in favour of Events 2' .
' API, please use it instead.', DEBUG_DEVELOPER);
$this->assertEquals(0, eventslib_sample_function_handler('status'), 'verify no event dispatched yet: %s');
eventslib_sample_function_handler('ignorefail'); // Ignore "fail" eventdata from now on.
$this->assertEquals(1, events_trigger_legacy('test_instant', 'ok'), 'this one should go to queue directly: %s');
$this->assertDebuggingNotCalled();
$this->assertEquals(3, events_pending_count('test_instant'), 'three events should in queue: %s');
$this->assertDebuggingCalled('events_pending_count() has been deprecated along with all Events 1 API in favour of Events 2' .
' API, please use it instead.', DEBUG_DEVELOPER);
$this->assertEquals(0, eventslib_sample_function_handler('status'), 'verify previous event was not dispatched: %s');
$this->assertEquals(3, events_cron('test_instant'), 'all events should be dispatched: %s');
// events_cron + one for each dispatched event.
$this->assertDebuggingCalledCount(4);
$this->assertEquals(3, eventslib_sample_function_handler('status'), 'verify three events were dispatched: %s');
$this->assertEquals(0, events_pending_count('test_instant'), 'no events should in queue: %s');
$this->assertDebuggingCalled('events_pending_count() has been deprecated along with all Events 1 API in favour of Events 2' .
' API, please use it instead.', DEBUG_DEVELOPER);
$this->assertEquals(0, events_trigger_legacy('test_instant', 'ok'), 'this event should be dispatched immediately: %s');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$this->assertEquals(4, eventslib_sample_function_handler('status'), 'verify event was dispatched: %s');
$this->assertEquals(0, events_pending_count('test_instant'), 'no events should in queue: %s');
$this->assertDebuggingCalled('events_pending_count() has been deprecated along with all Events 1 API in favour of Events 2' .
' API, please use it instead.', DEBUG_DEVELOPER);
}
/**
* Tests events_trigger() function.
*/
public function test_events_trigger_debugging() {
events_update_definition('unittest');
$this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
$this->assertEquals(0, events_trigger('test_instant', 'ok'));
$debugmessages = array('events_trigger() is deprecated, please use new events instead', self::DEBUGGING_MSG);
$this->assertDebuggingCalledCount(2, $debugmessages, array(DEBUG_DEVELOPER, DEBUG_DEVELOPER));
}
}
/**
* Test handler function.
*/
function eventslib_sample_function_handler($eventdata) {
static $called = 0;
static $ignorefail = false;
if ($eventdata == 'status') {
return $called;
} else if ($eventdata == 'reset') {
$called = 0;
$ignorefail = false;
return;
} else if ($eventdata == 'fail') {
if ($ignorefail) {
$called++;
return true;
} else {
return false;
}
} else if ($eventdata == 'ignorefail') {
$ignorefail = true;
return;
} else if ($eventdata == 'ok') {
$called++;
return true;
}
print_error('invalideventdata', '', '', $eventdata);
}
/**
* Test handler class with static method.
*/
class eventslib_sample_handler_class {
public static function static_method($eventdata) {
static $called = 0;
static $ignorefail = false;
if ($eventdata == 'status') {
return $called;
} else if ($eventdata == 'reset') {
$called = 0;
$ignorefail = false;
return;
} else if ($eventdata == 'fail') {
if ($ignorefail) {
$called++;
return true;
} else {
return false;
}
} else if ($eventdata == 'ignorefail') {
$ignorefail = true;
return;
} else if ($eventdata == 'ok') {
$called++;
return true;
}
print_error('invalideventdata', '', '', $eventdata);
}
}
+17
View File
@@ -9,6 +9,17 @@ information provided here is intended especially for developers.
* The following functions have been finally deprecated and can not be used any more:
- external_function_info()
- core_renderer::update_module_button()
- external_function_info()
- events_trigger()
- events_cron()
- events_dispatch()
- events_is_registered()
- events_load_def()
- events_pending_count()
- events_process_queued_handler()
- events_queue_handler()
- events_trigger_legacy()
- events_update_definition()
* Following api's have been removed in behat_config_manager, please use behat_config_util instead.
- get_features_with_tags()
- get_components_steps_definitions()
@@ -23,6 +34,12 @@ information provided here is intended especially for developers.
- I set the field "<field_string>" to multiline
- I follow "<link_string>"" in the open menu
* 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 ===
-11
View File
@@ -573,7 +573,6 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
update_capabilities($component);
log_update_descriptions($component);
external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component);
@@ -612,7 +611,6 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
update_capabilities($component);
log_update_descriptions($component);
external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component);
@@ -646,7 +644,6 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
update_capabilities($component);
log_update_descriptions($component);
external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component);
@@ -754,7 +751,6 @@ function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
update_capabilities($component);
log_update_descriptions($component);
external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component);
@@ -789,7 +785,6 @@ function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
update_capabilities($component);
log_update_descriptions($component);
external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component);
@@ -826,7 +821,6 @@ function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
update_capabilities($component);
log_update_descriptions($component);
external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component);
@@ -948,7 +942,6 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
update_capabilities($component);
log_update_descriptions($component);
external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component);
@@ -989,7 +982,6 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
update_capabilities($component);
log_update_descriptions($component);
external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component);
@@ -1025,7 +1017,6 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
update_capabilities($component);
log_update_descriptions($component);
external_update_descriptions($component);
events_update_definition($component);
\core\task\manager::reset_scheduled_tasks_for_component($component);
message_update_providers($component);
\core\message\inbound\manager::update_handlers_for_component($component);
@@ -1742,7 +1733,6 @@ function install_core($version, $verbose) {
// Continue with the installation
log_update_descriptions('moodle');
external_update_descriptions('moodle');
events_update_definition('moodle');
\core\task\manager::reset_scheduled_tasks_for_component('moodle');
message_update_providers('moodle');
\core\message\inbound\manager::update_handlers_for_component('moodle');
@@ -1810,7 +1800,6 @@ function upgrade_core($version, $verbose) {
update_capabilities('moodle');
log_update_descriptions('moodle');
external_update_descriptions('moodle');
events_update_definition('moodle');
\core\task\manager::reset_scheduled_tasks_for_component('moodle');
message_update_providers('moodle');
\core\message\inbound\manager::update_handlers_for_component('moodle');
-2
View File
@@ -22,8 +22,6 @@
* @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_HISTORY_ALL', 1);
-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/renderable.php');
require_once($CFG->dirroot . '/mod/assign/gradingtable.php');
require_once($CFG->libdir . '/eventslib.php');
require_once($CFG->libdir . '/portfolio/caller.php');
use \mod_assign\output\grading_app;
-2
View File
@@ -24,8 +24,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once($CFG->libdir.'/eventslib.php');
defined('MOODLE_INTERNAL') || die();
// File areas for file submission assignment.
-2
View File
@@ -25,8 +25,6 @@
defined('MOODLE_INTERNAL') || die();
/** Include eventslib.php */
require_once($CFG->libdir.'/eventslib.php');
// Include forms lib.
require_once($CFG->libdir.'/formslib.php');
-1
View File
@@ -25,7 +25,6 @@ defined('MOODLE_INTERNAL') || die();
/** Include required files */
require_once(__DIR__ . '/deprecatedlib.php');
require_once($CFG->libdir.'/filelib.php');
require_once($CFG->libdir.'/eventslib.php');
/// CONSTANTS ///////////////////////////////////////////////////////////
-1
View File
@@ -27,7 +27,6 @@ require_once('../../config.php');
require_once($CFG->dirroot.'/mod/lesson/locallib.php');
require_once($CFG->dirroot.'/mod/lesson/pagetypes/essay.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
$mode = optional_param('mode', 'display', PARAM_ALPHA);
-1
View File
@@ -28,7 +28,6 @@
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/eventslib.php');
require_once($CFG->dirroot . '/calendar/lib.php');
-1
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/attemptlib.php');
require_once($CFG->libdir . '/completionlib.php');
require_once($CFG->libdir . '/eventslib.php');
require_once($CFG->libdir . '/filelib.php');
require_once($CFG->libdir . '/questionlib.php');