google_adwords_remarketing.install in Google Adwords Remarketing 6
Same filename and directory in other branches
Installation file for Google Adwords Remarketing module.
File
google_adwords_remarketing.installView source
<?php
// $Id$
/**
* @file
* Installation file for Google Adwords Remarketing module.
*/
/**
* Implementation of hook_install().
*/
function google_adwords_remarketing_install() {
// Create tables
drupal_install_schema('google_adwords_remarketing_roles');
$created = drupal_install_schema('google_adwords_remarketing');
if ($created) {
drupal_set_message(t('Google AdWords Remarketing module installed successfully. You must set <a href="/admin/user/permissions#module-google_adwords_remarketing">permissions</a> and <a href="/admin/settings/google_adwords_remarketing_remarketing">configure</a> the module. '));
}
else {
drupal_set_message(t('Table installation for the Google AdWords Remarketing module was unsuccessful. The tables may need to be installed by hand. See google_adwords_remarketing_remarketing.install file for a list of the installation queries.'), 'error');
}
return;
}
/**
* Implementation of hook_schema().
*/
function google_adwords_remarketing_schema() {
$schema['google_adwords_remarketing'] = array(
'description' => t('Stores (GARC) Google AdWords Remarketing Campaigns'),
'primary key' => array(
'garcid',
),
'fields' => array(
'garcid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => t('Primary Key: Unique GARC ID.'),
),
'info' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'GARC Administrative description.',
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'GARC Enabled status. (1 = enabled, 0 = disabled)',
),
'theme' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
'description' => 'The theme under which the GARC settings apply.',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'GARC weight.',
),
'visibility' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'Flag to indicate how to show GARC on pages. (0 = Show on all pages except listed pages, 1 = Show only on listed pages, 2 = Use custom PHP code to determine visibility)',
),
'pages' => array(
'type' => 'text',
'not null' => TRUE,
'description' => 'Contents of the "Pages" GARC; contains either a list of paths on which to include/exclude the GARC or PHP code, depending on "visibility" setting.',
),
'conversion_id' => array(
'type' => 'varchar',
'default' => '',
'length' => 15,
'not null' => TRUE,
'description' => 'GARC Conversion ID.',
),
'language' => array(
'type' => 'varchar',
'default' => 'en_US',
'length' => 15,
'description' => 'GARC Conversion Language.',
),
'format' => array(
'type' => 'varchar',
'default' => '3',
'length' => 10,
'not null' => TRUE,
'description' => 'GARC Conversion Format.',
),
'color' => array(
'type' => 'varchar',
'default' => '',
'length' => 10,
'description' => 'GARC Conversion Color.',
),
'label' => array(
'type' => 'varchar',
'default' => '',
'length' => 255,
'description' => 'GARC Conversion Label.',
),
'ext_js' => array(
'type' => 'varchar',
'default' => 'http://www.googleadservices.com/pagead/conversion.js',
'length' => 255,
'not null' => TRUE,
),
),
);
$schema['google_adwords_remarketing_roles'] = array(
'description' => 'Sets up access permissions for google adwords remarketing Campaigns based on user roles',
'fields' => array(
'garcid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'rid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => "The user's role ID from {users_roles}.rid.",
),
),
'primary key' => array(
'garcid',
'rid',
),
'indexes' => array(
'rid' => array(
'rid',
),
),
);
return $schema;
}
/**
* Implementation of hook_uninstall().
*/
function google_adwords_remarketing_uninstall() {
// Remove tables
drupal_uninstall_schema('google_adwords_remarketing_roles');
$deleted = drupal_uninstall_schema('google_adwords_remarketing');
if ($deleted) {
drupal_set_message(t('Google AdWords Remarketing module has been uninstalled successfully.'));
}
else {
drupal_set_message(t('Table removal for the Google AdWords Remarketing module was unsuccessful. The tables may need to be uninstalled by hand. See google_adwords_remarketing.install file for a list of the uninstall queries.'), 'error');
}
return;
}
Functions
Name![]() |
Description |
---|---|
google_adwords_remarketing_install | Implementation of hook_install(). |
google_adwords_remarketing_schema | Implementation of hook_schema(). |
google_adwords_remarketing_uninstall | Implementation of hook_uninstall(). |