MDL-80072 core: Mark nocache option to format_text as deprecated

This was actually deprecated back in MDL-34347 but never actually
emitted.
This commit is contained in:
Andrew Nicols 2023-12-07 15:34:51 +08:00
parent 85c1dd0077
commit 3e6437e67c
No known key found for this signature in database
GPG key ID: 6D1E3157C8CFBF14
3 changed files with 13 additions and 5 deletions

View file

@ -111,9 +111,9 @@ class htmlpurifier_test extends \basic_testcase {
*/ */
public function test_format_text_allowid() { public function test_format_text_allowid() {
// Start off by not allowing ids (default). // Start off by not allowing ids (default).
$options = array( $options = [
'nocache' => true 'allowid' => false,
); ];
$result = format_text('<div id="example">Frog</div>', FORMAT_HTML, $options); $result = format_text('<div id="example">Frog</div>', FORMAT_HTML, $options);
$this->assertSame('<div>Frog</div>', $result); $this->assertSame('<div>Frog</div>', $result);

View file

@ -47,6 +47,7 @@ information provided here is intended especially for developers.
* The fourth parameter to `format_text` now emits a deprecation notice. * The fourth parameter to `format_text` now emits a deprecation notice.
It was originally deprecated in Moodle 2.0. It was originally deprecated in Moodle 2.0.
* The smiley option for format_text has been removed. It was deprecated in Moodle 2.0. * The smiley option for format_text has been removed. It was deprecated in Moodle 2.0.
* The nocache option for format_text has been removed. It was deprecated in Moodle 2.3.
=== 4.3 === === 4.3 ===

View file

@ -1240,7 +1240,6 @@ function format_text_menu() {
* Options: * Options:
* trusted : If true the string won't be cleaned. Default false required noclean=true. * trusted : If true the string won't be cleaned. Default false required noclean=true.
* noclean : If true the string won't be cleaned, unless $CFG->forceclean is set. Default false required trusted=true. * noclean : If true the string won't be cleaned, unless $CFG->forceclean is set. Default false required trusted=true.
* nocache : If true the strign will not be cached and will be formatted every call. Default false.
* filter : If true the string will be run through applicable filters as well. Default true. * filter : If true the string will be run through applicable filters as well. Default true.
* para : If true then the returned string will be wrapped in div tags. Default true. * para : If true then the returned string will be wrapped in div tags. Default true.
* newlines : If true then lines newline breaks will be converted to HTML newline breaks. Default true. * newlines : If true then lines newline breaks will be converted to HTML newline breaks. Default true.
@ -1327,6 +1326,15 @@ function format_text($text, $format = FORMAT_MOODLE, $options = null, $courseidd
); );
} }
// The nocache option was deprecated in Moodle 2.3 in MDL-34347.
if (array_key_exists('nocache', $options)) {
unset($options['nocache']);
debugging(
'The nocache option is deprecated and no longer used.',
DEBUG_DEVELOPER,
);
}
$validoptions = [ $validoptions = [
'text', 'text',
'format', 'format',
@ -1340,7 +1348,6 @@ function format_text($text, $format = FORMAT_MOODLE, $options = null, $courseidd
'blanktarget', 'blanktarget',
'allowid', 'allowid',
'noclean', 'noclean',
'nocache',
]; ];
$invalidoptions = array_diff(array_keys($options), $validoptions); $invalidoptions = array_diff(array_keys($options), $validoptions);