function apdqc_admin_semaphore_table_need_update in Asynchronous Prefetch Database Query Cache 7
See if the semaphore table needs to be updated.
Return value
bool Returns TRUE if the semaphore table schema has not been updated.
1 call to apdqc_admin_semaphore_table_need_update()
- apdqc_admin_operations_form in ./
apdqc.admin.inc - Form builder; perform apdqc operations.
File
- ./
apdqc.admin.inc, line 1185 - Admin page callbacks for the apdqc module.
Code
function apdqc_admin_semaphore_table_need_update() {
$table_name = 'semaphore';
$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 === 'name' || $row->Field === 'value') && $row->Collation !== 'ascii_bin') {
$needs_update = TRUE;
break;
}
if (function_exists('apdqc_lock_base85_encode') && $row->Field === 'value' && $row->Type !== 'varchar(20)') {
$needs_update = TRUE;
break;
}
if (!function_exists('apdqc_lock_base85_encode') && $row->Field === 'value' && $row->Type !== 'varchar(33)') {
$needs_update = TRUE;
break;
}
}
$results = db_query("SHOW KEYS FROM {$table_name} WHERE Key_name = 'PRIMARY'")
->fetchAllAssoc('Column_name');
if (count($results) != 3) {
$needs_update = TRUE;
}
return $needs_update;
}