3 // This file is part of Moodle - http://moodle.org/
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
19 * deprecatedlib.php - Old functions retained only for backward compatibility
21 * Old functions retained only for backward compatibility. New code should not
22 * use any of these functions.
25 * @subpackage deprecated
26 * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
27 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31 defined('MOODLE_INTERNAL') ||
die();
33 /* === Functions that needs to be kept longer in deprecated lib than normal time period === */
36 * @deprecated since 2.7 use new events instead
38 function add_to_log() {
39 throw new coding_exception('add_to_log() has been removed, please rewrite your code to the new events API');
43 * @deprecated since 2.6
45 function events_trigger() {
46 throw new coding_exception('events_trigger() has been deprecated along with all Events 1 API in favour of Events 2 API.');
50 * List all core subsystems and their location
52 * This is a list of components that are part of the core and their
53 * language strings are defined in /lang/en/<<subsystem>>.php. If a given
54 * plugin is not listed here and it does not have proper plugintype prefix,
55 * then it is considered as course activity module.
57 * The location is optionally dirroot relative path. NULL means there is no special
58 * directory for this subsystem. If the location is set, the subsystem's
59 * renderer.php is expected to be there.
61 * @deprecated since 2.6, use core_component::get_core_subsystems()
63 * @param bool $fullpaths false means relative paths from dirroot, use true for performance reasons
64 * @return array of (string)name => (string|null)location
66 function get_core_subsystems($fullpaths = false) {
69 // NOTE: do not add any other debugging here, keep forever.
71 $subsystems = core_component
::get_core_subsystems();
77 debugging('Short paths are deprecated when using get_core_subsystems(), please fix the code to use fullpaths instead.', DEBUG_DEVELOPER
);
79 $dlength = strlen($CFG->dirroot
);
81 foreach ($subsystems as $k => $v) {
85 $subsystems[$k] = substr($v, $dlength+
1);
92 * Lists all plugin types.
94 * @deprecated since 2.6, use core_component::get_plugin_types()
96 * @param bool $fullpaths false means relative paths from dirroot
97 * @return array Array of strings - name=>location
99 function get_plugin_types($fullpaths = true) {
102 // NOTE: do not add any other debugging here, keep forever.
104 $types = core_component
::get_plugin_types();
110 debugging('Short paths are deprecated when using get_plugin_types(), please fix the code to use fullpaths instead.', DEBUG_DEVELOPER
);
112 $dlength = strlen($CFG->dirroot
);
114 foreach ($types as $k => $v) {
115 if ($k === 'theme') {
116 $types[$k] = 'theme';
119 $types[$k] = substr($v, $dlength+
1);
126 * Use when listing real plugins of one type.
128 * @deprecated since 2.6, use core_component::get_plugin_list()
130 * @param string $plugintype type of plugin
131 * @return array name=>fulllocation pairs of plugins of given type
133 function get_plugin_list($plugintype) {
135 // NOTE: do not add any other debugging here, keep forever.
137 if ($plugintype === '') {
141 return core_component
::get_plugin_list($plugintype);
145 * Get a list of all the plugins of a given type that define a certain class
146 * in a certain file. The plugin component names and class names are returned.
148 * @deprecated since 2.6, use core_component::get_plugin_list_with_class()
150 * @param string $plugintype the type of plugin, e.g. 'mod' or 'report'.
151 * @param string $class the part of the name of the class after the
152 * frankenstyle prefix. e.g 'thing' if you are looking for classes with
153 * names like report_courselist_thing. If you are looking for classes with
154 * the same name as the plugin name (e.g. qtype_multichoice) then pass ''.
155 * @param string $file the name of file within the plugin that defines the class.
156 * @return array with frankenstyle plugin names as keys (e.g. 'report_courselist', 'mod_forum')
157 * and the class names as values (e.g. 'report_courselist_thing', 'qtype_multichoice').
159 function get_plugin_list_with_class($plugintype, $class, $file) {
161 // NOTE: do not add any other debugging here, keep forever.
163 return core_component
::get_plugin_list_with_class($plugintype, $class, $file);
167 * Returns the exact absolute path to plugin directory.
169 * @deprecated since 2.6, use core_component::get_plugin_directory()
171 * @param string $plugintype type of plugin
172 * @param string $name name of the plugin
173 * @return string full path to plugin directory; NULL if not found
175 function get_plugin_directory($plugintype, $name) {
177 // NOTE: do not add any other debugging here, keep forever.
179 if ($plugintype === '') {
183 return core_component
::get_plugin_directory($plugintype, $name);
187 * Normalize the component name using the "frankenstyle" names.
189 * @deprecated since 2.6, use core_component::normalize_component()
191 * @param string $component
192 * @return array two-items list of [(string)type, (string|null)name]
194 function normalize_component($component) {
196 // NOTE: do not add any other debugging here, keep forever.
198 return core_component
::normalize_component($component);
202 * Return exact absolute path to a plugin directory.
204 * @deprecated since 2.6, use core_component::normalize_component()
206 * @param string $component name such as 'moodle', 'mod_forum'
207 * @return string full path to component directory; NULL if not found
209 function get_component_directory($component) {
211 // NOTE: do not add any other debugging here, keep forever.
213 return core_component
::get_component_directory($component);
217 * Get the context instance as an object. This function will create the
218 * context instance if it does not exist yet.
220 * @deprecated since 2.2, use context_course::instance() or other relevant class instead
221 * @todo This will be deleted in Moodle 2.8, refer MDL-34472
222 * @param integer $contextlevel The context level, for example CONTEXT_COURSE, or CONTEXT_MODULE.
223 * @param integer $instance The instance id. For $level = CONTEXT_COURSE, this would be $course->id,
224 * for $level = CONTEXT_MODULE, this would be $cm->id. And so on. Defaults to 0
225 * @param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found;
226 * MUST_EXIST means throw exception if no record or multiple records found
227 * @return context The context object.
229 function get_context_instance($contextlevel, $instance = 0, $strictness = IGNORE_MISSING
) {
231 debugging('get_context_instance() is deprecated, please use context_xxxx::instance() instead.', DEBUG_DEVELOPER
);
233 $instances = (array)$instance;
236 $classname = context_helper
::get_class_for_level($contextlevel);
238 // we do not load multiple contexts any more, PAGE should be responsible for any preloading
239 foreach ($instances as $inst) {
240 $contexts[$inst] = $classname::instance($inst, $strictness);
243 if (is_array($instance)) {
246 return $contexts[$instance];
249 /* === End of long term deprecated api list === */
252 * @deprecated since 2.7 - use new file picker instead
254 function clam_log_upload() {
255 throw new coding_exception('clam_log_upload() can not be used any more, please use file picker instead');
259 * @deprecated since 2.7 - use new file picker instead
261 function clam_log_infected() {
262 throw new coding_exception('clam_log_infected() can not be used any more, please use file picker instead');
266 * @deprecated since 2.7 - use new file picker instead
268 function clam_change_log() {
269 throw new coding_exception('clam_change_log() can not be used any more, please use file picker instead');
273 * @deprecated since 2.7 - infected files are now deleted in file picker
275 function clam_replace_infected_file() {
276 throw new coding_exception('clam_replace_infected_file() can not be used any more, please use file picker instead');
280 * @deprecated since 2.7
282 function clam_handle_infected_file() {
283 throw new coding_exception('clam_handle_infected_file() can not be used any more, please use file picker instead');
287 * @deprecated since 2.7
289 function clam_scan_moodle_file() {
290 throw new coding_exception('clam_scan_moodle_file() can not be used any more, please use file picker instead');
295 * @deprecated since 2.7 PHP 5.4.x should be always compatible.
297 function password_compat_not_supported() {
298 throw new coding_exception('Do not use password_compat_not_supported() - bcrypt is now always available');
302 * @deprecated since 2.6
304 function session_get_instance() {
305 throw new coding_exception('session_get_instance() is removed, use \core\session\manager instead');
309 * @deprecated since 2.6
311 function session_is_legacy() {
312 throw new coding_exception('session_is_legacy() is removed, do not use any more');
316 * @deprecated since 2.6
318 function session_kill_all() {
319 throw new coding_exception('session_kill_all() is removed, use \core\session\manager::kill_all_sessions() instead');
323 * @deprecated since 2.6
325 function session_touch() {
326 throw new coding_exception('session_touch() is removed, use \core\session\manager::touch_session() instead');
330 * @deprecated since 2.6
332 function session_kill() {
333 throw new coding_exception('session_kill() is removed, use \core\session\manager::kill_session() instead');
337 * @deprecated since 2.6
339 function session_kill_user() {
340 throw new coding_exception('session_kill_user() is removed, use \core\session\manager::kill_user_sessions() instead');
344 * @deprecated since 2.6
346 function session_set_user() {
347 throw new coding_exception('session_set_user() is removed, use \core\session\manager::set_user() instead');
351 * @deprecated since 2.6
353 function session_is_loggedinas() {
354 throw new coding_exception('session_is_loggedinas() is removed, use \core\session\manager::is_loggedinas() instead');
358 * @deprecated since 2.6
360 function session_get_realuser() {
361 throw new coding_exception('session_get_realuser() is removed, use \core\session\manager::get_realuser() instead');
365 * @deprecated since 2.6
367 function session_loginas() {
368 throw new coding_exception('session_loginas() is removed, use \core\session\manager::loginas() instead');
372 * @deprecated since 2.6
374 function js_minify() {
375 throw new coding_exception('js_minify() is removed, use core_minify::js_files() or core_minify::js() instead.');
379 * @deprecated since 2.6
381 function css_minify_css() {
382 throw new coding_exception('css_minify_css() is removed, use core_minify::css_files() or core_minify::css() instead.');
385 // === Deprecated before 2.6.0 ===
390 function check_gd_version() {
391 throw new coding_exception('check_gd_version() is removed, GD extension is always available now');
397 function update_login_count() {
398 throw new coding_exception('update_login_count() is removed, all calls need to be removed');
404 function reset_login_count() {
405 throw new coding_exception('reset_login_count() is removed, all calls need to be removed');
411 function update_log_display_entry() {
413 throw new coding_exception('The update_log_display_entry() is removed, please use db/log.php description file instead.');
417 * @deprecated use the text formatting in a standard way instead (https://moodledev.io/docs/apis/subsystems/output#output-functions)
418 * this was abused mostly for embedding of attachments
420 function filter_text() {
421 throw new coding_exception('filter_text() can not be used anymore, use format_text(), format_string() etc instead.');
425 * @deprecated Loginhttps is no longer supported
427 function httpsrequired() {
428 throw new coding_exception('httpsrequired() can not be used any more. Loginhttps is no longer supported.');
432 * @deprecated since 3.1 - replacement legacy file API methods can be found on the moodle_url class, for example:
433 * The moodle_url::make_legacyfile_url() method can be used to generate a legacy course file url. To generate
434 * course module file.php url the moodle_url::make_file_url() should be used.
436 function get_file_url() {
437 throw new coding_exception('get_file_url() can not be used anymore. Please use ' .
438 'moodle_url factory methods instead.');
442 * @deprecated use get_enrolled_users($context) instead.
444 function get_course_participants() {
445 throw new coding_exception('get_course_participants() can not be used any more, use get_enrolled_users() instead.');
449 * @deprecated use is_enrolled($context, $userid) instead.
451 function is_course_participant() {
452 throw new coding_exception('is_course_participant() can not be used any more, use is_enrolled() instead.');
458 function get_recent_enrolments() {
459 throw new coding_exception('get_recent_enrolments() is removed as it returned inaccurate results.');
463 * @deprecated use clean_param($string, PARAM_FILE) instead.
465 function detect_munged_arguments() {
466 throw new coding_exception('detect_munged_arguments() can not be used any more, please use clean_param(,PARAM_FILE) instead.');
471 * @deprecated since 2.0 MDL-15919
473 function unzip_file() {
474 throw new coding_exception(__FUNCTION__
. '() is deprecated. '
475 . 'Please use the application/zip file_packer implementation instead.');
479 * @deprecated since 2.0 MDL-15919
481 function zip_files() {
482 throw new coding_exception(__FUNCTION__
. '() is deprecated. '
483 . 'Please use the application/zip file_packer implementation instead.');
487 * @deprecated use groups_get_all_groups() instead.
489 function mygroupid() {
490 throw new coding_exception('mygroupid() can not be used any more, please use groups_get_all_groups() instead.');
494 * @deprecated since Moodle 2.0 MDL-14617 - please do not use this function any more.
496 function groupmode() {
497 throw new coding_exception('groupmode() can not be used any more, please use groups_get_* instead.');
501 * @deprecated Since year 2006 - please do not use this function any more.
503 function set_current_group() {
504 throw new coding_exception('set_current_group() can not be used anymore, please use $SESSION->currentgroup[$courseid] instead');
508 * @deprecated Since year 2006 - please do not use this function any more.
510 function get_current_group() {
511 throw new coding_exception('get_current_group() can not be used any more, please use groups_get_* instead');
515 * @deprecated Since Moodle 2.8
517 function groups_filter_users_by_course_module_visible() {
518 throw new coding_exception('groups_filter_users_by_course_module_visible() is removed. ' .
519 'Replace with a call to \core_availability\info_module::filter_user_list(), ' .
520 'which does basically the same thing but includes other restrictions such ' .
521 'as profile restrictions.');
525 * @deprecated Since Moodle 2.8
527 function groups_course_module_visible() {
528 throw new coding_exception('groups_course_module_visible() is removed, use $cm->uservisible to decide whether the current
529 user can ' . 'access an activity.', DEBUG_DEVELOPER
);
533 * @deprecated since 2.0
536 throw new coding_exception('notlocalisederrormessage', 'error', $link, $message, 'error() is a removed, please call
537 throw new \moodle_exception() instead of error()');
542 * @deprecated use $PAGE->theme->name instead.
544 function current_theme() {
545 throw new coding_exception('current_theme() can not be used any more, please use $PAGE->theme->name instead');
552 throw new coding_exception('formerr() is removed. Please change your code to use $OUTPUT->error_text($string).');
556 * @deprecated use $OUTPUT->skip_link_target() in instead.
558 function skip_main_destination() {
559 throw new coding_exception('skip_main_destination() can not be used any more, please use $OUTPUT->skip_link_target() instead.');
563 * @deprecated use $OUTPUT->container() instead.
565 function print_container() {
566 throw new coding_exception('print_container() can not be used any more. Please use $OUTPUT->container() instead.');
570 * @deprecated use $OUTPUT->container_start() instead.
572 function print_container_start() {
573 throw new coding_exception('print_container_start() can not be used any more. Please use $OUTPUT->container_start() instead.');
577 * @deprecated use $OUTPUT->container_end() instead.
579 function print_container_end() {
580 throw new coding_exception('print_container_end() can not be used any more. Please use $OUTPUT->container_end() instead.');
584 * @deprecated since Moodle 2.0 MDL-19077 - use $OUTPUT->notification instead.
587 throw new coding_exception('notify() is removed, please use $OUTPUT->notification() instead');
591 * @deprecated use $OUTPUT->continue_button() instead.
593 function print_continue() {
594 throw new coding_exception('print_continue() can not be used any more. Please use $OUTPUT->continue_button() instead.');
598 * @deprecated use $PAGE methods instead.
600 function print_header() {
602 throw new coding_exception('print_header() can not be used any more. Please use $PAGE methods instead.');
606 * @deprecated use $PAGE methods instead.
608 function print_header_simple() {
610 throw new coding_exception('print_header_simple() can not be used any more. Please use $PAGE methods instead.');
614 * @deprecated use $OUTPUT->block() instead.
616 function print_side_block() {
617 throw new coding_exception('print_side_block() can not be used any more, please use $OUTPUT->block() instead.');
621 * @deprecated since Moodle 3.6
623 function print_textarea() {
624 throw new coding_exception(
625 'print_textarea() has been removed. Please use $OUTPUT->print_textarea() instead.'
630 * Returns an image of an up or down arrow, used for column sorting. To avoid unnecessary DB accesses, please
631 * provide this function with the language strings for sortasc and sortdesc.
633 * @deprecated use $OUTPUT->arrow() instead.
634 * @todo final deprecation of this function once MDL-45448 is resolved
636 * If no sort string is associated with the direction, an arrow with no alt text will be printed/returned.
639 * @param string $direction 'up' or 'down'
640 * @param string $strsort The language string used for the alt attribute of this image
641 * @param bool $return Whether to print directly or return the html string
642 * @return string|void depending on $return
645 function print_arrow($direction='up', $strsort=null, $return=false) {
648 debugging('print_arrow() is deprecated. Please use $OUTPUT->arrow() instead.', DEBUG_DEVELOPER
);
650 if (!in_array($direction, array('up', 'down', 'right', 'left', 'move'))) {
656 switch ($direction) {
671 // Prepare language string
673 if (empty($strsort) && !empty($sortdir)) {
674 $strsort = get_string('sort' . $sortdir, 'grades');
677 $return = ' ' . $OUTPUT->pix_icon('t/' . $direction, $strsort) . ' ';
687 * @deprecated since Moodle 2.0
689 function choose_from_menu() {
690 throw new coding_exception('choose_from_menu() is removed. Please change your code to use html_writer::select().');
694 * @deprecated use $OUTPUT->help_icon_scale($courseid, $scale) instead.
696 function print_scale_menu_helpbutton() {
697 throw new coding_exception('print_scale_menu_helpbutton() can not be used any more. '.
698 'Please use $OUTPUT->help_icon_scale($courseid, $scale) instead.');
702 * @deprecated use html_writer::checkbox() instead.
704 function print_checkbox() {
705 throw new coding_exception('print_checkbox() can not be used any more. Please use html_writer::checkbox() instead.');
709 * @deprecated since Moodle 3.2
711 function update_module_button() {
712 throw new coding_exception('update_module_button() can not be used anymore. Activity modules should ' .
713 'not add the edit module button, the link is already available in the Administration block. Themes ' .
714 'can choose to display the link in the buttons row consistently for all module types.');
718 * @deprecated use $OUTPUT->navbar() instead
720 function print_navigation () {
721 throw new coding_exception('print_navigation() can not be used any more, please update use $OUTPUT->navbar() instead.');
725 * @deprecated Please use $PAGE->navabar methods instead.
727 function build_navigation() {
728 throw new coding_exception('build_navigation() can not be used any more, please use $PAGE->navbar methods instead.');
732 * @deprecated not relevant with global navigation in Moodle 2.x+
735 throw new coding_exception('navmenu() can not be used any more, it is no longer relevant with global navigation.');
738 /// CALENDAR MANAGEMENT ////////////////////////////////////////////////////////////////
742 * @deprecated please use calendar_event::create() instead.
744 function add_event() {
745 throw new coding_exception('add_event() can not be used any more, please use calendar_event::create() instead.');
749 * @deprecated please calendar_event->update() instead.
751 function update_event() {
752 throw new coding_exception('update_event() is removed, please use calendar_event->update() instead.');
756 * @deprecated please use calendar_event->delete() instead.
758 function delete_event() {
759 throw new coding_exception('delete_event() can not be used any more, please use '.
760 'calendar_event->delete() instead.');
764 * @deprecated please use calendar_event->toggle_visibility(false) instead.
766 function hide_event() {
767 throw new coding_exception('hide_event() can not be used any more, please use '.
768 'calendar_event->toggle_visibility(false) instead.');
772 * @deprecated please use calendar_event->toggle_visibility(true) instead.
774 function show_event() {
775 throw new coding_exception('show_event() can not be used any more, please use '.
776 'calendar_event->toggle_visibility(true) instead.');
780 * @deprecated since Moodle 2.2 use core_text::xxxx() instead.
782 function textlib_get_instance() {
783 throw new coding_exception('textlib_get_instance() can not be used any more, please use '.
784 'core_text::functioname() instead.');
788 * @deprecated since 2.4
790 function get_generic_section_name() {
791 throw new coding_exception('get_generic_section_name() is deprecated. Please use appropriate functionality '
792 .'from class core_courseformat\\base');
796 * @deprecated since 2.4
798 function get_all_sections() {
799 throw new coding_exception('get_all_sections() is removed. See phpdocs for this function');
803 * @deprecated since 2.4
805 function add_mod_to_section() {
806 throw new coding_exception('Function add_mod_to_section() is removed, please use course_add_cm_to_section()');
810 * @deprecated since 2.4
812 function get_all_mods() {
813 throw new coding_exception('Function get_all_mods() is removed. Use get_fast_modinfo() and get_module_types_names() instead. See phpdocs for details');
817 * @deprecated since 2.4
819 function get_course_section() {
820 throw new coding_exception('Function get_course_section() is removed. Please use course_create_sections_if_missing() and get_fast_modinfo() instead.');
824 * @deprecated since 2.4
826 function format_weeks_get_section_dates() {
827 throw new coding_exception('Function format_weeks_get_section_dates() is removed. It is not recommended to'.
828 ' use it outside of format_weeks plugin');
832 * @deprecated since 2.5
834 function get_print_section_cm_text() {
835 throw new coding_exception('Function get_print_section_cm_text() is removed. Please use '.
836 'cm_info::get_formatted_content() and cm_info::get_formatted_name()');
840 * @deprecated since 2.5
842 function print_section_add_menus() {
843 throw new coding_exception('Function print_section_add_menus() is removed. Please use course renderer '.
844 'function course_section_add_cm_control()');
848 * @deprecated since 2.5. Please use:
850 function make_editing_buttons() {
851 throw new coding_exception('Function make_editing_buttons() is removed, please see PHPdocs in '.
852 'lib/deprecatedlib.php on how to replace it');
856 * @deprecated since 2.5
858 function print_section() {
859 throw new coding_exception(
860 'Function print_section() is removed.' .
861 ' Please use core_courseformat\\output\\local\\content\\section' .
862 ' to render a course section instead.'
867 * @deprecated since 2.5
869 function print_overview() {
870 throw new coding_exception('Function print_overview() is removed. Use block course_overview to display this information');
874 * @deprecated since 2.5
876 function print_recent_activity() {
877 throw new coding_exception('Function print_recent_activity() is removed. It is not recommended to'.
878 ' use it outside of block_recent_activity');
882 * @deprecated since 2.5
884 function delete_course_module() {
885 throw new coding_exception('Function delete_course_module() is removed. Please use course_delete_module() instead.');
889 * @deprecated since 2.5
891 function update_category_button() {
892 throw new coding_exception('Function update_category_button() is removed. Pages to view '.
893 'and edit courses are now separate and no longer depend on editing mode.');
897 * @deprecated since 2.5
899 function make_categories_list() {
900 throw new coding_exception('Global function make_categories_list() is removed. Please use '.
901 'core_course_category::make_categories_list() and core_course_category::get_parents()');
905 * @deprecated since 2.5
907 function category_delete_move() {
908 throw new coding_exception('Function category_delete_move() is removed. Please use ' .
909 'core_course_category::delete_move() instead.');
913 * @deprecated since 2.5
915 function category_delete_full() {
916 throw new coding_exception('Function category_delete_full() is removed. Please use ' .
917 'core_course_category::delete_full() instead.');
921 * @deprecated since 2.5
923 function move_category() {
924 throw new coding_exception('Function move_category() is removed. Please use core_course_category::change_parent() instead.');
928 * @deprecated since 2.5
930 function course_category_hide() {
931 throw new coding_exception('Function course_category_hide() is removed. Please use core_course_category::hide() instead.');
935 * @deprecated since 2.5
937 function course_category_show() {
938 throw new coding_exception('Function course_category_show() is removed. Please use core_course_category::show() instead.');
942 * @deprecated since 2.5. Please use core_course_category::get($catid, IGNORE_MISSING) or
943 * core_course_category::get($catid, MUST_EXIST).
945 function get_course_category() {
946 throw new coding_exception('Function get_course_category() is removed. Please use core_course_category::get(), ' .
947 'see phpdocs for more details');
951 * @deprecated since 2.5
953 function create_course_category() {
954 throw new coding_exception('Function create_course_category() is removed. Please use core_course_category::create(), ' .
955 'see phpdocs for more details');
959 * @deprecated since 2.5. Please use core_course_category::get() and core_course_category::get_children()
961 function get_all_subcategories() {
962 throw new coding_exception('Function get_all_subcategories() is removed. Please use appropriate methods() '.
963 'of core_course_category class. See phpdocs for more details');
967 * @deprecated since 2.5. Please use core_course_category::get($parentid)->get_children().
969 function get_child_categories() {
970 throw new coding_exception('Function get_child_categories() is removed. Use core_course_category::get_children() or see ' .
971 'phpdocs for more details.');
975 * @deprecated since 2.5
977 function get_categories() {
978 throw new coding_exception('Function get_categories() is removed. Please use ' .
979 'appropriate functions from class core_course_category');
983 * @deprecated since 2.5
985 function print_course_search() {
986 throw new coding_exception('Function print_course_search() is removed, please use course renderer');
990 * @deprecated since 2.5
992 function print_my_moodle() {
993 throw new coding_exception('Function print_my_moodle() is removed, please use course renderer ' .
994 'function frontpage_my_courses()');
998 * @deprecated since 2.5
1000 function print_remote_course() {
1001 throw new coding_exception('Function print_remote_course() is removed, please use course renderer');
1005 * @deprecated since 2.5
1007 function print_remote_host() {
1008 throw new coding_exception('Function print_remote_host() is removed, please use course renderer');
1012 * @deprecated since 2.5
1014 function print_whole_category_list() {
1015 throw new coding_exception('Function print_whole_category_list() is removed, please use course renderer');
1019 * @deprecated since 2.5
1021 function print_category_info() {
1022 throw new coding_exception('Function print_category_info() is removed, please use course renderer');
1026 * @deprecated since 2.5
1028 function get_course_category_tree() {
1029 throw new coding_exception('Function get_course_category_tree() is removed, please use course ' .
1030 'renderer or core_course_category class, see function phpdocs for more info');
1034 * @deprecated since 2.5
1036 function print_courses() {
1037 throw new coding_exception('Function print_courses() is removed, please use course renderer');
1041 * @deprecated since 2.5
1043 function print_course() {
1044 throw new coding_exception('Function print_course() is removed, please use course renderer');
1048 * @deprecated since 2.5
1050 function get_category_courses_array() {
1051 throw new coding_exception('Function get_category_courses_array() is removed, please use methods of ' .
1052 'core_course_category class');
1056 * @deprecated since 2.5
1058 function get_category_courses_array_recursively() {
1059 throw new coding_exception('Function get_category_courses_array_recursively() is removed, please use ' .
1060 'methods of core_course_category class', DEBUG_DEVELOPER
);
1064 * @deprecated since Moodle 2.5 MDL-27814 - please do not use this function any more.
1066 function blog_get_context_url() {
1067 throw new coding_exception('Function blog_get_context_url() is removed, getting params from context is not reliable for blogs.');
1071 * @deprecated since 2.5
1073 function get_courses_wmanagers() {
1074 throw new coding_exception('Function get_courses_wmanagers() is removed, please use ' .
1075 'core_course_category::get_courses()');
1079 * @deprecated since 2.5
1081 function convert_tree_to_html() {
1082 throw new coding_exception('Function convert_tree_to_html() is removed. Consider using class tabtree and core_renderer::render_tabtree()');
1086 * @deprecated since 2.5
1088 function convert_tabrows_to_tree() {
1089 throw new coding_exception('Function convert_tabrows_to_tree() is removed. Consider using class tabtree');
1093 * @deprecated since 2.5 - do not use, the textrotate.js will work it out automatically
1095 function can_use_rotated_text() {
1096 debugging('can_use_rotated_text() is removed. JS feature detection is used automatically.');
1100 * @deprecated since Moodle 2.2 MDL-35009 - please do not use this function any more.
1102 function get_context_instance_by_id() {
1103 throw new coding_exception('get_context_instance_by_id() is now removed, please use context::instance_by_id($id) instead.');
1107 * Returns system context or null if can not be created yet.
1109 * @see context_system::instance()
1110 * @deprecated since 2.2
1111 * @param bool $cache use caching
1112 * @return context system context (null if context table not created yet)
1114 function get_system_context($cache = true) {
1115 debugging('get_system_context() is deprecated, please use context_system::instance() instead.', DEBUG_DEVELOPER
);
1116 return context_system
::instance(0, IGNORE_MISSING
, $cache);
1120 * @deprecated since 2.2, use $context->get_parent_context_ids() instead
1122 function get_parent_contexts() {
1123 throw new coding_exception('get_parent_contexts() is removed, please use $context->get_parent_context_ids() instead.');
1127 * @deprecated since Moodle 2.2
1129 function get_parent_contextid() {
1130 throw new coding_exception('get_parent_contextid() is removed, please use $context->get_parent_context() instead.');
1134 * @deprecated since 2.2
1136 function get_child_contexts() {
1137 throw new coding_exception('get_child_contexts() is removed, please use $context->get_child_contexts() instead.');
1141 * @deprecated since 2.2
1143 function create_contexts() {
1144 throw new coding_exception('create_contexts() is removed, please use context_helper::create_instances() instead.');
1148 * @deprecated since 2.2
1150 function cleanup_contexts() {
1151 throw new coding_exception('cleanup_contexts() is removed, please use context_helper::cleanup_instances() instead.');
1155 * @deprecated since 2.2
1157 function build_context_path() {
1158 throw new coding_exception('build_context_path() is removed, please use context_helper::build_all_paths() instead.');
1162 * @deprecated since 2.2
1164 function rebuild_contexts() {
1165 throw new coding_exception('rebuild_contexts() is removed, please use $context->reset_paths(true) instead.');
1169 * @deprecated since Moodle 2.2
1171 function preload_course_contexts() {
1172 throw new coding_exception('preload_course_contexts() is removed, please use context_helper::preload_course() instead.');
1176 * @deprecated since Moodle 2.2
1178 function context_moved() {
1179 throw new coding_exception('context_moved() is removed, please use context::update_moved() instead.');
1183 * @deprecated since 2.2
1185 function fetch_context_capabilities() {
1186 throw new coding_exception('fetch_context_capabilities() is removed, please use $context->get_capabilities() instead.');
1190 * @deprecated since 2.2
1192 function context_instance_preload() {
1193 throw new coding_exception('context_instance_preload() is removed, please use context_helper::preload_from_record() instead.');
1197 * @deprecated since 2.2
1199 function get_contextlevel_name() {
1200 throw new coding_exception('get_contextlevel_name() is removed, please use context_helper::get_level_name() instead.');
1204 * @deprecated since 2.2
1206 function print_context_name() {
1207 throw new coding_exception('print_context_name() is removed, please use $context->get_context_name() instead.');
1211 * @deprecated since 2.2, use $context->mark_dirty() instead
1213 function mark_context_dirty() {
1214 throw new coding_exception('mark_context_dirty() is removed, please use $context->mark_dirty() instead.');
1218 * @deprecated since Moodle 2.2
1220 function delete_context() {
1221 throw new coding_exception('delete_context() is removed, please use context_helper::delete_instance() ' .
1222 'or $context->delete_content() instead.');
1226 * @deprecated since 2.2
1228 function get_context_url() {
1229 throw new coding_exception('get_context_url() is removed, please use $context->get_url() instead.');
1233 * @deprecated since 2.2
1235 function get_course_context() {
1236 throw new coding_exception('get_course_context() is removed, please use $context->get_course_context(true) instead.');
1240 * @deprecated since 2.2
1242 function get_user_courses_bycap() {
1243 throw new coding_exception('get_user_courses_bycap() is removed, please use enrol_get_users_courses() instead.');
1247 * @deprecated since Moodle 2.2
1249 function get_role_context_caps() {
1250 throw new coding_exception('get_role_context_caps() is removed, it is really slow. Don\'t use it.');
1254 * @deprecated since 2.2
1256 function get_courseid_from_context() {
1257 throw new coding_exception('get_courseid_from_context() is removed, please use $context->get_course_context(false) instead.');
1261 * @deprecated since 2.2
1263 function context_instance_preload_sql() {
1264 throw new coding_exception('context_instance_preload_sql() is removed, please use context_helper::get_preload_record_columns_sql() instead.');
1268 * @deprecated since 2.2
1270 function get_related_contexts_string() {
1271 throw new coding_exception('get_related_contexts_string() is removed, please use $context->get_parent_context_ids(true) instead.');
1275 * @deprecated since 2.6
1277 function get_plugin_list_with_file() {
1278 throw new coding_exception('get_plugin_list_with_file() is removed, please use core_component::get_plugin_list_with_file() instead.');
1282 * @deprecated since 2.6
1284 function check_browser_operating_system() {
1285 throw new coding_exception('check_browser_operating_system is removed, please update your code to use core_useragent instead.');
1289 * @deprecated since 2.6
1291 function check_browser_version() {
1292 throw new coding_exception('check_browser_version is removed, please update your code to use core_useragent instead.');
1296 * @deprecated since 2.6
1298 function get_device_type() {
1299 throw new coding_exception('get_device_type is removed, please update your code to use core_useragent instead.');
1303 * @deprecated since 2.6
1305 function get_device_type_list() {
1306 throw new coding_exception('get_device_type_list is removed, please update your code to use core_useragent instead.');
1310 * @deprecated since 2.6
1312 function get_selected_theme_for_device_type() {
1313 throw new coding_exception('get_selected_theme_for_device_type is removed, please update your code to use core_useragent instead.');
1317 * @deprecated since 2.6
1319 function get_device_cfg_var_name() {
1320 throw new coding_exception('get_device_cfg_var_name is removed, please update your code to use core_useragent instead.');
1324 * @deprecated since 2.6
1326 function set_user_device_type() {
1327 throw new coding_exception('set_user_device_type is removed, please update your code to use core_useragent instead.');
1331 * @deprecated since 2.6
1333 function get_user_device_type() {
1334 throw new coding_exception('get_user_device_type is removed, please update your code to use core_useragent instead.');
1338 * @deprecated since 2.6
1340 function get_browser_version_classes() {
1341 throw new coding_exception('get_browser_version_classes is removed, please update your code to use core_useragent instead.');
1345 * @deprecated since Moodle 2.6
1347 function generate_email_supportuser() {
1348 throw new coding_exception('generate_email_supportuser is removed, please use core_user::get_support_user');
1352 * @deprecated since Moodle 2.6
1354 function badges_get_issued_badge_info() {
1355 throw new coding_exception('Function badges_get_issued_badge_info() is removed. Please use core_badges_assertion class and methods to generate badge assertion.');
1359 * @deprecated since 2.6
1361 function can_use_html_editor() {
1362 throw new coding_exception('can_use_html_editor is removed, please update your code to assume it returns true.');
1367 * @deprecated since Moodle 2.7, use {@link user_count_login_failures()} instead.
1369 function count_login_failures() {
1370 throw new coding_exception('count_login_failures() can not be used any more, please use user_count_login_failures().');
1374 * @deprecated since 2.7 MDL-33099/MDL-44088 - please do not use this function any more.
1376 function ajaxenabled() {
1377 throw new coding_exception('ajaxenabled() can not be used anymore. Update your code to work with JS at all times.');
1381 * @deprecated Since Moodle 2.7 MDL-44070
1383 function coursemodule_visible_for_user() {
1384 throw new coding_exception('coursemodule_visible_for_user() can not be used any more,
1385 please use \core_availability\info_module::is_user_visible()');
1389 * @deprecated since Moodle 2.8 MDL-36014, MDL-35618 this functionality is removed
1391 function enrol_cohort_get_cohorts() {
1392 throw new coding_exception('Function enrol_cohort_get_cohorts() is removed, use '.
1393 'cohort_get_available_cohorts() instead');
1397 * @deprecated since Moodle 2.8 MDL-36014 please use cohort_can_view_cohort()
1399 function enrol_cohort_can_view_cohort() {
1400 throw new coding_exception('Function enrol_cohort_can_view_cohort() is removed, use cohort_can_view_cohort() instead');
1404 * @deprecated since Moodle 2.8 MDL-36014 use cohort_get_available_cohorts() instead
1406 function cohort_get_visible_list() {
1407 throw new coding_exception('Function cohort_get_visible_list() is removed. Please use function cohort_get_available_cohorts() ".
1408 "that correctly checks capabilities.');
1412 * @deprecated since Moodle 2.8 MDL-35618 this functionality is removed
1414 function enrol_cohort_enrol_all_users() {
1415 throw new coding_exception('enrol_cohort_enrol_all_users() is removed. This functionality is moved to enrol_manual.');
1419 * @deprecated since Moodle 2.8 MDL-35618 this functionality is removed
1421 function enrol_cohort_search_cohorts() {
1422 throw new coding_exception('enrol_cohort_search_cohorts() is removed. This functionality is moved to enrol_manual.');
1425 /* === Apis deprecated in since Moodle 2.9 === */
1428 * @deprecated since Moodle 2.9 MDL-49371 - please do not use this function any more.
1430 function message_current_user_is_involved() {
1431 throw new coding_exception('message_current_user_is_involved() can not be used any more.');
1435 * @deprecated since Moodle 2.9 MDL-45898 - please do not use this function any more.
1437 function profile_display_badges() {
1438 throw new coding_exception('profile_display_badges() can not be used any more.');
1442 * @deprecated since Moodle 2.9 MDL-45774 - Please do not use this function any more.
1444 function useredit_shared_definition_preferences() {
1445 throw new coding_exception('useredit_shared_definition_preferences() can not be used any more.');
1450 * @deprecated since Moodle 2.9
1452 function calendar_normalize_tz() {
1453 throw new coding_exception('calendar_normalize_tz() can not be used any more, please use core_date::normalise_timezone() instead.');
1457 * @deprecated since Moodle 2.9
1459 function get_user_timezone_offset() {
1460 throw new coding_exception('get_user_timezone_offset() can not be used any more, please use standard PHP DateTimeZone class instead');
1465 * @deprecated since Moodle 2.9
1467 function get_timezone_offset() {
1468 throw new coding_exception('get_timezone_offset() can not be used any more, please use standard PHP DateTimeZone class instead');
1472 * @deprecated since Moodle 2.9
1474 function get_list_of_timezones() {
1475 throw new coding_exception('get_list_of_timezones() can not be used any more, please use core_date::get_list_of_timezones() instead');
1479 * @deprecated since Moodle 2.9
1481 function update_timezone_records() {
1482 throw new coding_exception('update_timezone_records() can not be used any more, please use standard PHP DateTime class instead');
1486 * @deprecated since Moodle 2.9
1488 function calculate_user_dst_table() {
1489 throw new coding_exception('calculate_user_dst_table() can not be used any more, please use standard PHP DateTime class instead');
1493 * @deprecated since Moodle 2.9
1495 function dst_changes_for_year() {
1496 throw new coding_exception('dst_changes_for_year() can not be used any more, please use standard DateTime class instead');
1500 * @deprecated since Moodle 2.9
1502 function get_timezone_record() {
1503 throw new coding_exception('get_timezone_record() can not be used any more, please use standard PHP DateTime class instead');
1506 /* === Apis deprecated since Moodle 3.0 === */
1508 * @deprecated since Moodle 3.0 MDL-49360 - please do not use this function any more.
1510 function get_referer() {
1511 throw new coding_exception('get_referer() can not be used any more. Please use get_local_referer() instead.');
1515 * @deprecated since Moodle 3.0 use \core_useragent::is_web_crawler instead.
1517 function is_web_crawler() {
1518 throw new coding_exception('is_web_crawler() can not be used any more. Please use core_useragent::is_web_crawler() instead.');
1522 * @deprecated since Moodle 3.0 MDL-50287 - please do not use this function any more.
1524 function completion_cron() {
1525 throw new coding_exception('completion_cron() can not be used any more. Functionality has been moved to scheduled tasks.');
1529 * @deprecated since 3.0
1531 function coursetag_get_tags() {
1532 throw new coding_exception('Function coursetag_get_tags() can not be used any more. ' .
1533 'Userid is no longer used for tagging courses.');
1537 * @deprecated since 3.0
1539 function coursetag_get_all_tags() {
1540 throw new coding_exception('Function coursetag_get_all_tags() can not be used any more. Userid is no ' .
1541 'longer used for tagging courses.');
1545 * @deprecated since 3.0
1547 function coursetag_get_jscript() {
1548 throw new coding_exception('Function coursetag_get_jscript() can not be used any more and is obsolete.');
1552 * @deprecated since 3.0
1554 function coursetag_get_jscript_links() {
1555 throw new coding_exception('Function coursetag_get_jscript_links() can not be used any more and is obsolete.');
1559 * @deprecated since 3.0
1561 function coursetag_get_records() {
1562 throw new coding_exception('Function coursetag_get_records() can not be used any more. ' .
1563 'Userid is no longer used for tagging courses.');
1567 * @deprecated since 3.0
1569 function coursetag_store_keywords() {
1570 throw new coding_exception('Function coursetag_store_keywords() can not be used any more. ' .
1571 'Userid is no longer used for tagging courses.');
1575 * @deprecated since 3.0
1577 function coursetag_delete_keyword() {
1578 throw new coding_exception('Function coursetag_delete_keyword() can not be used any more. ' .
1579 'Userid is no longer used for tagging courses.');
1583 * @deprecated since 3.0
1585 function coursetag_get_tagged_courses() {
1586 throw new coding_exception('Function coursetag_get_tagged_courses() can not be used any more. ' .
1587 'Userid is no longer used for tagging courses.');
1591 * @deprecated since 3.0
1593 function coursetag_delete_course_tags() {
1594 throw new coding_exception('Function coursetag_delete_course_tags() is deprecated. ' .
1595 'Use core_tag_tag::remove_all_item_tags().');
1599 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->update() instead
1601 function tag_type_set() {
1602 throw new coding_exception('tag_type_set() can not be used anymore. Please use ' .
1603 'core_tag_tag::get($tagid)->update().');
1607 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->update() instead
1609 function tag_description_set() {
1610 throw new coding_exception('tag_description_set() can not be used anymore. Please use ' .
1611 'core_tag_tag::get($tagid)->update().');
1615 * @deprecated since 3.1. Use core_tag_tag::get_item_tags() instead
1617 function tag_get_tags() {
1618 throw new coding_exception('tag_get_tags() can not be used anymore. Please use ' .
1619 'core_tag_tag::get_item_tags().');
1623 * @deprecated since 3.1
1625 function tag_get_tags_array() {
1626 throw new coding_exception('tag_get_tags_array() can not be used anymore. Please use ' .
1627 'core_tag_tag::get_item_tags_array().');
1631 * @deprecated since 3.1. Use core_tag_tag::get_item_tags_array() or $OUTPUT->tag_list(core_tag_tag::get_item_tags())
1633 function tag_get_tags_csv() {
1634 throw new coding_exception('tag_get_tags_csv() can not be used anymore. Please use ' .
1635 'core_tag_tag::get_item_tags_array() or $OUTPUT->tag_list(core_tag_tag::get_item_tags()).');
1639 * @deprecated since 3.1. Use core_tag_tag::get_item_tags() instead
1641 function tag_get_tags_ids() {
1642 throw new coding_exception('tag_get_tags_ids() can not be used anymore. Please consider using ' .
1643 'core_tag_tag::get_item_tags() or similar methods.');
1647 * @deprecated since 3.1. Use core_tag_tag::get_by_name() or core_tag_tag::get_by_name_bulk()
1649 function tag_get_id() {
1650 throw new coding_exception('tag_get_id() can not be used anymore. Please use ' .
1651 'core_tag_tag::get_by_name() or core_tag_tag::get_by_name_bulk()');
1655 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->update() instead
1657 function tag_rename() {
1658 throw new coding_exception('tag_rename() can not be used anymore. Please use ' .
1659 'core_tag_tag::get($tagid)->update()');
1663 * @deprecated since 3.1. Use core_tag_tag::remove_item_tag() instead
1665 function tag_delete_instance() {
1666 throw new coding_exception('tag_delete_instance() can not be used anymore. Please use ' .
1667 'core_tag_tag::remove_item_tag()');
1671 * @deprecated since 3.1. Use core_tag_tag::get_by_name()->get_tagged_items() instead
1673 function tag_find_records() {
1674 throw new coding_exception('tag_find_records() can not be used anymore. Please use ' .
1675 'core_tag_tag::get_by_name()->get_tagged_items()');
1679 * @deprecated since 3.1
1681 function tag_add() {
1682 throw new coding_exception('tag_add() can not be used anymore. You can use ' .
1683 'core_tag_tag::create_if_missing(), however it should not be necessary since tags are ' .
1684 'created automatically when assigned to items');
1688 * @deprecated since 3.1. Use core_tag_tag::set_item_tags() or core_tag_tag::add_item_tag() instead
1690 function tag_assign() {
1691 throw new coding_exception('tag_assign() can not be used anymore. Please use ' .
1692 'core_tag_tag::set_item_tags() or core_tag_tag::add_item_tag() instead. Tag instance ' .
1693 'ordering should not be set manually');
1697 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->count_tagged_items() instead
1699 function tag_record_count() {
1700 throw new coding_exception('tag_record_count() can not be used anymore. Please use ' .
1701 'core_tag_tag::get($tagid)->count_tagged_items().');
1705 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->is_item_tagged_with() instead
1707 function tag_record_tagged_with() {
1708 throw new coding_exception('tag_record_tagged_with() can not be used anymore. Please use ' .
1709 'core_tag_tag::get($tagid)->is_item_tagged_with().');
1713 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->flag() instead
1715 function tag_set_flag() {
1716 throw new coding_exception('tag_set_flag() can not be used anymore. Please use ' .
1717 'core_tag_tag::get($tagid)->flag()');
1721 * @deprecated since 3.1. Use core_tag_tag::get($tagid)->reset_flag() instead
1723 function tag_unset_flag() {
1724 throw new coding_exception('tag_unset_flag() can not be used anymore. Please use ' .
1725 'core_tag_tag::get($tagid)->reset_flag()');
1729 * @deprecated since 3.1
1731 function tag_print_cloud() {
1732 throw new coding_exception('tag_print_cloud() can not be used anymore. Please use ' .
1733 'core_tag_collection::get_tag_cloud(), templateable core_tag\output\tagcloud and ' .
1734 'template core_tag/tagcloud.');
1738 * @deprecated since 3.0
1740 function tag_autocomplete() {
1741 throw new coding_exception('tag_autocomplete() can not be used anymore. New form ' .
1742 'element "tags" does proper autocomplete.');
1746 * @deprecated since 3.1
1748 function tag_print_description_box() {
1749 throw new coding_exception('tag_print_description_box() can not be used anymore. ' .
1750 'See core_tag_renderer for similar code');
1754 * @deprecated since 3.1
1756 function tag_print_management_box() {
1757 throw new coding_exception('tag_print_management_box() can not be used anymore. ' .
1758 'See core_tag_renderer for similar code');
1762 * @deprecated since 3.1
1764 function tag_print_search_box() {
1765 throw new coding_exception('tag_print_search_box() can not be used anymore. ' .
1766 'See core_tag_renderer for similar code');
1770 * @deprecated since 3.1
1772 function tag_print_search_results() {
1773 throw new coding_exception('tag_print_search_results() can not be used anymore. ' .
1774 'In /tag/search.php the search results are printed using the core_tag/tagcloud template.');
1778 * @deprecated since 3.1
1780 function tag_print_tagged_users_table() {
1781 throw new coding_exception('tag_print_tagged_users_table() can not be used anymore. ' .
1782 'See core_user_renderer for similar code');
1786 * @deprecated since 3.1
1788 function tag_print_user_box() {
1789 throw new coding_exception('tag_print_user_box() can not be used anymore. ' .
1790 'See core_user_renderer for similar code');
1794 * @deprecated since 3.1
1796 function tag_print_user_list() {
1797 throw new coding_exception('tag_print_user_list() can not be used anymore. ' .
1798 'See core_user_renderer for similar code');
1802 * @deprecated since 3.1
1804 function tag_display_name() {
1805 throw new coding_exception('tag_display_name() can not be used anymore. Please use ' .
1806 'core_tag_tag::make_display_name().');
1811 * @deprecated since 3.1
1813 function tag_normalize() {
1814 throw new coding_exception('tag_normalize() can not be used anymore. Please use ' .
1815 'core_tag_tag::normalize().');
1819 * @deprecated since 3.1
1821 function tag_get_related_tags_csv() {
1822 throw new coding_exception('tag_get_related_tags_csv() can not be used anymore. Please ' .
1823 'consider looping through array or using $OUTPUT->tag_list(core_tag_tag::get_item_tags()).');
1827 * @deprecated since 3.1
1829 function tag_set() {
1830 throw new coding_exception('tag_set() can not be used anymore. Please use ' .
1831 'core_tag_tag::set_item_tags().');
1835 * @deprecated since 3.1
1837 function tag_set_add() {
1838 throw new coding_exception('tag_set_add() can not be used anymore. Please use ' .
1839 'core_tag_tag::add_item_tag().');
1843 * @deprecated since 3.1
1845 function tag_set_delete() {
1846 throw new coding_exception('tag_set_delete() can not be used anymore. Please use ' .
1847 'core_tag_tag::remove_item_tag().');
1851 * @deprecated since 3.1
1853 function tag_get() {
1854 throw new coding_exception('tag_get() can not be used anymore. Please use ' .
1855 'core_tag_tag::get() or core_tag_tag::get_by_name().');
1859 * @deprecated since 3.1
1861 function tag_get_related_tags() {
1862 throw new coding_exception('tag_get_related_tags() can not be used anymore. Please use ' .
1863 'core_tag_tag::get_correlated_tags(), core_tag_tag::get_related_tags() or ' .
1864 'core_tag_tag::get_manual_related_tags().');
1868 * @deprecated since 3.1
1870 function tag_delete() {
1871 throw new coding_exception('tag_delete() can not be used anymore. Please use ' .
1872 'core_tag_tag::delete_tags().');
1876 * @deprecated since 3.1
1878 function tag_delete_instances() {
1879 throw new coding_exception('tag_delete_instances() can not be used anymore. Please use ' .
1880 'core_tag_tag::delete_instances().');
1884 * @deprecated since 3.1
1886 function tag_cleanup() {
1887 throw new coding_exception('tag_cleanup() can not be used anymore. Please use ' .
1888 '\core\task\tag_cron_task::cleanup().');
1892 * @deprecated since 3.1
1894 function tag_bulk_delete_instances() {
1895 throw new coding_exception('tag_bulk_delete_instances() can not be used anymore. Please use ' .
1896 '\core\task\tag_cron_task::bulk_delete_instances().');
1901 * @deprecated since 3.1
1903 function tag_compute_correlations() {
1904 throw new coding_exception('tag_compute_correlations() can not be used anymore. Please use ' .
1905 'use \core\task\tag_cron_task::compute_correlations().');
1909 * @deprecated since 3.1
1911 function tag_process_computed_correlation() {
1912 throw new coding_exception('tag_process_computed_correlation() can not be used anymore. Please use ' .
1913 'use \core\task\tag_cron_task::process_computed_correlation().');
1917 * @deprecated since 3.1
1919 function tag_cron() {
1920 throw new coding_exception('tag_cron() can not be used anymore. Please use ' .
1921 'use \core\task\tag_cron_task::execute().');
1925 * @deprecated since 3.1
1927 function tag_find_tags() {
1928 throw new coding_exception('tag_find_tags() can not be used anymore.');
1932 * @deprecated since 3.1
1934 function tag_get_name() {
1935 throw new coding_exception('tag_get_name() can not be used anymore.');
1939 * @deprecated since 3.1
1941 function tag_get_correlated() {
1942 throw new coding_exception('tag_get_correlated() can not be used anymore. Please use ' .
1943 'use core_tag_tag::get_correlated_tags().');
1948 * @deprecated since 3.1
1950 function tag_cloud_sort() {
1951 throw new coding_exception('tag_cloud_sort() can not be used anymore. Similar method can ' .
1952 'be found in core_tag_collection::cloud_sort().');
1956 * @deprecated since Moodle 3.1
1958 function events_load_def() {
1959 throw new coding_exception('events_load_def() has been deprecated along with all Events 1 API in favour of Events 2 API.');
1964 * @deprecated since Moodle 3.1
1966 function events_queue_handler() {
1967 throw new coding_exception('events_queue_handler() has been deprecated along with all Events 1 API in favour of Events 2 API.');
1971 * @deprecated since Moodle 3.1
1973 function events_dispatch() {
1974 throw new coding_exception('events_dispatch() has been deprecated along with all Events 1 API in favour of Events 2 API.');
1978 * @deprecated since Moodle 3.1
1980 function events_process_queued_handler() {
1981 throw new coding_exception(
1982 'events_process_queued_handler() has been deprecated along with all Events 1 API in favour of Events 2 API.'
1987 * @deprecated since Moodle 3.1
1989 function events_update_definition() {
1990 throw new coding_exception(
1991 'events_update_definition has been deprecated along with all Events 1 API in favour of Events 2 API.'
1996 * @deprecated since Moodle 3.1
1998 function events_cron() {
1999 throw new coding_exception('events_cron() has been deprecated along with all Events 1 API in favour of Events 2 API.');
2003 * @deprecated since Moodle 3.1
2005 function events_trigger_legacy() {
2006 throw new coding_exception('events_trigger_legacy() has been deprecated along with all Events 1 API in favour of Events 2 API.');
2010 * @deprecated since Moodle 3.1
2012 function events_is_registered() {
2013 throw new coding_exception('events_is_registered() has been deprecated along with all Events 1 API in favour of Events 2 API.');
2017 * @deprecated since Moodle 3.1
2019 function events_pending_count() {
2020 throw new coding_exception('events_pending_count() has been deprecated along with all Events 1 API in favour of Events 2 API.');
2024 * @deprecated since Moodle 3.0 - this is a part of clamav plugin now.
2026 function clam_message_admins() {
2027 throw new coding_exception('clam_message_admins() can not be used anymore. Please use ' .
2028 'message_admins() method of \antivirus_clamav\scanner class.');
2032 * @deprecated since Moodle 3.0 - this is a part of clamav plugin now.
2034 function get_clam_error_code() {
2035 throw new coding_exception('get_clam_error_code() can not be used anymore. Please use ' .
2036 'get_clam_error_code() method of \antivirus_clamav\scanner class.');
2040 * @deprecated since 3.1
2042 function course_get_cm_rename_action() {
2043 throw new coding_exception('course_get_cm_rename_action() can not be used anymore. Please use ' .
2044 'inplace_editable https://docs.moodle.org/dev/Inplace_editable.');
2049 * @deprecated since Moodle 3.1
2051 function course_scale_used() {
2052 throw new coding_exception('course_scale_used() can not be used anymore. Plugins can ' .
2053 'implement <modname>_scale_used_anywhere, all implementations of <modname>_scale_used are now ignored');
2057 * @deprecated since Moodle 3.1
2059 function site_scale_used() {
2060 throw new coding_exception('site_scale_used() can not be used anymore. Plugins can implement ' .
2061 '<modname>_scale_used_anywhere, all implementations of <modname>_scale_used are now ignored');
2065 * @deprecated since Moodle 3.1. Use external_api::external_function_info().
2067 function external_function_info() {
2068 throw new coding_exception('external_function_info() can not be used any'.
2069 'more. Please use external_api::external_function_info() instead.');
2073 * @deprecated since Moodle 3.2
2074 * @see csv_import_reader::load_csv_content()
2076 function get_records_csv() {
2077 throw new coding_exception('get_records_csv() can not be used anymore. Please use ' .
2078 'lib/csvlib.class.php csv_import_reader() instead.');
2082 * @deprecated since Moodle 3.2
2083 * @see download_as_dataformat (lib/dataformatlib.php)
2085 function put_records_csv() {
2086 throw new coding_exception('put_records_csv() can not be used anymore. Please use ' .
2087 'lib/dataformatlib.php download_as_dataformat() instead.');
2091 * @deprecated since Moodle 3.2
2093 function css_is_colour() {
2094 throw new coding_exception('css_is_colour() can not be used anymore.');
2098 * @deprecated since Moodle 3.2
2100 function css_is_width() {
2101 throw new coding_exception('css_is_width() can not be used anymore.');
2105 * @deprecated since Moodle 3.2
2107 function css_sort_by_count() {
2108 throw new coding_exception('css_sort_by_count() can not be used anymore.');
2112 * @deprecated since Moodle 3.2
2114 function message_get_course_contexts() {
2115 throw new coding_exception('message_get_course_contexts() can not be used anymore.');
2119 * @deprecated since Moodle 3.2
2121 function message_remove_url_params() {
2122 throw new coding_exception('message_remove_url_params() can not be used anymore.');
2126 * @deprecated since Moodle 3.2
2128 function message_count_messages() {
2129 throw new coding_exception('message_count_messages() can not be used anymore.');
2133 * @deprecated since Moodle 3.2
2135 function message_count_blocked_users() {
2136 throw new coding_exception('message_count_blocked_users() can not be used anymore. Please use ' .
2137 '\core_message\api::count_blocked_users() instead.');
2141 * @deprecated since Moodle 3.2
2143 function message_contact_link() {
2144 throw new coding_exception('message_contact_link() can not be used anymore.');
2148 * @deprecated since Moodle 3.2
2150 function message_get_recent_notifications() {
2151 throw new coding_exception('message_get_recent_notifications() can not be used anymore.');
2155 * @deprecated since Moodle 3.2
2157 function message_history_link() {
2158 throw new coding_exception('message_history_link() can not be used anymore.');
2162 * @deprecated since Moodle 3.2
2164 function message_search() {
2165 throw new coding_exception('message_search() can not be used anymore.');
2169 * @deprecated since Moodle 3.2
2171 function message_shorten_message() {
2172 throw new coding_exception('message_shorten_message() can not be used anymore.');
2176 * @deprecated since Moodle 3.2
2178 function message_get_fragment() {
2179 throw new coding_exception('message_get_fragment() can not be used anymore.');
2183 * @deprecated since Moodle 3.2
2185 function message_get_history() {
2186 throw new coding_exception('message_get_history() can not be used anymore.');
2190 * @deprecated since Moodle 3.2
2192 function message_get_contact_add_remove_link() {
2193 throw new coding_exception('message_get_contact_add_remove_link() can not be used anymore.');
2197 * @deprecated since Moodle 3.2
2199 function message_get_contact_block_link() {
2200 throw new coding_exception('message_get_contact_block_link() can not be used anymore.');
2204 * @deprecated since Moodle 3.2
2206 function message_mark_messages_read() {
2207 throw new coding_exception('message_mark_messages_read() can not be used anymore. Please use ' .
2208 '\core_message\api::mark_all_messages_as_read() instead.');
2212 * @deprecated since Moodle 3.2
2214 function message_can_post_message() {
2215 throw new coding_exception('message_can_post_message() can not be used anymore. Please use ' .
2216 '\core_message\api::can_send_message() instead.');
2220 * @deprecated since Moodle 3.2
2222 function message_is_user_non_contact_blocked() {
2223 throw new coding_exception('message_is_user_non_contact_blocked() can not be used anymore. Please use ' .
2224 '\core_message\api::is_user_non_contact_blocked() instead.');
2228 * @deprecated since Moodle 3.2
2230 function message_is_user_blocked() {
2231 throw new coding_exception('message_is_user_blocked() can not be used anymore. Please use ' .
2232 '\core_message\api::is_user_blocked() instead.');
2236 * @deprecated since Moodle 3.2
2238 function print_log() {
2239 throw new coding_exception('print_log() can not be used anymore. Please use the ' .
2240 'report_log framework instead.');
2244 * @deprecated since Moodle 3.2
2246 function print_mnet_log() {
2247 throw new coding_exception('print_mnet_log() can not be used anymore. Please use the ' .
2248 'report_log framework instead.');
2252 * @deprecated since Moodle 3.2
2254 function print_log_csv() {
2255 throw new coding_exception('print_log_csv() can not be used anymore. Please use the ' .
2256 'report_log framework instead.');
2260 * @deprecated since Moodle 3.2
2262 function print_log_xls() {
2263 throw new coding_exception('print_log_xls() can not be used anymore. Please use the ' .
2264 'report_log framework instead.');
2268 * @deprecated since Moodle 3.2
2270 function print_log_ods() {
2271 throw new coding_exception('print_log_ods() can not be used anymore. Please use the ' .
2272 'report_log framework instead.');
2276 * @deprecated since Moodle 3.2
2278 function build_logs_array() {
2279 throw new coding_exception('build_logs_array() can not be used anymore. Please use the ' .
2280 'report_log framework instead.');
2284 * @deprecated since Moodle 3.2
2286 function get_logs_usercourse() {
2287 throw new coding_exception('get_logs_usercourse() can not be used anymore. Please use the ' .
2288 'report_log framework instead.');
2292 * @deprecated since Moodle 3.2
2294 function get_logs_userday() {
2295 throw new coding_exception('get_logs_userday() can not be used anymore. Please use the ' .
2296 'report_log framework instead.');
2300 * @deprecated since Moodle 3.2
2302 function get_logs() {
2303 throw new coding_exception('get_logs() can not be used anymore. Please use the ' .
2304 'report_log framework instead.');
2308 * @deprecated since Moodle 3.2
2310 function prevent_form_autofill_password() {
2311 throw new coding_exception('prevent_form_autofill_password() can not be used anymore.');
2315 * @deprecated since Moodle 3.3 MDL-57370
2317 function message_get_recent_conversations($userorid, $limitfrom = 0, $limitto = 100) {
2318 throw new coding_exception('message_get_recent_conversations() can not be used any more. ' .
2319 'Please use \core_message\api::get_conversations() instead.', DEBUG_DEVELOPER
);
2323 * @deprecated since Moodle 3.2
2325 function calendar_preferences_button() {
2326 throw new coding_exception('calendar_preferences_button() can not be used anymore. The calendar ' .
2327 'preferences are now linked to the user preferences page.');
2331 * @deprecated since 3.3
2333 function calendar_wday_name() {
2334 throw new coding_exception('Function calendar_wday_name() is removed and no longer used in core.');
2338 * @deprecated since 3.3
2340 function calendar_get_block_upcoming() {
2341 throw new coding_exception('Function calendar_get_block_upcoming() is removed,' .
2342 'Please see block_calendar_upcoming::get_content() for the correct API usage.');
2346 * @deprecated since 3.3
2348 function calendar_print_month_selector() {
2349 throw new coding_exception('Function calendar_print_month_selector() is removed and can no longer used in core.');
2353 * @deprecated since 3.3
2355 function calendar_cron() {
2356 throw new coding_exception('Function calendar_cron() is removed. Please use the core\task\calendar_cron_task instead.');
2360 * @deprecated since Moodle 3.4 and removed immediately. MDL-49398.
2362 function load_course_context() {
2363 throw new coding_exception('load_course_context() is removed. Do not use private functions or data structures.');
2367 * @deprecated since Moodle 3.4 and removed immediately. MDL-49398.
2369 function load_role_access_by_context() {
2370 throw new coding_exception('load_role_access_by_context() is removed. Do not use private functions or data structures.');
2374 * @deprecated since Moodle 3.4 and removed immediately. MDL-49398.
2376 function dedupe_user_access() {
2377 throw new coding_exception('dedupe_user_access() is removed. Do not use private functions or data structures.');
2381 * @deprecated since Moodle 3.4. MDL-49398.
2383 function get_user_access_sitewide() {
2384 throw new coding_exception('get_user_access_sitewide() is removed. Do not use private functions or data structures.');
2388 * @deprecated since Moodle 3.4. MDL-59333
2390 function calendar_get_mini() {
2391 throw new coding_exception('calendar_get_mini() has been removed. Please update your code to use calendar_get_view.');
2395 * @deprecated since Moodle 3.4. MDL-59333
2397 function calendar_get_upcoming() {
2398 throw new coding_exception('calendar_get_upcoming() has been removed. ' .
2399 'Please see block_calendar_upcoming::get_content() for the correct API usage.');
2403 * @deprecated since Moodle 3.4. MDL-50666
2405 function allow_override() {
2406 throw new coding_exception('allow_override() has been removed. Please update your code to use core_role_set_override_allowed.');
2410 * @deprecated since Moodle 3.4. MDL-50666
2412 function allow_assign() {
2413 throw new coding_exception('allow_assign() has been removed. Please update your code to use core_role_set_assign_allowed.');
2417 * @deprecated since Moodle 3.4. MDL-50666
2419 function allow_switch() {
2420 throw new coding_exception('allow_switch() has been removed. Please update your code to use core_role_set_switch_allowed.');
2424 * @deprecated since Moodle 3.5. MDL-61132
2426 function question_add_tops() {
2427 throw new coding_exception(
2428 'question_add_tops() has been removed. You may want to pass $top = true to get_categories_for_contexts().'
2433 * @deprecated since Moodle 3.5. MDL-61132
2435 function question_is_only_toplevel_category_in_context() {
2436 throw new coding_exception('question_is_only_toplevel_category_in_context() has been removed. '
2437 . 'Please update your code to use question_is_only_child_of_top_category_in_context() instead.');
2441 * @deprecated since Moodle 3.5
2443 function message_move_userfrom_unread2read() {
2444 throw new coding_exception('message_move_userfrom_unread2read() has been removed.');
2448 * @deprecated since Moodle 3.5
2450 function message_get_blocked_users() {
2451 throw new coding_exception(
2452 'message_get_blocked_users() has been removed, please use \core_message\api::get_blocked_users() instead.'
2457 * @deprecated since Moodle 3.5
2459 function message_get_contacts() {
2460 throw new coding_exception('message_get_contacts() has been removed.');
2464 * @deprecated since Moodle 3.5
2466 function message_mark_message_read() {
2467 throw new coding_exception('message_mark_message_read() has been removed, please use \core_message\api::mark_message_as_read()
2468 or \core_message\api::mark_notification_as_read().');
2472 * @deprecated since Moodle 3.5
2474 function message_can_delete_message() {
2475 throw new coding_exception(
2476 'message_can_delete_message() has been removed, please use \core_message\api::can_delete_message() instead.'
2481 * @deprecated since Moodle 3.5
2483 function message_delete_message() {
2484 throw new coding_exception(
2485 'message_delete_message() has been removed, please use \core_message\api::delete_message() instead.'
2490 * @deprecated since 3.6
2492 function calendar_get_all_allowed_types() {
2493 throw new coding_exception(
2494 'calendar_get_all_allowed_types() has been removed. Please use calendar_get_allowed_types() instead.'
2500 * @deprecated since Moodle 3.6.
2502 function groups_get_all_groups_for_courses() {
2503 throw new coding_exception(
2504 'groups_get_all_groups_for_courses() has been removed and can not be used anymore.'
2509 * @deprecated since Moodle 3.6. Please use the Events 2 API.
2511 function events_get_cached() {
2512 throw new coding_exception(
2513 'Events API using $handlers array has been removed in favour of Events 2 API, please use it instead.'
2518 * @deprecated since Moodle 3.6. Please use the Events 2 API.
2520 function events_uninstall() {
2521 throw new coding_exception(
2522 'Events API using $handlers array has been removed in favour of Events 2 API, please use it instead.'
2527 * @deprecated since Moodle 3.6. Please use the Events 2 API.
2529 function events_cleanup() {
2530 throw new coding_exception(
2531 'Events API using $handlers array has been removed in favour of Events 2 API, please use it instead.'
2536 * @deprecated since Moodle 3.6. Please use the Events 2 API.
2538 function events_dequeue() {
2539 throw new coding_exception(
2540 'Events API using $handlers array has been removed in favour of Events 2 API, please use it instead.'
2545 * @deprecated since Moodle 3.6. Please use the Events 2 API.
2547 function events_get_handlers() {
2548 throw new coding_exception(
2549 'Events API using $handlers array has been removed in favour of Events 2 API, please use it instead.'
2554 * @deprecated since Moodle 3.6. Please use the get_roles_used_in_context().
2556 function get_roles_on_exact_context() {
2557 throw new coding_exception(
2558 'get_roles_on_exact_context() has been removed, please use get_roles_used_in_context() instead.'
2563 * @deprecated since Moodle 3.6. Please use the get_roles_used_in_context().
2565 function get_roles_with_assignment_on_context() {
2566 throw new coding_exception(
2567 'get_roles_with_assignment_on_context() has been removed, please use get_roles_used_in_context() instead.'
2572 * @deprecated since Moodle 3.6
2574 function message_add_contact() {
2575 throw new coding_exception(
2576 'message_add_contact() has been removed. Please use \core_message\api::create_contact_request() instead. ' .
2577 'If you wish to block or unblock a user please use \core_message\api::is_blocked() and ' .
2578 '\core_message\api::block_user() or \core_message\api::unblock_user() respectively.'
2583 * @deprecated since Moodle 3.6
2585 function message_remove_contact() {
2586 throw new coding_exception(
2587 'message_remove_contact() has been removed. Please use \core_message\api::remove_contact() instead.'
2592 * @deprecated since Moodle 3.6
2594 function message_unblock_contact() {
2595 throw new coding_exception(
2596 'message_unblock_contact() has been removed. Please use \core_message\api::unblock_user() instead.'
2601 * @deprecated since Moodle 3.6
2603 function message_block_contact() {
2604 throw new coding_exception(
2605 'message_block_contact() has been removed. Please use \core_message\api::is_blocked() and ' .
2606 '\core_message\api::block_user() instead.'
2611 * @deprecated since Moodle 3.6
2613 function message_get_contact() {
2614 throw new coding_exception(
2615 'message_get_contact() has been removed. Please use \core_message\api::get_contact() instead.'
2620 * @deprecated since Moodle 3.7
2622 function get_courses_page() {
2623 throw new coding_exception(
2624 'Function get_courses_page() has been removed. Please use core_course_category::get_courses() ' .
2625 'or core_course_category::search_courses()'
2630 * @deprecated since Moodle 3.8
2632 function report_insights_context_insights(\context
$context) {
2633 throw new coding_exception(
2634 'Function report_insights_context_insights() ' .
2635 'has been removed. Please use \core_analytics\manager::cached_models_with_insights instead'
2640 * @deprecated since 3.9
2642 function get_module_metadata() {
2643 throw new coding_exception(
2644 'get_module_metadata() has been removed. Please use \core_course\local\service\content_item_service instead.');
2648 * @deprecated since Moodle 3.9 MDL-63580. Please use the \core\task\manager::run_from_cli($task).
2650 function cron_run_single_task() {
2651 throw new coding_exception(
2652 'cron_run_single_task() has been removed. Please use \\core\task\manager::run_from_cli() instead.'
2657 * @deprecated since Moodle 3.9 MDL-52846. Please use new task API.
2659 function cron_execute_plugin_type() {
2660 throw new coding_exception(
2661 'cron_execute_plugin_type() has been removed. Please, use the Task API instead: ' .
2662 'https://moodledev.io/docs/apis/subsystems/task.'
2667 * @deprecated since Moodle 3.9 MDL-52846. Please use new task API.
2669 function cron_bc_hack_plugin_functions() {
2670 throw new coding_exception(
2671 'cron_bc_hack_plugin_functions() has been removed. Please, use the Task API instead: ' .
2672 'https://moodledev.io/docs/apis/subsystems/task.'
2677 * @deprecated since Moodle 3.9 MDL-68612 - See \core_user\table\participants_search for an improved way to fetch participants.
2679 function user_get_participants_sql() {
2680 $deprecatedtext = __FUNCTION__
. '() has been removed. ' .
2681 'Please use \core\table\participants_search::class with table filtersets instead.';
2682 throw new coding_exception($deprecatedtext);
2686 * @deprecated since Moodle 3.9 MDL-68612 - See \core_user\table\participants_search for an improved way to fetch participants.
2688 function user_get_total_participants() {
2689 $deprecatedtext = __FUNCTION__
. '() has been removed. ' .
2690 'Please use \core\table\participants_search::class with table filtersets instead.';
2691 throw new coding_exception($deprecatedtext);
2695 * @deprecated since Moodle 3.9 MDL-68612 - See \core_user\table\participants_search for an improved way to fetch participants.
2697 function user_get_participants() {
2698 $deprecatedtext = __FUNCTION__
. '() has been removed. ' .
2699 'Please use \core\table\participants_search::class with table filtersets instead.';
2700 throw new coding_exception($deprecatedtext);
2704 * @deprecated Since Moodle 3.9. MDL-65835
2706 function plagiarism_save_form_elements() {
2707 throw new coding_exception(
2708 'Function plagiarism_save_form_elements() has been removed. ' .
2709 'Please use {plugin name}_coursemodule_edit_post_actions() instead.'
2714 * @deprecated Since Moodle 3.9. MDL-65835
2716 function plagiarism_get_form_elements_module() {
2717 throw new coding_exception(
2718 'Function plagiarism_get_form_elements_module() has been removed. ' .
2719 'Please use {plugin name}_coursemodule_standard_elements() instead.'
2725 * @deprecated since Moodle 3.10
2727 function make_categories_options() {
2728 throw new coding_exception(__FUNCTION__
. '() has been removed. ' .
2729 'Please use \core_course_category::make_categories_list() instead.');
2733 * @deprecated since 3.10
2735 function message_count_unread_messages() {
2736 throw new coding_exception('message_count_unread_messages has been removed.');
2740 * @deprecated since 3.10
2742 function serialise_tool_proxy() {
2743 throw new coding_exception('serialise_tool_proxy has been removed.');
2747 * @deprecated Since Moodle 3.11.
2749 function badges_check_backpack_accessibility() {
2750 throw new coding_exception('badges_check_backpack_accessibility() can not be used any more, it was only used for OBv1.0');
2754 * @deprecated Since Moodle 3.11.
2756 function badges_setup_backpack_js() {
2757 throw new coding_exception('badges_setup_backpack_js() can not be used any more, it was only used for OBv1.0');
2761 * @deprecated Since Moodle 3.11.
2763 function badges_local_backpack_js() {
2764 throw new coding_exception('badges_local_backpack_js() can not be used any more, it was only used for OBv1.0');
2768 * @deprecated since Moodle 3.11 MDL-45242
2770 function get_extra_user_fields() {
2771 throw new coding_exception('get_extra_user_fields() has been removed. Please use the \core_user\fields API instead.');
2775 * @deprecated since Moodle 3.11 MDL-45242
2777 function get_extra_user_fields_sql() {
2778 throw new coding_exception('get_extra_user_fields_sql() has been removed. Please use the \core_user\fields API instead.');
2782 * @deprecated since Moodle 3.11 MDL-45242
2784 function get_user_field_name() {
2785 throw new coding_exception('get_user_field_name() has been removed. Please use \core_user\fields::get_display_name() instead');
2789 * @deprecated since Moodle 3.11 MDL-45242
2791 function get_all_user_name_fields() {
2792 throw new coding_exception('get_all_user_name_fields() is deprecated. Please use the \core_user\fields API instead');
2796 * @deprecated since Moodle 3.11 MDL-71051
2798 function profile_display_fields() {
2799 throw new coding_exception(__FUNCTION__
. '() has been removed.');
2803 * @deprecated since Moodle 3.11 MDL-71051
2805 function profile_edit_category() {
2806 throw new coding_exception(__FUNCTION__
. '() has been removed.');
2810 * @deprecated since Moodle 3.11 MDL-71051
2812 function profile_edit_field() {
2813 throw new coding_exception(__FUNCTION__
. '() has been removed.');
2817 * Update a subscription from the form data in one of the rows in the existing subscriptions table.
2819 * @param int $subscriptionid The ID of the subscription we are acting upon.
2820 * @param int $pollinterval The poll interval to use.
2821 * @param int $action The action to be performed. One of update or remove.
2822 * @throws dml_exception if invalid subscriptionid is provided
2823 * @return string A log of the import progress, including errors
2824 * @deprecated since Moodle 4.0 MDL-71953
2826 function calendar_process_subscription_row($subscriptionid, $pollinterval, $action) {
2827 debugging('calendar_process_subscription_row() is deprecated.', DEBUG_DEVELOPER
);
2828 // Fetch the subscription from the database making sure it exists.
2829 $sub = calendar_get_subscription($subscriptionid);
2831 // Update or remove the subscription, based on action.
2833 case CALENDAR_SUBSCRIPTION_UPDATE
:
2834 // Skip updating file subscriptions.
2835 if (empty($sub->url
)) {
2838 $sub->pollinterval
= $pollinterval;
2839 calendar_update_subscription($sub);
2841 // Update the events.
2842 return "<p>" . get_string('subscriptionupdated', 'calendar', $sub->name
) . "</p>" .
2843 calendar_update_subscription_events($subscriptionid);
2844 case CALENDAR_SUBSCRIPTION_REMOVE
:
2845 calendar_delete_subscription($subscriptionid);
2846 return get_string('subscriptionremoved', 'calendar', $sub->name
);
2855 * Import events from an iCalendar object into a course calendar.
2857 * @param iCalendar $ical The iCalendar object.
2858 * @param int $unused Deprecated
2859 * @param int $subscriptionid The subscription ID.
2860 * @return string A log of the import progress, including errors.
2862 function calendar_import_icalendar_events($ical, $unused = null, $subscriptionid = null) {
2863 debugging('calendar_import_icalendar_events() is deprecated. Please use calendar_import_events_from_ical() instead.',
2872 // Large calendars take a while...
2874 \core_php_time_limit
::raise(300);
2877 // Grab the timezone from the iCalendar file to be used later.
2878 if (isset($ical->properties
['X-WR-TIMEZONE'][0]->value
)) {
2879 $timezone = $ical->properties
['X-WR-TIMEZONE'][0]->value
;
2885 foreach ($ical->components
['VEVENT'] as $event) {
2886 $icaluuids[] = $event->properties
['UID'][0]->value
;
2887 $res = calendar_add_icalendar_event($event, null, $subscriptionid, $timezone);
2889 case CALENDAR_IMPORT_EVENT_UPDATED
:
2892 case CALENDAR_IMPORT_EVENT_INSERTED
:
2895 case CALENDAR_IMPORT_EVENT_SKIPPED
:
2899 $return .= '<p>' . get_string('erroraddingevent', 'calendar') . ': ';
2900 if (empty($event->properties
['SUMMARY'])) {
2901 $return .= '(' . get_string('notitle', 'calendar') . ')';
2903 $return .= $event->properties
['SUMMARY'][0]->value
;
2905 $return .= "</p>\n";
2910 $return .= html_writer
::start_tag('ul');
2911 $existing = $DB->get_field('event_subscriptions', 'lastupdated', ['id' => $subscriptionid]);
2912 if (!empty($existing)) {
2913 $eventsuuids = $DB->get_records_menu('event', ['subscriptionid' => $subscriptionid], '', 'id, uuid');
2915 $icaleventscount = count($icaluuids);
2917 if (count($eventsuuids) > $icaleventscount) {
2918 foreach ($eventsuuids as $eventid => $eventuuid) {
2919 if (!in_array($eventuuid, $icaluuids)) {
2920 $tobedeleted[] = $eventid;
2923 if (!empty($tobedeleted)) {
2924 $DB->delete_records_list('event', 'id', $tobedeleted);
2925 $return .= html_writer
::tag('li', get_string('eventsdeleted', 'calendar', count($tobedeleted)));
2930 $return .= html_writer
::tag('li', get_string('eventsimported', 'calendar', $eventcount));
2931 $return .= html_writer
::tag('li', get_string('eventsskipped', 'calendar', $skippedcount));
2932 $return .= html_writer
::tag('li', get_string('eventsupdated', 'calendar', $updatecount));
2933 $return .= html_writer
::end_tag('ul');
2938 * Print grading plugin selection tab-based navigation.
2940 * @deprecated since Moodle 4.0. Tabs navigation has been replaced with tertiary navigation.
2941 * @param string $active_type type of plugin on current page - import, export, report or edit
2942 * @param string $active_plugin active plugin type - grader, user, cvs, ...
2943 * @param array $plugin_info Array of plugins
2944 * @param boolean $return return as string
2946 * @return nothing or string if $return true
2948 function grade_print_tabs($active_type, $active_plugin, $plugin_info, $return=false) {
2949 global $CFG, $COURSE;
2951 debugging('grade_print_tabs() has been deprecated. Tabs navigation has been replaced with tertiary navigation.',
2954 if (!isset($currenttab)) { //TODO: this is weird
2960 $bottom_row = array();
2961 $inactive = array($active_plugin);
2962 $activated = array($active_type);
2967 foreach ($plugin_info as $plugin_type => $plugins) {
2968 if ($plugin_type == 'strings') {
2972 // If $plugins is actually the definition of a child-less parent link:
2973 if (!empty($plugins->id
)) {
2974 $string = $plugins->string;
2975 if (!empty($plugin_info[$active_type]->parent
)) {
2976 $string = $plugin_info[$active_type]->parent
->string;
2979 $top_row[] = new tabobject($plugin_type, $plugins->link
, $string);
2983 $first_plugin = reset($plugins);
2984 $url = $first_plugin->link
;
2986 if ($plugin_type == 'report') {
2987 $url = $CFG->wwwroot
.'/grade/report/index.php?id='.$COURSE->id
;
2990 $top_row[] = new tabobject($plugin_type, $url, $plugin_info['strings'][$plugin_type]);
2992 if ($active_type == $plugin_type) {
2993 foreach ($plugins as $plugin) {
2994 $bottom_row[] = new tabobject($plugin->id
, $plugin->link
, $plugin->string);
2995 if ($plugin->id
== $active_plugin) {
2996 $inactive = array($plugin->id
);
3002 // Do not display rows that contain only one item, they are not helpful.
3003 if (count($top_row) > 1) {
3006 if (count($bottom_row) > 1) {
3007 $tabs[] = $bottom_row;
3013 $rv = html_writer
::div(print_tabs($tabs, $active_plugin, $inactive, $activated, true), 'grade-navigation');
3023 * Print grading plugin selection popup form.
3025 * @deprecated since Moodle 4.0. Dropdown box navigation has been replaced with tertiary navigation.
3026 * @param array $plugin_info An array of plugins containing information for the selector
3027 * @param boolean $return return as string
3029 * @return nothing or string if $return true
3031 function print_grade_plugin_selector($plugin_info, $active_type, $active_plugin, $return=false) {
3032 global $CFG, $OUTPUT, $PAGE;
3034 debugging('print_grade_plugin_selector() has been deprecated. Dropdown box navigation has been replaced ' .
3035 'with tertiary navigation.', DEBUG_DEVELOPER
);
3041 foreach ($plugin_info as $plugin_type => $plugins) {
3042 if ($plugin_type == 'strings') {
3046 $first_plugin = reset($plugins);
3048 $sectionname = $plugin_info['strings'][$plugin_type];
3051 foreach ($plugins as $plugin) {
3052 $link = $plugin->link
->out(false);
3053 $section[$link] = $plugin->string;
3055 if ($plugin_type === $active_type and $plugin->id
=== $active_plugin) {
3061 $menu[] = array($sectionname=>$section);
3065 // finally print/return the popup form
3067 $select = new url_select($menu, $active, null, 'choosepluginreport');
3068 $select->set_label(get_string('gradereport', 'grades'), array('class' => 'accesshide'));
3070 return $OUTPUT->render($select);
3072 echo $OUTPUT->render($select);
3075 // only one option - no plugin selector needed
3080 * Purge the cache of a course section.
3082 * $sectioninfo must have following attributes:
3083 * - course: course id
3084 * - section: section number
3086 * @param object $sectioninfo section info
3088 * @deprecated since Moodle 4.0. Please use {@link course_modinfo::purge_course_section_cache_by_id()}
3089 * or {@link course_modinfo::purge_course_section_cache_by_number()} instead.
3091 function course_purge_section_cache(object $sectioninfo): void
{
3092 debugging(__FUNCTION__
. '() is deprecated. ' .
3093 'Please use course_modinfo::purge_course_section_cache_by_id() ' .
3094 'or course_modinfo::purge_course_section_cache_by_number() instead.',
3096 $sectionid = $sectioninfo->section
;
3097 $courseid = $sectioninfo->course
;
3098 course_modinfo
::purge_course_section_cache_by_id($courseid, $sectionid);
3102 * Purge the cache of a course module.
3104 * $cm must have following attributes:
3106 * - course: course id
3108 * @param cm_info|stdClass $cm course module
3110 * @deprecated since Moodle 4.0. Please use {@link course_modinfo::purge_course_module_cache()} instead.
3112 function course_purge_module_cache($cm): void
{
3113 debugging(__FUNCTION__
. '() is deprecated. ' . 'Please use course_modinfo::purge_course_module_cache() instead.',
3116 $courseid = $cm->course
;
3117 course_modinfo
::purge_course_module_cache($courseid, $cmid);
3122 * For a given course, returns an array of course activity objects
3123 * Each item in the array contains he following properties:
3125 * @param int $courseid course id
3126 * @param bool $usecache get activities from cache if modinfo exists when $usecache is true
3127 * @return array list of activities
3128 * @deprecated since Moodle 4.0. Please use {@link course_modinfo::get_array_of_activities()} instead.
3130 function get_array_of_activities(int $courseid, bool $usecache = false): array {
3131 debugging(__FUNCTION__
. '() is deprecated. ' . 'Please use course_modinfo::get_array_of_activities() instead.',
3133 return course_modinfo
::get_array_of_activities(get_course($courseid), $usecache);
3137 * Abort execution by throwing of a general exception,
3138 * default exception handler displays the error message in most cases.
3140 * @deprecated since Moodle 4.1
3141 * @todo MDL-74484 Final deprecation in Moodle 4.5.
3142 * @param string $errorcode The name of the language string containing the error message.
3143 * Normally this should be in the error.php lang file.
3144 * @param string $module The language file to get the error message from.
3145 * @param string $link The url where the user will be prompted to continue.
3146 * If no url is provided the user will be directed to the site index page.
3147 * @param object $a Extra words and phrases that might be required in the error string
3148 * @param string $debuginfo optional debugging information
3149 * @return void, always throws exception!
3151 function print_error($errorcode, $module = 'error', $link = '', $a = null, $debuginfo = null) {
3152 debugging("The function print_error() is deprecated. " .
3153 "Please throw a new moodle_exception instance instead.", DEBUG_DEVELOPER
);
3154 throw new \
moodle_exception($errorcode, $module, $link, $a, $debuginfo);
3158 * Execute cron tasks
3160 * @param int|null $keepalive The keepalive time for this cron run.
3161 * @deprecated since 4.2 Use \core\cron::run_main_process() instead.
3163 function cron_run(?
int $keepalive = null): void
{
3165 'The cron_run() function is deprecated. Please use \core\cron::run_main_process() instead.',
3168 \core\cron
::run_main_process($keepalive);
3172 * Execute all queued scheduled tasks, applying necessary concurrency limits and time limits.
3174 * @param int $timenow The time this process started.
3175 * @deprecated since 4.2 Use \core\cron::run_scheduled_tasks() instead.
3177 function cron_run_scheduled_tasks(int $timenow) {
3179 'The cron_run_scheduled_tasks() function is deprecated. Please use \core\cron::run_scheduled_tasks() instead.',
3182 \core\cron
::run_scheduled_tasks($timenow);
3186 * Execute all queued adhoc tasks, applying necessary concurrency limits and time limits.
3188 * @param int $timenow The time this process started.
3189 * @param int $keepalive Keep this function alive for N seconds and poll for new adhoc tasks.
3190 * @param bool $checklimits Should we check limits?
3191 * @deprecated since 4.2 Use \core\cron::run_adhoc_tasks() instead.
3193 function cron_run_adhoc_tasks(int $timenow, $keepalive = 0, $checklimits = true) {
3195 'The cron_run_adhoc_tasks() function is deprecated. Please use \core\cron::run_adhoc_tasks() instead.',
3198 \core\cron
::run_adhoc_tasks($timenow, $keepalive, $checklimits);
3202 * Shared code that handles running of a single scheduled task within the cron.
3204 * Not intended for calling directly outside of this library!
3206 * @param \core\task\task_base $task
3207 * @deprecated since 4.2 Use \core\cron::run_inner_scheduled_task() instead.
3209 function cron_run_inner_scheduled_task(\core\task\task_base
$task) {
3211 'The cron_run_inner_scheduled_task() function is deprecated. Please use \core\cron::run_inner_scheduled_task() instead.',
3214 \core\cron
::run_inner_scheduled_task($task);
3218 * Shared code that handles running of a single adhoc task within the cron.
3220 * @param \core\task\adhoc_task $task
3221 * @deprecated since 4.2 Use \core\cron::run_inner_adhoc_task() instead.
3223 function cron_run_inner_adhoc_task(\core\task\adhoc_task
$task) {
3225 'The cron_run_inner_adhoc_task() function is deprecated. Please use \core\cron::run_inner_adhoc_task() instead.',
3228 \core\cron
::run_inner_adhoc_task($task);
3232 * Sets the process title
3234 * This makes it very easy for a sysadmin to immediately see what task
3235 * a cron process is running at any given moment.
3237 * @param string $title process status title
3238 * @deprecated since 4.2 Use \core\cron::set_process_title() instead.
3240 function cron_set_process_title(string $title) {
3242 'The cron_set_process_title() function is deprecated. Please use \core\cron::set_process_title() instead.',
3245 \core\cron
::set_process_title($title);
3249 * Output some standard information during cron runs. Specifically current time
3250 * and memory usage. This method also does gc_collect_cycles() (before displaying
3251 * memory usage) to try to help PHP manage memory better.
3253 * @deprecated since 4.2 Use \core\cron::trace_time_and_memory() instead.
3255 function cron_trace_time_and_memory() {
3257 'The cron_trace_time_and_memory() function is deprecated. Please use \core\cron::trace_time_and_memory() instead.',
3260 \core\cron
::trace_time_and_memory();
3264 * Prepare the output renderer for the cron run.
3266 * This involves creating a new $PAGE, and $OUTPUT fresh for each task and prevents any one task from influencing
3269 * @param bool $restore Whether to restore the original PAGE and OUTPUT
3270 * @deprecated since 4.2 Use \core\cron::prepare_core_renderer() instead.
3272 function cron_prepare_core_renderer($restore = false) {
3274 'The cron_prepare_core_renderer() function is deprecated. Please use \core\cron::prepare_core_renderer() instead.',
3277 \core\cron
::prepare_core_renderer($restore);
3281 * Sets up current user and course environment (lang, etc.) in cron.
3282 * Do not use outside of cron script!
3284 * @param stdClass $user full user object, null means default cron user (admin),
3285 * value 'reset' means reset internal static caches.
3286 * @param stdClass $course full course record, null means $SITE
3287 * @param bool $leavepagealone If specified, stops it messing with global page object
3288 * @deprecated since 4.2. Use \core\core::setup_user() instead.
3291 function cron_setup_user($user = null, $course = null, $leavepagealone = false) {
3293 'The cron_setup_user() function is deprecated. ' .
3294 'Please use \core\cron::setup_user() and reset_user_cache() as appropriate instead.',
3298 if ($user === 'reset') {
3299 \core\cron
::reset_user_cache();
3303 \core\cron
::setup_user($user, $course, $leavepagealone);
3307 * Get OAuth2 services for the external backpack.
3310 * @throws coding_exception
3311 * @deprecated since 4.3.
3313 function badges_get_oauth2_service_options() {
3315 'badges_get_oauth2_service_options() is deprecated. Don\'t use it.',
3320 $issuers = core\oauth2\api
::get_all_issuers();
3321 $options = ['' => 'None'];
3322 foreach ($issuers as $issuer) {
3323 $options[$issuer->get('id')] = $issuer->get('name');
3330 * Checks if the given device has a theme defined in config.php.
3332 * @param string $device The device
3333 * @deprecated since 4.3.
3336 function theme_is_device_locked($device) {
3338 __FUNCTION__
. '() is deprecated.' .
3339 'All functions associated with device specific themes are being removed.',
3343 $themeconfigname = core_useragent
::get_device_type_cfg_var_name($device);
3344 return isset($CFG->config_php_settings
[$themeconfigname]);
3348 * Returns the theme named defined in config.php for the given device.
3350 * @param string $device The device
3351 * @deprecated since 4.3.
3352 * @return string or null
3354 function theme_get_locked_theme_for_device($device) {
3356 __FUNCTION__
. '() is deprecated.' .
3357 'All functions associated with device specific themes are being removed.',
3362 if (!theme_is_device_locked($device)) {
3366 $themeconfigname = core_useragent
::get_device_type_cfg_var_name($device);
3367 return $CFG->config_php_settings
[$themeconfigname];
3371 * Try to generate cryptographically secure pseudo-random bytes.
3373 * Note this is achieved by fallbacking between:
3374 * - PHP 7 random_bytes().
3375 * - OpenSSL openssl_random_pseudo_bytes().
3376 * - In house random generator getting its entropy from various, hard to guess, pseudo-random sources.
3378 * @param int $length requested length in bytes
3379 * @deprecated since 4.3.
3380 * @return string binary data
3382 function random_bytes_emulate($length) {
3384 __FUNCTION__
. '() is deprecated.' .
3385 'Please use random_bytes instead.',
3388 return random_bytes($length);