You are here

fancy_file_delete.install in Fancy File Delete 8

Same filename and directory in other branches
  1. 7 fancy_file_delete.install
  2. 2.0.x fancy_file_delete.install

Install File for Fancy File Delete.

File

fancy_file_delete.install
View source
<?php

/**
 * @file
 * Install File for Fancy File Delete.
 */

/**
 * Implements hook_uninstall().
 */
function fancy_file_delete_uninstall() {
  $schema = \Drupal::database()
    ->schema();
  if ($schema
    ->tableExists('unmanaged_files')) {
    $schema
      ->dropTable('unmanaged_files');
  }
}

/**
 * Implements hook_schema().
 */
function fancy_file_delete_schema() {
  $schema = [];
  $schema['unmanaged_files'] = [
    'description' => 'Ironically adding Unmanaged files to the DB so we can use this to delete the files.',
    'fields' => [
      'unfid' => [
        'description' => 'The primary identifier for the entity.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'path' => [
        'description' => 'The path of the file.',
        'type' => 'text',
        'size' => 'big',
        'serialize' => TRUE,
        'object default' => [],
      ],
    ],
    'primary key' => [
      'unfid',
    ],
  ];
  return $schema;
}

/**
 * Implements hook_enable().
 */
function fancy_file_delete_enable() {

  // So the hook_menu items in views shows up.
  drupal_flush_all_caches();
}

Functions

Namesort descending Description
fancy_file_delete_enable Implements hook_enable().
fancy_file_delete_schema Implements hook_schema().
fancy_file_delete_uninstall Implements hook_uninstall().