Skip to content

Commit

Permalink
Merge pull request #115 from internetarchive/schema-rewrtie
Browse files Browse the repository at this point in the history
Some little fixes
  • Loading branch information
cyberpower678 authored Jan 9, 2024
2 parents e41dfb5 + 64c0f7a commit 0845000
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 110 deletions.
104 changes: 0 additions & 104 deletions app/src/DBOffloader.php

This file was deleted.

12 changes: 6 additions & 6 deletions app/src/html/Includes/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function open() {
}

protected function createSessionsTable() {
if( !mysqli_query( $this->sessionDBObject, "CREATE TABLE IF NOT EXISTS " . SECONDARYDB . ".externallinks_sessions (
if( !mysqli_query( $this->sessionDBObject, "CREATE TABLE IF NOT EXISTS externallinks_sessions (
`id` CHAR(128) NOT NULL,
`set_time` CHAR(10) NOT NULL,
`data` LONGBLOB NOT NULL,
Expand All @@ -160,7 +160,7 @@ public function close() {
public function read( $id ) {
if( !isset( $this->read_stmt ) ) {
$this->read_stmt =
mysqli_prepare( $this->sessionDBObject, "SELECT data FROM " . SECONDARYDB . ".externallinks_sessions WHERE id = ? LIMIT 1"
mysqli_prepare( $this->sessionDBObject, "SELECT data FROM externallinks_sessions WHERE id = ? LIMIT 1"
);
}
mysqli_stmt_bind_param( $this->read_stmt, 's', $id );
Expand All @@ -179,7 +179,7 @@ private function getkey( $id ) {
if( !isset( $this->key_stmt ) ) {
$this->key_stmt =
mysqli_prepare( $this->sessionDBObject,
"SELECT session_key FROM " . SECONDARYDB . ".externallinks_sessions WHERE id = ? LIMIT 1"
"SELECT session_key FROM externallinks_sessions WHERE id = ? LIMIT 1"
);
}
mysqli_stmt_bind_param( $this->key_stmt, 's', $id );
Expand Down Expand Up @@ -222,7 +222,7 @@ public function write( $id, $data ) {

if( !isset( $this->w_stmt ) ) {
$this->w_stmt = mysqli_prepare( $this->sessionDBObject,
"REPLACE INTO " . SECONDARYDB . ".externallinks_sessions (id, set_time, data, session_key) VALUES (?, ?, ?, ?)"
"REPLACE INTO externallinks_sessions (id, set_time, data, session_key) VALUES (?, ?, ?, ?)"
);
}

Expand All @@ -246,7 +246,7 @@ private function encrypt( $data, $key ) {
public function destroy( $id ) {
if( !isset( $this->delete_stmt ) ) {
$this->delete_stmt =
mysqli_prepare( $this->sessionDBObject, "DELETE FROM " . SECONDARYDB . ".externallinks_sessions WHERE id = ?" );
mysqli_prepare( $this->sessionDBObject, "DELETE FROM externallinks_sessions WHERE id = ?" );
}
mysqli_stmt_bind_param( $this->delete_stmt, 's', $id );
mysqli_stmt_execute( $this->delete_stmt );
Expand All @@ -257,7 +257,7 @@ public function destroy( $id ) {
public function gc( $max ) {
if( !isset( $this->gc_stmt ) ) {
$this->gc_stmt =
mysqli_prepare( $this->sessionDBObject, "DELETE FROM " . SECONDARYDB . ".externallinks_sessions WHERE set_time < ?" );
mysqli_prepare( $this->sessionDBObject, "DELETE FROM externallinks_sessions WHERE set_time < ?" );
}
$old = time() - $max;
mysqli_stmt_bind_param( $this->gc_stmt, 's', $old );
Expand Down

0 comments on commit 0845000

Please sign in to comment.