original_string: public function refresh_grades($userid=0) {
          global $DB;
          if ($this->itemtype == 'mod') {
              if ($this->is_outcome_item()) {
                  //nothing to do
                  return true;
              }
  
              if (!$activity = $DB->get_record($this->itemmodule, array('id' => $this->iteminstance))) {
                  debugging("Can not find $this->itemmodule activity with id $this->iteminstance");
                  return false;
              }
  
              if (!$cm = get_coursemodule_from_instance($this->itemmodule, $activity->id, $this->courseid)) {
                  debugging('Can not find course module');
                  return false;
              }
  
              $activity->modname    = $this->itemmodule;
              $activity->cmidnumber = $cm->idnumber;
  
              return grade_update_mod_grades($activity, $userid);
          }
  
          return true;
      }
code: public function refresh_grades($userid=0) {
          global $DB;
          if ($this->itemtype == 'mod') {
              if ($this->is_outcome_item()) {
                  //nothing to do
                  return true;
              }
  
              if (!$activity = $DB->get_record($this->itemmodule, array('id' => $this->iteminstance))) {
                  debugging("Can not find $this->itemmodule activity with id $this->iteminstance");
                  return false;
              }
  
              if (!$cm = get_coursemodule_from_instance($this->itemmodule, $activity->id, $this->courseid)) {
                  debugging('Can not find course module');
                  return false;
              }
  
              $activity->modname    = $this->itemmodule;
              $activity->cmidnumber = $cm->idnumber;
  
              return grade_update_mod_grades($activity, $userid);
          }
  
          return true;
      }
code_tokens: public function refresh_grades ( $ userid = 0 ) { global $ DB ; if ( $ this -> itemtype == 'mod' ) { if ( $ this -> is_outcome_item ( ) ) { //nothing to do return true ; } if ( ! $ activity = $ DB -> get_record ( $ this -> itemmodule , array ( 'id' => $ this -> iteminstance ) ) ) { debugging ( "Can not find $this->itemmodule activity with id $this->iteminstance" ) ; return false ; } if ( ! $ cm = get_coursemodule_from_instance ( $ this -> itemmodule , $ activity -> id , $ this -> courseid ) ) { debugging ( 'Can not find course module' ) ; return false ; } $ activity -> modname = $ this -> itemmodule ; $ activity -> cmidnumber = $ cm -> idnumber ; return grade_update_mod_grades ( $ activity , $ userid ) ; } return true ; }
docstring: Refetch grades from modules, plugins.
  
  @param int $userid optional, limit the refetch to a single user
  @return bool Returns true on success or if there is nothing to do
docstring_tokens: Refetch grades from modules plugins .