domain_source.install in Domain Access 7.3
Same filename and directory in other branches
Install file for the Domain Source module
File
domain_source/domain_source.installView source
<?php
/**
* @file
* Install file for the Domain Source module
*/
/**
* Implements hook_schema().
*/
function domain_source_schema() {
$schema['domain_source'] = array(
'description' => 'Stores the canonical domain for each node.',
'fields' => array(
'nid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'domain_id' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'nid',
),
'foreign_keys' => array(
'nid' => array(
'node' => 'nid',
),
'domain_id' => array(
'domain' => 'domain_id',
),
),
);
return $schema;
}
/**
* Implements hook_dependencies().
*/
function domain_source_update_dependencies() {
$dependencies['domain_source'][7300] = array(
'domain' => 7303,
);
return $dependencies;
}
/**
* Remove references to row 0.
*/
function domain_source_update_7300(&$sandbox) {
$default_id = db_query("SELECT domain_id FROM {domain} WHERE is_default = 1")
->fetchField();
db_update('domain_source')
->fields(array(
'domain_id' => $default_id,
))
->condition('domain_id', 0)
->execute();
return t('Domain Source zero records removed.');
}
Functions
Name | Description |
---|---|
domain_source_schema | Implements hook_schema(). |
domain_source_update_7300 | Remove references to row 0. |
domain_source_update_dependencies | Implements hook_dependencies(). |