/**
  * Completely clear the cache.
  * @param moodle_database $db the database connection to use to access the cache.
  */
 public static function clear_cache($db)
 {
     // Delete the cache records from the database.
     $db->delete_records('qtype_stack_cas_cache');
     // Also take this opportunity to empty the plots folder on disc.
     $plots = glob(stack_cas_configuration::images_location() . '/*.png');
     foreach ($plots as $plot) {
         unlink($plot);
     }
 }
Пример #2
-1
 /**
  * Destroy session handler.
  *
  * {@see http://php.net/manual/en/function.session-set-save-handler.php}
  *
  * @param string $sid
  * @return bool success
  */
 public function handler_destroy($sid)
 {
     if (!($session = $this->database->get_record('sessions', array('sid' => $sid), 'id, sid'))) {
         if ($sid == session_id()) {
             $this->recordid = null;
             $this->lasthash = null;
         }
         return true;
     }
     if ($this->recordid and $session->id == $this->recordid) {
         try {
             $this->database->release_session_lock($this->recordid);
         } catch (\Exception $ex) {
             // Ignore problems.
         }
         $this->recordid = null;
         $this->lasthash = null;
     }
     $this->database->delete_records('sessions', array('id' => $session->id));
     return true;
 }