mee.install in Scald: Media Management made easy 6
Implementation of hook_install().
File
mee/mee.installView source
<?php
// $Id;
/**
* @file
* Implementation of hook_install().
*/
function mee_install() {
drupal_load('module', 'content');
content_notify('install', 'mee');
drupal_install_schema('mee');
}
/**
* Implementation of hook_uninstall().
*/
function mee_uninstall() {
drupal_load('module', 'content');
content_notify('uninstall', 'mee');
drupal_uninstall_schema('mee');
}
/**
* Implementation of hook_disable().
*/
function mee_disable() {
drupal_load('module', 'content');
content_notify('disable', 'mee');
}
/**
* Add separate column for the required status
*/
function mee_update_6001() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {mee_ressources} ADD required INT NOT NULL DEFAULT 0");
break;
}
return $ret;
}
/**
* Include the 'field' field in the primary key.
*/
function mee_update_6002() {
$ret = array();
$ret[] = update_sql("ALTER TABLE {mee_ressources} DROP PRIMARY KEY, ADD PRIMARY KEY(content_nid, atom_sid, field)");
return $ret;
}
/**
* Add a copyright field.
*/
function mee_update_6003() {
$ret = array();
$ret[] = update_sql("ALTER TABLE {mee_ressources} ADD copyright TEXT");
return $ret;
}
/**
* Implementation of hook_schema().
*/
function mee_schema() {
$schema['mee_ressources'] = array(
'fields' => array(
'content_nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'atom_sid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'field' => array(
'type' => 'varchar',
'length' => 31,
'not null' => TRUE,
'default' => '',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'required' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'copyright' => array(
'type' => 'text',
),
),
'primary key' => array(
'content_nid',
'atom_sid',
'field',
),
);
return $schema;
}
Functions
Name | Description |
---|---|
mee_disable | Implementation of hook_disable(). |
mee_install | @file Implementation of hook_install(). |
mee_schema | Implementation of hook_schema(). |
mee_uninstall | Implementation of hook_uninstall(). |
mee_update_6001 | Add separate column for the required status |
mee_update_6002 | Include the 'field' field in the primary key. |
mee_update_6003 | Add a copyright field. |