You are here

function domain_test_schema in Domain Access 7.3

Checks a dependent module's tables for a domain_id of 0.

Parameters

$schema: An array of table schemas, using the SchemaAPI.

Return value

$tables An array of matching tables.

2 calls to domain_test_schema()
DomainUpdateTest::testDomainUpdate in tests/domain.test
domain_update_module_check in ./domain.module
Checks to see if any dependent modules have a domain_id 0 record left.

File

./domain.module, line 4012
Core module functions for the Domain Access suite.

Code

function domain_test_schema($schema = array()) {
  $tables = array();
  foreach ($schema as $name => $table) {
    if (db_table_exists($name) && isset($table['fields']['domain_id']['type']) && $table['fields']['domain_id']['type'] == 'int') {
      $query = db_select($name)
        ->condition('domain_id', 0);
      $check = $query
        ->countQuery()
        ->execute()
        ->fetchField();
      if ($check) {
        $tables[] = $name;
      }
    }
  }
  return $tables;
}