original_string: public static function fill_subscription_cache_for_course($courseid, $userid) {
          global $DB;
  
          if (!isset(self::$forumcache[$userid])) {
              self::$forumcache[$userid] = array();
          }
  
          $sql = "SELECT
                      f.id AS forumid,
                      s.id AS subscriptionid
                  FROM {forum} f
                  LEFT JOIN {forum_subscriptions} s ON (s.forum = f.id AND s.userid = :userid)
                  WHERE f.course = :course
                  AND f.forcesubscribe <> :subscriptionforced";
  
          $subscriptions = $DB->get_recordset_sql($sql, array(
              'course' => $courseid,
              'userid' => $userid,
              'subscriptionforced' => FORUM_FORCESUBSCRIBE,
          ));
  
          foreach ($subscriptions as $id => $data) {
              self::$forumcache[$userid][$id] = !empty($data->subscriptionid);
          }
          $subscriptions->close();
      }
code: public static function fill_subscription_cache_for_course($courseid, $userid) {
          global $DB;
  
          if (!isset(self::$forumcache[$userid])) {
              self::$forumcache[$userid] = array();
          }
  
          $sql = "SELECT
                      f.id AS forumid,
                      s.id AS subscriptionid
                  FROM {forum} f
                  LEFT JOIN {forum_subscriptions} s ON (s.forum = f.id AND s.userid = :userid)
                  WHERE f.course = :course
                  AND f.forcesubscribe <> :subscriptionforced";
  
          $subscriptions = $DB->get_recordset_sql($sql, array(
              'course' => $courseid,
              'userid' => $userid,
              'subscriptionforced' => FORUM_FORCESUBSCRIBE,
          ));
  
          foreach ($subscriptions as $id => $data) {
              self::$forumcache[$userid][$id] = !empty($data->subscriptionid);
          }
          $subscriptions->close();
      }
code_tokens: public static function fill_subscription_cache_for_course ( $ courseid , $ userid ) { global $ DB ; if ( ! isset ( self :: $ forumcache [ $ userid ] ) ) { self :: $ forumcache [ $ userid ] = array ( ) ; } $ sql = "SELECT
                      f.id AS forumid,
                      s.id AS subscriptionid
                  FROM {forum} f
                  LEFT JOIN {forum_subscriptions} s ON (s.forum = f.id AND s.userid = :userid)
                  WHERE f.course = :course
                  AND f.forcesubscribe <> :subscriptionforced" ; $ subscriptions = $ DB -> get_recordset_sql ( $ sql , array ( 'course' => $ courseid , 'userid' => $ userid , 'subscriptionforced' => FORUM_FORCESUBSCRIBE , ) ) ; foreach ( $ subscriptions as $ id => $ data ) { self :: $ forumcache [ $ userid ] [ $ id ] = ! empty ( $ data -> subscriptionid ) ; } $ subscriptions -> close ( ) ; }
docstring: Fill the forum subscription data for all forums that the specified userid can subscribe to in the specified course.
  
  @param int $courseid The course to retrieve a cache for
  @param int $userid The user ID
  @return void
docstring_tokens: Fill the forum subscription data for all forums that the specified userid can subscribe to in the specified course .