From: moodler Date: Wed, 11 Feb 2004 02:26:25 +0000 (+0000) Subject: Cache format_text calls in make_mail_post for even more speed X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0d851f90a8d2c6537c781c822621c335fb8359a7;p=moodle.git Cache format_text calls in make_mail_post for even more speed during a forum_cron --- diff --git a/mod/forum/lib.php b/mod/forum/lib.php index b46f6479b5..3c4ea725fe 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -1078,6 +1078,14 @@ function forum_make_mail_post(&$post, $user, $touser, $course, global $THEME, $CFG; + static $formattedtext; // Cached version of formatted text for a post + static $formattedtextid; // The ID number of the post + + if (empty($formattedtextid) or $formattedtextid != $post->id) { // Recalculate the formatting + $formattedtext = format_text($post->message, $post->format, NULL, $course->id); + $formattedtextid = $post->id; + } + $output = ""; $output .= "