on-demand release 4.5dev+
[moodle.git] / lib / deprecatedlib.php
blobb55e87cf00ff7798b09308f052f6b53aa960cb45
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * deprecatedlib.php - Old functions retained only for backward compatibility
20 * Old functions retained only for backward compatibility. New code should not
21 * use any of these functions.
23 * @package core
24 * @subpackage deprecated
25 * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
26 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 * @deprecated
30 defined('MOODLE_INTERNAL') || die();
32 /**
33 * List all core subsystems and their location
35 * This is a list of components that are part of the core and their
36 * language strings are defined in /lang/en/<<subsystem>>.php. If a given
37 * plugin is not listed here and it does not have proper plugintype prefix,
38 * then it is considered as course activity module.
40 * The location is optionally dirroot relative path. NULL means there is no special
41 * directory for this subsystem. If the location is set, the subsystem's
42 * renderer.php is expected to be there.
44 * @deprecated since 2.6, use core_component::get_core_subsystems()
45 * @param bool $fullpaths false means relative paths from dirroot, use true for performance reasons
46 * @return array of (string)name => (string|null)location
48 #[\core\attribute\deprecated('core_component::get_core_subsystems', since: '4.5', mdl: 'MDL-82287')]
49 function get_core_subsystems($fullpaths = false) {
50 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
51 global $CFG;
53 $subsystems = core_component::get_core_subsystems();
55 if ($fullpaths) {
56 return $subsystems;
59 debugging('Short paths are deprecated when using get_core_subsystems(), please fix the code to use fullpaths instead.', DEBUG_DEVELOPER);
61 $dlength = strlen($CFG->dirroot);
63 foreach ($subsystems as $k => $v) {
64 if ($v === null) {
65 continue;
67 $subsystems[$k] = substr($v, $dlength+1);
70 return $subsystems;
73 /**
74 * Lists all plugin types.
76 * @deprecated since 2.6, use core_component::get_plugin_types()
77 * @param bool $fullpaths false means relative paths from dirroot
78 * @return array Array of strings - name=>location
80 #[\core\attribute\deprecated('core_component::get_plugin_types', since: '4.5', mdl: 'MDL-82287')]
81 function get_plugin_types($fullpaths = true) {
82 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
83 global $CFG;
85 $types = core_component::get_plugin_types();
87 if ($fullpaths) {
88 return $types;
91 debugging('Short paths are deprecated when using get_plugin_types(), please fix the code to use fullpaths instead.', DEBUG_DEVELOPER);
93 $dlength = strlen($CFG->dirroot);
95 foreach ($types as $k => $v) {
96 if ($k === 'theme') {
97 $types[$k] = 'theme';
98 continue;
100 $types[$k] = substr($v, $dlength+1);
103 return $types;
107 * Use when listing real plugins of one type.
109 * @deprecated since 2.6, use core_component::get_plugin_list()
110 * @param string $plugintype type of plugin
111 * @return array name=>fulllocation pairs of plugins of given type
113 #[\core\attribute\deprecated('core_component::get_plugin_list', since: '4.5', mdl: 'MDL-82287')]
114 function get_plugin_list($plugintype) {
115 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
117 if ($plugintype === '') {
118 $plugintype = 'mod';
121 return core_component::get_plugin_list($plugintype);
125 * Get a list of all the plugins of a given type that define a certain class
126 * in a certain file. The plugin component names and class names are returned.
128 * @deprecated since 2.6, use core_component::get_plugin_list_with_class()
129 * @param string $plugintype the type of plugin, e.g. 'mod' or 'report'.
130 * @param string $class the part of the name of the class after the
131 * frankenstyle prefix. e.g 'thing' if you are looking for classes with
132 * names like report_courselist_thing. If you are looking for classes with
133 * the same name as the plugin name (e.g. qtype_multichoice) then pass ''.
134 * @param string $file the name of file within the plugin that defines the class.
135 * @return array with frankenstyle plugin names as keys (e.g. 'report_courselist', 'mod_forum')
136 * and the class names as values (e.g. 'report_courselist_thing', 'qtype_multichoice').
138 #[\core\attribute\deprecated('core_component::get_plugin_list_with_class', since: '4.5', mdl: 'MDL-82287')]
139 function get_plugin_list_with_class($plugintype, $class, $file) {
140 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
141 return core_component::get_plugin_list_with_class($plugintype, $class, $file);
145 * Returns the exact absolute path to plugin directory.
147 * @deprecated since 2.6, use core_component::get_plugin_directory()
148 * @param string $plugintype type of plugin
149 * @param string $name name of the plugin
150 * @return string full path to plugin directory; NULL if not found
152 #[\core\attribute\deprecated('core_component::get_plugin_directory', since: '4.5', mdl: 'MDL-82287')]
153 function get_plugin_directory($plugintype, $name) {
154 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
155 if ($plugintype === '') {
156 $plugintype = 'mod';
159 return core_component::get_plugin_directory($plugintype, $name);
163 * Normalize the component name using the "frankenstyle" names.
165 * @deprecated since 2.6, use core_component::normalize_component()
166 * @param string $component
167 * @return array two-items list of [(string)type, (string|null)name]
169 #[\core\attribute\deprecated('core_component::normalize_component', since: '4.5', mdl: 'MDL-82287')]
170 function normalize_component($component) {
171 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
172 return core_component::normalize_component($component);
176 * Return exact absolute path to a plugin directory.
178 * @deprecated since 2.6, use core_component::normalize_component()
180 * @param string $component name such as 'moodle', 'mod_forum'
181 * @return string full path to component directory; NULL if not found
183 #[\core\attribute\deprecated('core_component::get_component_directory', since: '4.5', mdl: 'MDL-82287')]
184 function get_component_directory($component) {
185 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
186 return core_component::get_component_directory($component);
190 * @deprecated since 2.2, use context_course::instance() or other relevant class instead
192 #[\core\attribute\deprecated('\core\context::instance', since: '2.2', mdl: 'MDL-34472', final: true)]
193 function get_context_instance() {
194 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
198 * @deprecated since 2.5 - do not use, the textrotate.js will work it out automatically
200 #[\core\attribute\deprecated('Not replaced', since: '2.0', mdl: 'MDL-19756', final: true)]
201 function can_use_rotated_text() {
202 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
206 * @deprecated since 2.2
208 #[\core\attribute\deprecated('\core\context\system::instance', since: '2.2', mdl: 'MDL-34472', final: true)]
209 function get_system_context() {
210 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
214 * Returns an image of an up or down arrow, used for column sorting. To avoid unnecessary DB accesses, please
215 * provide this function with the language strings for sortasc and sortdesc.
217 * @deprecated use $OUTPUT->arrow() instead.
219 #[\core\attribute\deprecated('OUTPUT->[l|r]arrow', since: '2.0', mdl: 'MDL-19756', final: true)]
220 function print_arrow() {
221 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
225 * @deprecated since Moodle 4.0
227 #[\core\attribute\deprecated('category_action_bar tertiary navigation', since: '4.0', mdl: 'MDL-73462', final: true)]
228 function print_course_request_buttons() {
229 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
233 * Execute cron tasks
235 * @param int|null $keepalive The keepalive time for this cron run.
236 * @deprecated since 4.2 Use \core\cron::run_main_process() instead.
238 function cron_run(?int $keepalive = null): void {
239 debugging(
240 'The cron_run() function is deprecated. Please use \core\cron::run_main_process() instead.',
241 DEBUG_DEVELOPER
243 \core\cron::run_main_process($keepalive);
247 * Execute all queued scheduled tasks, applying necessary concurrency limits and time limits.
249 * @param int $timenow The time this process started.
250 * @deprecated since 4.2 Use \core\cron::run_scheduled_tasks() instead.
252 function cron_run_scheduled_tasks(int $timenow) {
253 debugging(
254 'The cron_run_scheduled_tasks() function is deprecated. Please use \core\cron::run_scheduled_tasks() instead.',
255 DEBUG_DEVELOPER
257 \core\cron::run_scheduled_tasks($timenow);
261 * Execute all queued adhoc tasks, applying necessary concurrency limits and time limits.
263 * @param int $timenow The time this process started.
264 * @param int $keepalive Keep this function alive for N seconds and poll for new adhoc tasks.
265 * @param bool $checklimits Should we check limits?
266 * @deprecated since 4.2 Use \core\cron::run_adhoc_tasks() instead.
268 function cron_run_adhoc_tasks(int $timenow, $keepalive = 0, $checklimits = true) {
269 debugging(
270 'The cron_run_adhoc_tasks() function is deprecated. Please use \core\cron::run_adhoc_tasks() instead.',
271 DEBUG_DEVELOPER
273 \core\cron::run_adhoc_tasks($timenow, $keepalive, $checklimits);
277 * Shared code that handles running of a single scheduled task within the cron.
279 * Not intended for calling directly outside of this library!
281 * @param \core\task\task_base $task
282 * @deprecated since 4.2 Use \core\cron::run_inner_scheduled_task() instead.
284 function cron_run_inner_scheduled_task(\core\task\task_base $task) {
285 debugging(
286 'The cron_run_inner_scheduled_task() function is deprecated. Please use \core\cron::run_inner_scheduled_task() instead.',
287 DEBUG_DEVELOPER
289 \core\cron::run_inner_scheduled_task($task);
293 * Shared code that handles running of a single adhoc task within the cron.
295 * @param \core\task\adhoc_task $task
296 * @deprecated since 4.2 Use \core\cron::run_inner_adhoc_task() instead.
298 function cron_run_inner_adhoc_task(\core\task\adhoc_task $task) {
299 debugging(
300 'The cron_run_inner_adhoc_task() function is deprecated. Please use \core\cron::run_inner_adhoc_task() instead.',
301 DEBUG_DEVELOPER
303 \core\cron::run_inner_adhoc_task($task);
307 * Sets the process title
309 * This makes it very easy for a sysadmin to immediately see what task
310 * a cron process is running at any given moment.
312 * @param string $title process status title
313 * @deprecated since 4.2 Use \core\cron::set_process_title() instead.
315 function cron_set_process_title(string $title) {
316 debugging(
317 'The cron_set_process_title() function is deprecated. Please use \core\cron::set_process_title() instead.',
318 DEBUG_DEVELOPER
320 \core\cron::set_process_title($title);
324 * Output some standard information during cron runs. Specifically current time
325 * and memory usage. This method also does gc_collect_cycles() (before displaying
326 * memory usage) to try to help PHP manage memory better.
328 * @deprecated since 4.2 Use \core\cron::trace_time_and_memory() instead.
330 function cron_trace_time_and_memory() {
331 debugging(
332 'The cron_trace_time_and_memory() function is deprecated. Please use \core\cron::trace_time_and_memory() instead.',
333 DEBUG_DEVELOPER
335 \core\cron::trace_time_and_memory();
339 * Prepare the output renderer for the cron run.
341 * This involves creating a new $PAGE, and $OUTPUT fresh for each task and prevents any one task from influencing
342 * any other.
344 * @param bool $restore Whether to restore the original PAGE and OUTPUT
345 * @deprecated since 4.2 Use \core\cron::prepare_core_renderer() instead.
347 function cron_prepare_core_renderer($restore = false) {
348 debugging(
349 'The cron_prepare_core_renderer() function is deprecated. Please use \core\cron::prepare_core_renderer() instead.',
350 DEBUG_DEVELOPER
352 \core\cron::prepare_core_renderer($restore);
356 * Sets up current user and course environment (lang, etc.) in cron.
357 * Do not use outside of cron script!
359 * @param stdClass $user full user object, null means default cron user (admin),
360 * value 'reset' means reset internal static caches.
361 * @param stdClass $course full course record, null means $SITE
362 * @param bool $leavepagealone If specified, stops it messing with global page object
363 * @deprecated since 4.2. Use \core\core::setup_user() instead.
364 * @return void
366 function cron_setup_user($user = null, $course = null, $leavepagealone = false) {
367 debugging(
368 'The cron_setup_user() function is deprecated. ' .
369 'Please use \core\cron::setup_user() and reset_user_cache() as appropriate instead.',
370 DEBUG_DEVELOPER
373 if ($user === 'reset') {
374 \core\cron::reset_user_cache();
375 return;
378 \core\cron::setup_user($user, $course, $leavepagealone);
382 * Get OAuth2 services for the external backpack.
384 * @return array
385 * @throws coding_exception
386 * @deprecated since 4.3.
388 function badges_get_oauth2_service_options() {
389 debugging(
390 'badges_get_oauth2_service_options() is deprecated. Don\'t use it.',
391 DEBUG_DEVELOPER
393 global $DB;
395 $issuers = core\oauth2\api::get_all_issuers();
396 $options = ['' => 'None'];
397 foreach ($issuers as $issuer) {
398 $options[$issuer->get('id')] = $issuer->get('name');
401 return $options;
405 * Checks if the given device has a theme defined in config.php.
407 * @param string $device The device
408 * @deprecated since 4.3.
409 * @return bool
411 function theme_is_device_locked($device) {
412 debugging(
413 __FUNCTION__ . '() is deprecated.' .
414 'All functions associated with device specific themes are being removed.',
415 DEBUG_DEVELOPER
417 global $CFG;
418 $themeconfigname = core_useragent::get_device_type_cfg_var_name($device);
419 return isset($CFG->config_php_settings[$themeconfigname]);
423 * Returns the theme named defined in config.php for the given device.
425 * @param string $device The device
426 * @deprecated since 4.3.
427 * @return string or null
429 function theme_get_locked_theme_for_device($device) {
430 debugging(
431 __FUNCTION__ . '() is deprecated.' .
432 'All functions associated with device specific themes are being removed.',
433 DEBUG_DEVELOPER
435 global $CFG;
437 if (!theme_is_device_locked($device)) {
438 return null;
441 $themeconfigname = core_useragent::get_device_type_cfg_var_name($device);
442 return $CFG->config_php_settings[$themeconfigname];
446 * Try to generate cryptographically secure pseudo-random bytes.
448 * Note this is achieved by fallbacking between:
449 * - PHP 7 random_bytes().
450 * - OpenSSL openssl_random_pseudo_bytes().
451 * - In house random generator getting its entropy from various, hard to guess, pseudo-random sources.
453 * @param int $length requested length in bytes
454 * @deprecated since 4.3.
455 * @return string binary data
457 function random_bytes_emulate($length) {
458 debugging(
459 __FUNCTION__ . '() is deprecated.' .
460 'Please use random_bytes instead.',
461 DEBUG_DEVELOPER
463 return random_bytes($length);
467 * rc4encrypt
469 * @param string $data Data to encrypt.
470 * @return string The now encrypted data.
472 * @deprecated since Moodle 4.5 - please do not use this function any more, {@see \core\encryption::encrypt}
474 #[\core\attribute\deprecated('\core\encryption::encrypt', since: '4.5', mdl: 'MDL-81940')]
475 function rc4encrypt($data) {
476 // No initial deprecation notice here, as the following method triggers its own.
477 return endecrypt(get_site_identifier(), $data, '');
481 * rc4decrypt
483 * @param string $data Data to decrypt.
484 * @return string The now decrypted data.
486 * @deprecated since Moodle 4.5 - please do not use this function any more, {@see \core\encryption::decrypt}
488 #[\core\attribute\deprecated('\core\encryption::decrypt', since: '4.5', mdl: 'MDL-81940')]
489 function rc4decrypt($data) {
490 // No initial deprecation notice here, as the following method triggers its own.
491 return endecrypt(get_site_identifier(), $data, 'de');
495 * Based on a class by Mukul Sabharwal [mukulsabharwal @ yahoo.com]
497 * @param string $pwd The password to use when encrypting or decrypting
498 * @param string $data The data to be decrypted/encrypted
499 * @param string $case Either 'de' for decrypt or '' for encrypt
500 * @return string
502 * @deprecated since Moodle 4.5 - please do not use this function any more, {@see \core\encryption}
504 #[\core\attribute\deprecated(\core\encryption::class, since: '4.5', mdl: 'MDL-81940')]
505 function endecrypt($pwd, $data, $case) {
506 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
508 if ($case == 'de') {
509 $data = urldecode($data);
512 $key[] = '';
513 $box[] = '';
514 $pwdlength = strlen($pwd);
516 for ($i = 0; $i <= 255; $i++) {
517 $key[$i] = ord(substr($pwd, ($i % $pwdlength), 1));
518 $box[$i] = $i;
521 $x = 0;
523 for ($i = 0; $i <= 255; $i++) {
524 $x = ($x + $box[$i] + $key[$i]) % 256;
525 $tempswap = $box[$i];
526 $box[$i] = $box[$x];
527 $box[$x] = $tempswap;
530 $cipher = '';
532 $a = 0;
533 $j = 0;
535 for ($i = 0; $i < strlen($data); $i++) {
536 $a = ($a + 1) % 256;
537 $j = ($j + $box[$a]) % 256;
538 $temp = $box[$a];
539 $box[$a] = $box[$j];
540 $box[$j] = $temp;
541 $k = $box[(($box[$a] + $box[$j]) % 256)];
542 $cipherby = ord(substr($data, $i, 1)) ^ $k;
543 $cipher .= chr($cipherby);
546 if ($case == 'de') {
547 $cipher = urldecode(urlencode($cipher));
548 } else {
549 $cipher = urlencode($cipher);
552 return $cipher;
556 * @deprecated since Moodle 4.0
558 function question_preview_url() {
559 throw new coding_exception(__FUNCTION__ . '() has been removed.');
563 * @deprecated since Moodle 4.0
565 function question_preview_popup_params() {
566 throw new coding_exception(__FUNCTION__ . '() has been removed.');
570 * @deprecated since Moodle 4.0
572 function question_hash() {
573 throw new coding_exception(__FUNCTION__ . '() has been removed.');
577 * @deprecated since Moodle 4.0 MDL-71573
579 function question_make_export_url() {
580 throw new coding_exception(__FUNCTION__ . '() has been removed.');
584 * @deprecated since Moodle 4.0
586 function question_get_export_single_question_url() {
587 throw new coding_exception(__FUNCTION__ . '() has been removed.');
591 * @deprecated since Moodle 4.0 MDL-71585
593 function question_remove_stale_questions_from_category() {
594 throw new coding_exception(__FUNCTION__ . '() has been removed.');
598 * @deprecated since Moodle 4.0 MDL-71585
600 function flatten_category_tree() {
601 throw new coding_exception(__FUNCTION__ . '() has been removed.');
605 * @deprecated since Moodle 4.0 MDL-71585
607 function add_indented_names() {
608 throw new coding_exception(__FUNCTION__ . '() has been removed.');
612 * @deprecated since Moodle 4.0 MDL-71585
614 function question_category_select_menu() {
615 throw new coding_exception(__FUNCTION__ . '() has been removed.');
619 * @deprecated since Moodle 4.0 MDL-71585
621 function get_categories_for_contexts() {
622 throw new coding_exception(__FUNCTION__ . '() has been removed.');
626 * @deprecated since Moodle 4.0 MDL-71585
628 function question_category_options() {
629 throw new coding_exception(__FUNCTION__ . '() has been removed.');
633 * @deprecated since Moodle 4.0 MDL-71585
635 function question_add_context_in_key() {
636 throw new coding_exception(__FUNCTION__ . '() has been removed.');
640 * @deprecated since Moodle 4.0 MDL-71585
642 function question_fix_top_names() {
643 throw new coding_exception(__FUNCTION__ . '() has been removed.');
647 * @deprecated since Moodle 2.9
649 #[\core\attribute\deprecated('search_generate_SQL', since: '2.9', mdl: 'MDL-48939', final: true)]
650 function search_generate_text_SQL() {
651 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
655 * @deprecated Since Moodle 4.5
657 #[\core\attribute\deprecated('This method should not be used', since: '4.5', mdl: 'MDL-80275', final: true)]
658 function disable_output_buffering(): void {
659 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
664 * Prints a grade menu (as part of an existing form) with help showing all possible numerical grades and scales.
666 * @todo Finish documenting this function
667 * @todo Deprecate: this is only used in a few contrib modules
669 * @param int $courseid The course ID
670 * @param string $name
671 * @param string $current
672 * @param boolean $includenograde Include those with no grades
673 * @param boolean $return If set to true returns rather than echo's
674 * @return string|bool|null Depending on value of $return
675 * @deprecated Since Moodle 4.5
677 #[\core\attribute\deprecated('This method should not be used', since: '4.5', mdl: 'MDL-82157')]
678 function print_grade_menu($courseid, $name, $current, $includenograde=true, $return=false) {
679 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
680 global $OUTPUT;
682 $output = '';
683 $strscale = get_string('scale');
684 $strscales = get_string('scales');
686 $scales = get_scales_menu($courseid);
687 foreach ($scales as $i => $scalename) {
688 $grades[-$i] = $strscale .': '. $scalename;
690 if ($includenograde) {
691 $grades[0] = get_string('nograde');
693 for ($i=100; $i>=1; $i--) {
694 $grades[$i] = $i;
696 $output .= html_writer::select($grades, $name, $current, false);
698 $linkobject = '<span class="helplink">' . $OUTPUT->pix_icon('help', $strscales) . '</span>';
699 $link = new moodle_url('/course/scales.php', array('id' => $courseid, 'list' => 1));
700 $action = new popup_action('click', $link, 'ratingscales', array('height' => 400, 'width' => 500));
701 $output .= $OUTPUT->action_link($link, $linkobject, $action, array('title' => $strscales));
703 if ($return) {
704 return $output;
705 } else {
706 echo $output;
711 * Resets specified user's password and send the new password to the user via email.
713 * @param stdClass $user A {@link $USER} object
714 * @return bool Returns true if mail was sent OK and false if there was an error.
715 * @see setnew_password_and_mail()
716 * @deprecated Since Moodle 4.5
717 * @todo MDL-82646 Final deprecation in Moodle 6.0.
719 #[\core\attribute\deprecated(
720 since: '4.5',
721 mdl: 'MDL-64148',
722 replacement: 'setnew_password_and_mail()',
723 reason: 'It is no longer used',
725 function reset_password_and_mail($user) {
726 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
727 global $CFG;
729 $site = get_site();
730 $supportuser = core_user::get_support_user();
732 $userauth = get_auth_plugin($user->auth);
733 if (!$userauth->can_reset_password() or !is_enabled_auth($user->auth)) {
734 trigger_error("Attempt to reset user password for user $user->username with Auth $user->auth.");
735 return false;
738 $newpassword = generate_password();
740 if (!$userauth->user_update_password($user, $newpassword)) {
741 throw new \moodle_exception("cannotsetpassword");
744 $a = new stdClass();
745 $a->firstname = $user->firstname;
746 $a->lastname = $user->lastname;
747 $a->sitename = format_string($site->fullname);
748 $a->username = $user->username;
749 $a->newpassword = $newpassword;
750 $a->link = $CFG->wwwroot .'/login/change_password.php';
751 $a->signoff = generate_email_signoff();
753 $message = get_string('newpasswordtext', '', $a);
755 $subject = format_string($site->fullname) .': '. get_string('changedpassword');
757 unset_user_preference('create_password', $user); // Prevent cron from generating the password.
759 // Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
760 return email_to_user($user, $supportuser, $subject, $message);
764 * @deprecated Since Moodle 4.0 MDL-71175. Please use plagiarism_get_links() or plugin specific functions..
766 #[\core\attribute\deprecated(
767 replacement: 'plagiarism_get_links',
768 since: '4.0',
769 mdl: 'MDL-71175',
770 final: true,
772 function plagiarism_get_file_results(): void {
773 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);
777 * @deprecated Since Moodle 4.0 - Please use {plugin name}_before_standard_top_of_body_html instead.
779 #[\core\attribute\deprecated(
780 replacement: '{plugin name}_before_standard_top_of_body_html',
781 since: '4.0',
782 mdl: 'MDL-71175',
783 final: true,
785 function plagiarism_update_status(): void {
786 \core\deprecation::emit_deprecation_if_present(__FUNCTION__);