original_string: public static function reset_tour_sortorder() {
          global $DB;
          $tours = $DB->get_records('tool_usertours_tours', null, 'sortorder ASC, pathmatch DESC', 'id, sortorder');
  
          $index = 0;
          foreach ($tours as $tour) {
              if ($tour->sortorder != $index) {
                  $DB->set_field('tool_usertours_tours', 'sortorder', $index, array('id' => $tour->id));
              }
              $index++;
          }
  
          // Notify the cache that a tour has changed.
          // Tours are only stored in the cache if there are steps.
          // If there step count has changed for some reason, this will change the potential cache results.
          cache::notify_tour_change();
      }
code: public static function reset_tour_sortorder() {
          global $DB;
          $tours = $DB->get_records('tool_usertours_tours', null, 'sortorder ASC, pathmatch DESC', 'id, sortorder');
  
          $index = 0;
          foreach ($tours as $tour) {
              if ($tour->sortorder != $index) {
                  $DB->set_field('tool_usertours_tours', 'sortorder', $index, array('id' => $tour->id));
              }
              $index++;
          }
  
          // Notify the cache that a tour has changed.
          // Tours are only stored in the cache if there are steps.
          // If there step count has changed for some reason, this will change the potential cache results.
          cache::notify_tour_change();
      }
code_tokens: public static function reset_tour_sortorder ( ) { global $ DB ; $ tours = $ DB -> get_records ( 'tool_usertours_tours' , null , 'sortorder ASC, pathmatch DESC' , 'id, sortorder' ) ; $ index = 0 ; foreach ( $ tours as $ tour ) { if ( $ tour -> sortorder != $ index ) { $ DB -> set_field ( 'tool_usertours_tours' , 'sortorder' , $ index , array ( 'id' => $ tour -> id ) ) ; } $ index ++ ; } // Notify the cache that a tour has changed. // Tours are only stored in the cache if there are steps. // If there step count has changed for some reason, this will change the potential cache results. cache :: notify_tour_change ( ) ; }
docstring: Reset the sortorder for all tours.
docstring_tokens: Reset the sortorder for all tours .