You are here

function calendar_systems_enable in Calendar Systems 6.2

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

Implements hook_enable().

Checks environments and sets appropriate messages.

File

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

Code

function calendar_systems_enable() {

  // Note user that the target files should be writable by the webserver.
  $notice = t('Also notice that you need to make <em>patch target files</em> writable for webserver (0646) or you cannot patch them via the web interface of these modules.');

  // Warn that the module is not usable till the she apply required patches correctly.
  $warning = t('Even though the <a href="!link">Calendar Systems</a> module is now enabled, it is useless till you properly apply all required patches.', array(
    '!link' => url('admin/settings/date-time/calendars'),
  ));

  // Include patch helpers.
  module_load_include('patch.inc', 'calendar_systems');

  // Check if the required patches are applied and set the corresponding message.
  if (_calendar_systems_patches_applied()) {
    drupal_set_message(t('<a href="!link">Calendar Systems</a> is now successfully installed and running.', array(
      '!link' => url('admin/settings/date-time/calendars'),
    )));
  }
  else {
    drupal_set_message($warning, 'warning');
    drupal_set_message($notice, 'warning');
  }
}