From e68789c559f9a7633789d39bf3e23ae543b40923 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sat, 12 Feb 2011 16:48:32 +0100 Subject: [PATCH] MDL-26380 improve perf of mediaplugin filter if no links found in text --- filter/mediaplugin/filter.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/filter/mediaplugin/filter.php b/filter/mediaplugin/filter.php index 6a9ec854a82..d7b21297fcf 100644 --- a/filter/mediaplugin/filter.php +++ b/filter/mediaplugin/filter.php @@ -46,6 +46,11 @@ class filter_mediaplugin extends moodle_text_filter { // non string data can not be filtered anyway return $text; } + if (stripos($text, '') === false) { + // performance shortcut - all regexes bellow end with the tag, + // if not present nothing can match + return $text; + } $newtext = $text; // fullclone is slow and not needed here if (!empty($CFG->filter_mediaplugin_enable_mp3)) {