photos.install in Album Photos 8.4
Same filename and directory in other branches
Install, update, and uninstall functions for the Photos module.
File
photos.installView source
<?php
/**
* @file
* Install, update, and uninstall functions for the Photos module.
*/
/**
* Implements hook_schema().
*/
function photos_schema() {
$schema['photos_album'] = [
'fields' => [
'pid' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'fid' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'wid' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
],
'count' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'data' => [
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
],
],
'indexes' => [
'fid' => [
'fid',
],
'wid' => [
'wid',
],
],
'primary key' => [
'pid',
],
];
$schema['photos_image'] = [
'fields' => [
'fid' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'pid' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'title' => [
'description' => 'The title of this image.',
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'default' => '',
],
'des' => [
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
],
'wid' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
],
'count' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'comcount' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'exif' => [
'type' => 'int',
'size' => 'tiny',
'length' => 1,
'default' => 0,
],
],
'indexes' => [
'pid' => [
'pid',
],
'wid' => [
'wid',
],
'count' => [
'count',
],
'comcount' => [
'comcount',
],
],
'primary key' => [
'fid',
],
];
$schema['photos_comment'] = [
'fields' => [
'fid' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'cid' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
],
'indexes' => [
'fid' => [
'fid',
],
'cid' => [
'cid',
],
],
];
$schema['photos_node'] = [
'fields' => [
'nid' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'fid' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'wid' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
],
],
'indexes' => [
'nid' => [
'nid',
],
'fid' => [
'fid',
],
'wid' => [
'wid',
],
],
];
$schema['photos_count'] = [
'fields' => [
'id' => [
'type' => 'serial',
'not null' => TRUE,
],
'cid' => [
'type' => 'int',
'default' => 0,
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'changed' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'type' => [
'type' => 'varchar',
'length' => 12,
'default' => '',
'not null' => TRUE,
],
'value' => [
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
],
'indexes' => [
'cid' => [
'cid',
],
'type' => [
'type',
],
'value' => [
'value',
],
],
'primary key' => [
'id',
],
];
return $schema;
}
/**
* Implements hook_install().
*/
function photos_install() {
\Drupal::messenger()
->addMessage(t("Photos settings are available under admin/config/media/photos."));
\Drupal::messenger()
->addMessage(t("New permissions are available for Photos admin/people/permissions#module-photos."));
}
/**
* Remove old variables that are no longer in use from photos.settings.
*/
function photos_update_8401(&$sandbox) {
$config = \Drupal::service('config.factory')
->getEditable('photos.settings');
$config
->clear('photos_search_max_id_ever')
->save();
$config
->clear('photos_search_reindex_old_photos')
->save();
$config
->clear('photos_search_max_id_reindex')
->save();
$config
->clear('photos_print_sizes')
->save();
$config
->clear('photos_vote')
->save();
}
Functions
Name | Description |
---|---|
photos_install | Implements hook_install(). |
photos_schema | Implements hook_schema(). |
photos_update_8401 | Remove old variables that are no longer in use from photos.settings. |