fields(array('sitename' => 'foobar')) ->condition('domain_id', $domain['domain_id']) ->execute(); } } /** * Implements hook_domain_update(). * * Change the sitename value to 'testfoo'. */ function domain_test_domain_update($domain, $form_values = array()) { if ($domain['sitename'] == 'foobar') { db_update('domain') ->fields(array('sitename' => 'testfoo')) ->condition('domain_id', $domain['domain_id']) ->execute(); } } /** * Implements hook_domain_delete(). * * On deletion, set the test static to 'deleted'. */ function domain_test_domain_delete($domain) { domain_test_set('delete'); } /** * Implements hook_domain_cron(). * * We should both receive a $domain array and be setting the active * domain to the current $domain, so we can test both here. */ function domain_test_domain_cron($domain) { $_domain = domain_get_domain(); if ($_domain['domain_id'] == $domain['domain_id']) { domain_test_set($domain['sitename']); } else { domain_test_set('Failed'); } } /** * Implements hook_domain_validate_alter(). * * Remove any errors on validation. */ function domain_test_domain_validate_alter(&$errors, $subdomain) { if ($subdomain == 'thisshouldfail') { $errors = array(); } } /** * Implements hook_domain_bootstrap_lookup(). * * Match 'local.test' to 'newtest.example.com'. */ function domain_test_domain_bootstrap_lookup($domain) { if ($domain != 'local.test') { return; } $domain = domain_lookup(NULL, 'newtest.example.com', TRUE); return $domain; } /** * Implements hook_domain_bootstrap_full(). * * Add a $domain['test_full'] element to the array. */ function domain_test_domain_bootstrap_full($domain) { $GLOBALS['_domain']['test_full'] = TRUE; }