original_string: protected static function sync_course_instances($courseid, $userid) {
          global $DB;
  
          static $preventrecursion = false;
  
          // does anything want to sync with this parent?
          if (!$enrols = $DB->get_records('enrol', array('customint1'=>$courseid, 'enrol'=>'meta'), 'id ASC')) {
              return;
          }
  
          if ($preventrecursion) {
              return;
          }
  
          $preventrecursion = true;
  
          try {
              foreach ($enrols as $enrol) {
                  self::sync_with_parent_course($enrol, $userid);
              }
          } catch (Exception $e) {
              $preventrecursion = false;
              throw $e;
          }
  
          $preventrecursion = false;
      }
code: protected static function sync_course_instances($courseid, $userid) {
          global $DB;
  
          static $preventrecursion = false;
  
          // does anything want to sync with this parent?
          if (!$enrols = $DB->get_records('enrol', array('customint1'=>$courseid, 'enrol'=>'meta'), 'id ASC')) {
              return;
          }
  
          if ($preventrecursion) {
              return;
          }
  
          $preventrecursion = true;
  
          try {
              foreach ($enrols as $enrol) {
                  self::sync_with_parent_course($enrol, $userid);
              }
          } catch (Exception $e) {
              $preventrecursion = false;
              throw $e;
          }
  
          $preventrecursion = false;
      }
code_tokens: protected static function sync_course_instances ( $ courseid , $ userid ) { global $ DB ; static $ preventrecursion = false ; // does anything want to sync with this parent? if ( ! $ enrols = $ DB -> get_records ( 'enrol' , array ( 'customint1' => $ courseid , 'enrol' => 'meta' ) , 'id ASC' ) ) { return ; } if ( $ preventrecursion ) { return ; } $ preventrecursion = true ; try { foreach ( $ enrols as $ enrol ) { self :: sync_with_parent_course ( $ enrol , $ userid ) ; } } catch ( Exception $ e ) { $ preventrecursion = false ; throw $ e ; } $ preventrecursion = false ; }
docstring: Synchronise meta enrolments of this user in this course
  @static
  @param int $courseid
  @param int $userid
  @return void
docstring_tokens: Synchronise meta enrolments of this user in this course