original_string: public static function remove_deleted_courses_from_schedule() {
          global $DB;
          $skipped = 0;
          $sql = "SELECT bc.courseid FROM {backup_courses} bc WHERE bc.courseid NOT IN (SELECT c.id FROM {course} c)";
          $rs = $DB->get_recordset_sql($sql);
          foreach ($rs as $deletedcourse) {
              //Doesn't exist, so delete from backup tables
              $DB->delete_records('backup_courses', array('courseid'=>$deletedcourse->courseid));
              $skipped++;
          }
          $rs->close();
          return $skipped;
      }
code: public static function remove_deleted_courses_from_schedule() {
          global $DB;
          $skipped = 0;
          $sql = "SELECT bc.courseid FROM {backup_courses} bc WHERE bc.courseid NOT IN (SELECT c.id FROM {course} c)";
          $rs = $DB->get_recordset_sql($sql);
          foreach ($rs as $deletedcourse) {
              //Doesn't exist, so delete from backup tables
              $DB->delete_records('backup_courses', array('courseid'=>$deletedcourse->courseid));
              $skipped++;
          }
          $rs->close();
          return $skipped;
      }
code_tokens: public static function remove_deleted_courses_from_schedule ( ) { global $ DB ; $ skipped = 0 ; $ sql = "SELECT bc.courseid FROM {backup_courses} bc WHERE bc.courseid NOT IN (SELECT c.id FROM {course} c)" ; $ rs = $ DB -> get_recordset_sql ( $ sql ) ; foreach ( $ rs as $ deletedcourse ) { //Doesn't exist, so delete from backup tables $ DB -> delete_records ( 'backup_courses' , array ( 'courseid' => $ deletedcourse -> courseid ) ) ; $ skipped ++ ; } $ rs -> close ( ) ; return $ skipped ; }
docstring: Removes deleted courses fromn the backup_courses table so that we don't
  waste time backing them up.
  
  @global moodle_database $DB
  @return int
docstring_tokens: Removes deleted courses fromn the backup_courses table so that we don t waste time backing them up .