示例#1
0
 /**
  * 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)
 {
     session_kill($sid);
     if (isset($this->record->id) and $this->record->sid === $sid) {
         try {
             $this->database->release_session_lock($this->record->id);
         } catch (Exception $ex) {
             // ignore problems
         }
         $this->record = null;
     }
     $this->lasthash = null;
     return true;
 }
 public function release_session_lock($rowid)
 {
     if (!$this->used_for_db_sessions) {
         return;
     }
     parent::release_session_lock($rowid);
     $fullname = $this->dbname . '-' . $this->prefix . '-session-' . $rowid;
     $sql = "SELECT RELEASE_LOCK('{$fullname}')";
     $this->query_start($sql, null, SQL_QUERY_AUX);
     $result = $this->mysqli->query($sql);
     $this->query_end($result);
     if ($result) {
         $result->close();
     }
 }
 public function release_session_lock($rowid)
 {
     if (!$this->session_lock_supported()) {
         return;
     }
     if (!$this->used_for_db_sessions) {
         return;
     }
     parent::release_session_lock($rowid);
     $fullname = $this->dbname . '-' . $this->prefix . '-session-' . $rowid;
     $sql = "sp_releaseapplock '{$fullname}', 'Session'";
     $this->query_start($sql, null, SQL_QUERY_AUX);
     $result = mssql_query($sql, $this->mssql);
     $this->query_end($result);
     $this->free_result($result);
 }
 public function release_session_lock($rowid)
 {
     if (!$this->session_lock_supported()) {
         return;
     }
     parent::release_session_lock($rowid);
     $fullname = $this->dbname . '-' . $this->prefix . '-session-' . $rowid;
     $params = array('lockname' => $fullname);
     $sql = 'SELECT MOODLE_LOCKS.RELEASE_LOCK(:lockname) FROM DUAL';
     $this->query_start($sql, $params, SQL_QUERY_AUX);
     $stmt = $this->parse_query($sql);
     $this->bind_params($stmt, $params);
     $result = oci_execute($stmt, $this->commit_status);
     $this->query_end($result, $stmt);
     oci_free_statement($stmt);
 }
 public function release_session_lock($rowid)
 {
     if (!$this->session_lock_supported()) {
         return;
     }
     if (!$this->used_for_db_sessions) {
         return;
     }
     parent::release_session_lock($rowid);
     $sql = "SELECT pg_advisory_unlock({$rowid})";
     $this->query_start($sql, null, SQL_QUERY_AUX);
     $result = pg_query($this->pgsql, $sql);
     $this->query_end($result);
     if ($result) {
         pg_free_result($result);
     }
 }
 public function release_session_lock($rowid)
 {
     if (!$this->session_lock_supported()) {
         return;
     }
     if (!$this->used_for_db_sessions) {
         return;
     }
     parent::release_session_lock($rowid);
     // OVERWRITE 2: replacement, changed from:
     //$sql = "SELECT pg_advisory_unlock($rowid)";
     // TO:
     global $CFG;
     $sql = "SELECT pg_advisory_unlock({$rowid}, {$CFG->current_app->getId()})";
     // END OVERWRITE 2
     $this->query_start($sql, null, SQL_QUERY_AUX);
     $result = pg_query($this->pgsql, $sql);
     $this->query_end($result);
     if ($result) {
         pg_free_result($result);
     }
 }
示例#7
-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;
 }