You are here

function calendar_systems_install in Calendar Systems 6.2

Same name and namespace in other branches
  1. 8 calendar_systems.install \calendar_systems_install()
  2. 6.3 calendar_systems.install \calendar_systems_install()
  3. 6 calendar_systems.install \calendar_systems_install()
  4. 7 calendar_systems.install \calendar_systems_install()
  5. 7.2 calendar_systems.install \calendar_systems_install()

Implements hook_install().

Introduces all optional and required patch arrays to the patch_manager.module.

File

./calendar_systems.install, line 23
Implementation of Calendar Systems requirements and un/installation hooks.

Code

function calendar_systems_install() {
  if (module_exists('patch_manager')) {

    // Include patch helpers.
    module_load_include('patch.inc', 'calendar_systems');
    $t = get_t();

    // Introduce module patches to patch_manager.module.
    if (_calendar_systems_patches_pm_insert()) {

      // Set the proper message.
      $message = $t('Calendar Systems patch has been successfully copied to files directory, Also <em>introduced</em> to <a href ="!patch_manager">Patch Manager</a>.', array(
        '!patch_manager' => url('admin/build/patch'),
      ));

      // And notify the user based on environement situation.
      if (_calendar_systems_patches_applied()) {
        drupal_set_message($message . ' ' . $t('Anyway you need not to re-apply the patch.'));
      }
      else {
        drupal_set_message($message . ' ' . $t('But it is <u>not yet applied</u>.'), 'warning');
      }
    }
    else {
      drupal_set_message($t('You have <a href="!patch_manager">Patch Manger</a> installed but we could not copy the Calendar Systems required patches to files directory. Please check permissions and reinstall the module.', array(
        '!patch_manager' => url('admin/build/patch'),
      )), 'warning');
    }
  }
}