file_styles.install in Styles 7
Same filename and directory in other branches
Install, update and uninstall functions for the file styles module.
File
contrib/file_styles/file_styles.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the file styles module.
*/
/**
* Implement hook_install().
*/
function file_styles_install() {
// Create the styles directory and ensure it's writable.
$path = 'temporary://file-styles';
file_prepare_directory($path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
}
/**
* Implement hook_uninstall().
*/
function file_styles_uninstall() {
// Remove the styles directory and generated images.
$path = 'temporary://file-styles';
file_unmanaged_delete_recursive($path);
}
/**
* Implement hook_schema().
*/
function file_styles_schema() {
$schema = array();
$schema['cache_file_styles'] = drupal_get_schema_unprocessed('system', 'cache');
$schema['cache_file_styles']['description'] = 'Cache table used to store information file manipulations that are in-progress.';
$schema['file_styles'] = array(
'description' => 'Stores configuration options for file styles.',
'fields' => array(
'msid' => array(
'description' => 'The primary identifier for a file style.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'name' => array(
'description' => 'The style name.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
),
'primary key' => array(
'msid',
),
'indexes' => array(
'name' => array(
'name',
),
),
);
$schema['file_effects'] = array(
'description' => 'Stores configuration options for file effects.',
'fields' => array(
'meid' => array(
'description' => 'The primary identifier for an file effect.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'msid' => array(
'description' => 'The {file_styles}.isid for a file style.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'weight' => array(
'description' => 'The weight of the effect in the style.',
'type' => 'int',
'unsigned' => FALSE,
'not null' => TRUE,
'default' => 0,
),
'name' => array(
'description' => 'The unique name of the effect to be executed.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'data' => array(
'description' => 'The configuration data for the effect.',
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
'serialize' => TRUE,
),
),
'primary key' => array(
'meid',
),
'indexes' => array(
'msid' => array(
'msid',
),
'weight' => array(
'weight',
),
),
'foreign keys' => array(
'msid' => array(
'file_styles' => 'msid',
),
),
);
return $schema;
}
Functions
Name | Description |
---|---|
file_styles_install | Implement hook_install(). |
file_styles_schema | Implement hook_schema(). |
file_styles_uninstall | Implement hook_uninstall(). |