You are here

campaignmonitor_campaign.install in Campaign Monitor 8

Install functions.

File

modules/campaignmonitor_campaign/campaignmonitor_campaign.install
View source
<?php

/**
 * @file
 * Install functions.
 */

/**
 * Implements hook_install().
 *
 * Create the file directory that we need.
 */
function campaignmonitor_campaign_install() {
  $path = \Drupal::service('file_system')
    ->realpath("public://");
  $dir = '/campaignmonitor';
  mkdir($path . $dir);
}

/**
 * Implements hook_uninstall().
 *
 * Remove the file directory and all files.
 */
function campaignmonitor_campaign_uninstall() {
  $path = \Drupal::service('file_system')
    ->realpath("public://");
  $dir = '/campaignmonitor';
  $dirname = $path . $dir;
  array_map('unlink', glob("{$dirname}/*.*"));
  rmdir($dirname);
}