You are here

function apdqc_admin_sessions_table_need_update in Asynchronous Prefetch Database Query Cache 7

See if the sessions table needs to be updated.

Return value

bool Returns TRUE if the sessions table schema has not been updated.

1 call to apdqc_admin_sessions_table_need_update()
apdqc_admin_operations_form in ./apdqc.admin.inc
Form builder; perform apdqc operations.

File

./apdqc.admin.inc, line 1095
Admin page callbacks for the apdqc module.

Code

function apdqc_admin_sessions_table_need_update() {
  $table_name = 'sessions';
  $table_name = Database::getConnection()
    ->prefixTables('{' . db_escape_table($table_name) . '}');
  $results = db_query("SHOW FULL FIELDS FROM {$table_name}")
    ->fetchAllAssoc('Field');
  $needs_update = FALSE;
  foreach ($results as $row) {
    if (($row->Field === 'sid' || $row->Field === 'ssid') && ($row->Type !== 'char(43)' || $row->Collation !== 'ascii_bin')) {
      $needs_update = TRUE;
      break;
    }
    if ($row->Field === 'hostname' && ($row->Type !== 'varchar(45)' || $row->Collation !== 'ascii_bin')) {
      $needs_update = TRUE;
      break;
    }
  }
  return $needs_update;
}