original_string: public static function kill_user_sessions($userid, $keepsid = null) {
          global $DB;
  
          $sessions = $DB->get_records('sessions', array('userid'=>$userid), 'id DESC', 'id, sid');
          foreach ($sessions as $session) {
              if ($keepsid and $keepsid === $session->sid) {
                  continue;
              }
              self::kill_session($session->sid);
          }
      }
code: public static function kill_user_sessions($userid, $keepsid = null) {
          global $DB;
  
          $sessions = $DB->get_records('sessions', array('userid'=>$userid), 'id DESC', 'id, sid');
          foreach ($sessions as $session) {
              if ($keepsid and $keepsid === $session->sid) {
                  continue;
              }
              self::kill_session($session->sid);
          }
      }
code_tokens: public static function kill_user_sessions ( $ userid , $ keepsid = null ) { global $ DB ; $ sessions = $ DB -> get_records ( 'sessions' , array ( 'userid' => $ userid ) , 'id DESC' , 'id, sid' ) ; foreach ( $ sessions as $ session ) { if ( $ keepsid and $ keepsid === $ session -> sid ) { continue ; } self :: kill_session ( $ session -> sid ) ; } }
docstring: Terminate all sessions of given user unconditionally.
  @param int $userid
  @param string $keepsid keep this sid if present
docstring_tokens: Terminate all sessions of given user unconditionally .