diff --git a/lib/tests/htmlpurifier_test.php b/lib/tests/htmlpurifier_test.php
index c047044f031..0ed95641d55 100644
--- a/lib/tests/htmlpurifier_test.php
+++ b/lib/tests/htmlpurifier_test.php
@@ -111,9 +111,9 @@ class htmlpurifier_test extends \basic_testcase {
*/
public function test_format_text_allowid() {
// Start off by not allowing ids (default).
- $options = array(
- 'nocache' => true
- );
+ $options = [
+ 'allowid' => false,
+ ];
$result = format_text('
Frog
', FORMAT_HTML, $options);
$this->assertSame('Frog
', $result);
diff --git a/lib/upgrade.txt b/lib/upgrade.txt
index 25a01961aef..80706b4828b 100644
--- a/lib/upgrade.txt
+++ b/lib/upgrade.txt
@@ -47,6 +47,7 @@ information provided here is intended especially for developers.
* The fourth parameter to `format_text` now emits a deprecation notice.
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 nocache option for format_text has been removed. It was deprecated in Moodle 2.3.
=== 4.3 ===
diff --git a/lib/weblib.php b/lib/weblib.php
index d3030c0d790..c03273b66f8 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -1240,7 +1240,6 @@ function format_text_menu() {
* Options:
* 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.
- * 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.
* 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.
@@ -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 = [
'text',
'format',
@@ -1340,7 +1348,6 @@ function format_text($text, $format = FORMAT_MOODLE, $options = null, $courseidd
'blanktarget',
'allowid',
'noclean',
- 'nocache',
];
$invalidoptions = array_diff(array_keys($options), $validoptions);