Ignore:
Timestamp:
May 2, 2016, 12:09:23 PM (3 years ago)
Author:
jrpelegrina
Message:

Updated to moodle 3.0.3

Location:
moodle/trunk/fuentes/filter/data
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • moodle/trunk/fuentes/filter/data/filter.php

    r136 r1331  
    3333
    3434    public function filter($text, array $options = array()) {
    35         global $CFG, $DB;
     35        global $CFG, $DB, $USER;
    3636
    37         // Trivial-cache - keyed on $cachedcontextid
    38         static $cachedcontextid;
    39         static $contentlist;
     37        // Trivial-cache - keyed on $cachedcourseid + $cacheduserid.
     38        static $cachedcourseid = null;
     39        static $cacheduserid = null;
     40        static $coursecontentlist = array();
     41        static $sitecontentlist = array();
    4042
    4143        static $nothingtodo;
     
    4446        $coursectx = $this->context->get_course_context(false);
    4547        if (!$coursectx) {
     48            // We could be in a course category so no entries for courseid == 0 will be found.
    4649            $courseid = 0;
    4750        } else {
     
    4952        }
    5053
    51         // Initialise/invalidate our trivial cache if dealing with a different context
    52         if (!isset($cachedcontextid) || $cachedcontextid !== $this->context->id) {
    53             $cachedcontextid = $this->context->id;
    54             $contentlist = array();
     54        if ($cacheduserid !== $USER->id) {
     55            // Invalidate all caches if the user changed.
     56            $coursecontentlist = array();
     57            $sitecontentlist = array();
     58            $cacheduserid = $USER->id;
     59            $cachedcourseid = $courseid;
     60            $nothingtodo = false;
     61        } else if ($courseid != get_site()->id && $courseid != 0 && $cachedcourseid != $courseid) {
     62            // Invalidate course-level caches if the course id changed.
     63            $coursecontentlist = array();
     64            $cachedcourseid = $courseid;
    5565            $nothingtodo = false;
    5666        }
     
    5868        if ($nothingtodo === true) {
    5969            return $text;
     70        }
     71
     72        // If courseid == 0 only site entries will be returned.
     73        if ($courseid == get_site()->id || $courseid == 0) {
     74            $contentlist = & $sitecontentlist;
     75        } else {
     76            $contentlist = & $coursecontentlist;
    6077        }
    6178
  • moodle/trunk/fuentes/filter/data/version.php

    r136 r1331  
    2626defined('MOODLE_INTERNAL') || die();
    2727
    28 $plugin->version  = 2014111000;
    29 $plugin->requires = 2014110400;  // Requires this Moodle version
     28$plugin->version  = 2015111600;
     29$plugin->requires = 2015111000;  // Requires this Moodle version.
    3030$plugin->component= 'filter_data';
    3131
    32 $plugin->dependencies = array('mod_data' => 2014110400);
     32$plugin->dependencies = array('mod_data' => 2015111000);
Note: See TracChangeset for help on using the changeset viewer.