You are here

function ac_update_check_prerequisites in Availability Calendars 7.2

1 string reference to 'ac_update_check_prerequisites'
ac_update_form1 in ac_update/ac_update.module
Retrieve form callback for the admin/config/content/availability-calendars/update1 page.

File

ac_update/ac_update.module, line 395
Availability Calendars update: admin update code

Code

function ac_update_check_prerequisites() {
  $result = array(
    'success' => TRUE,
    'messages' => array(),
  );
  $current_version = drupal_get_installed_schema_version('availability_calendars');
  if ($current_version < 7204) {
    $result['success'] = FALSE;
    $result['messages'][] = array(
      'message' => "The current schema version of Availability Calendars is {$current_version}, which is too old. First update the current module to its latest version by running update.php.",
      'type' => 'error',
    );
  }
  module_load_include('inc', 'availability_calendars', 'availability_calendars');
  $settings = availability_calendars_get_settings();
  if ($settings->pernodeoverride == 1) {
    $result['messages'][] = array(
      'message' => "The current setting for 'Allow to override settings per node' cannot be mimicked in the new version.",
      'type' => 'warning',
    );
  }
  if ($settings->showweeknotes == 1) {
    $result['messages'][] = array(
      'message' => "The new version does not (yet) support the setting 'Show a note before each week of the availability calendars'. This data will not be copied and will get lost on uninstall of the old version.",
      'type' => 'warning',
    );
  }
  if ($settings->hideold == 0) {
    $result['messages'][] = array(
      'message' => "In contrast with your current setting for 'Do not show availability state of dates in the past', the new version always hides availability information from the past.",
      'type' => 'warning',
    );
  }
  if ($settings->splitday == 1) {
    $result['messages'][] = array(
      'message' => "Split day states will be removed from the database, but you can continue to show availablity as split days.",
      'type' => 'warning',
    );
  }
  return $result;
}