original_string: public function reset_paths($rebuild = true) {
          global $DB;
  
          if ($this->_path) {
              $this->mark_dirty();
          }
          $DB->set_field_select('context', 'depth', 0, "path LIKE '%/$this->_id/%'");
          $DB->set_field_select('context', 'path', NULL, "path LIKE '%/$this->_id/%'");
          if ($this->_contextlevel != CONTEXT_SYSTEM) {
              $DB->set_field('context', 'depth', 0, array('id'=>$this->_id));
              $DB->set_field('context', 'path', NULL, array('id'=>$this->_id));
              $this->_depth = 0;
              $this->_path = null;
          }
  
          if ($rebuild) {
              context_helper::build_all_paths(false);
          }
  
          context::reset_caches();
      }
code: public function reset_paths($rebuild = true) {
          global $DB;
  
          if ($this->_path) {
              $this->mark_dirty();
          }
          $DB->set_field_select('context', 'depth', 0, "path LIKE '%/$this->_id/%'");
          $DB->set_field_select('context', 'path', NULL, "path LIKE '%/$this->_id/%'");
          if ($this->_contextlevel != CONTEXT_SYSTEM) {
              $DB->set_field('context', 'depth', 0, array('id'=>$this->_id));
              $DB->set_field('context', 'path', NULL, array('id'=>$this->_id));
              $this->_depth = 0;
              $this->_path = null;
          }
  
          if ($rebuild) {
              context_helper::build_all_paths(false);
          }
  
          context::reset_caches();
      }
code_tokens: public function reset_paths ( $ rebuild = true ) { global $ DB ; if ( $ this -> _path ) { $ this -> mark_dirty ( ) ; } $ DB -> set_field_select ( 'context' , 'depth' , 0 , "path LIKE '%/$this->_id/%'" ) ; $ DB -> set_field_select ( 'context' , 'path' , NULL , "path LIKE '%/$this->_id/%'" ) ; if ( $ this -> _contextlevel != CONTEXT_SYSTEM ) { $ DB -> set_field ( 'context' , 'depth' , 0 , array ( 'id' => $ this -> _id ) ) ; $ DB -> set_field ( 'context' , 'path' , NULL , array ( 'id' => $ this -> _id ) ) ; $ this -> _depth = 0 ; $ this -> _path = null ; } if ( $ rebuild ) { context_helper :: build_all_paths ( false ) ; } context :: reset_caches ( ) ; }
docstring: Remove all context path info and optionally rebuild it.
  
  @param bool $rebuild
  @return void
docstring_tokens: Remove all context path info and optionally rebuild it .