You are here

markup.install in Markup 6

Same filename and directory in other branches
  1. 7 markup.install

Install, update and uninstall functions for Markup module.

File

markup.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for Markup module.
 */

/**
 * Implements hook_install().
 */
function markup_install() {
  drupal_load('module', 'content');
  content_notify('install', 'markup');
}

/**
 * Implements hook_uninstall().
 */
function markup_uninstall() {
  drupal_load('module', 'content');
  content_notify('uninstall', 'markup');
}

/**
 * Implements hook_enable().
 *
 * Notify content module when this module is enabled.
 */
function markup_enable() {
  drupal_load('module', 'content');
  content_notify('enable', 'markup');
}

/**
 * Implements hook_disable().
 *
 * Notify content module when this module is disabled.
 */
function markup_disable() {
  drupal_load('module', 'content');
  content_notify('disable', 'markup');
}

/**
 * Convert text_markup setting to markup since form_markup module
 * no longer uses markup setting in D6.
 */
function markup_update_6000() {
  $ret = array();
  $rebuild_cache = FALSE;
  $result = db_query("SELECT * FROM {content_node_field} WHERE type = 'markup'");
  while ($markup = db_fetch_object($result)) {
    $global_settings = unserialize($markup->global_settings);
    if (isset($global_settings['text_markup'])) {
      $global_settings['markup'] = $global_settings['text_markup'];
      unset($global_settings['text_markup']);

      // We can't use update_sql() here because of curly braces in serialized array.
      db_query("UPDATE {content_node_field} SET global_settings = '%s' WHERE field_name = '%s'", serialize($global_settings), $markup->field_name);
      $ret[] = array(
        'success' => TRUE,
        'query' => strtr('Settings updated for field %field', array(
          '%field' => check_plain($markup->field_name),
        )),
      );
      $rebuild_cache = TRUE;
    }
  }

  // Rebuild content caches only if necessary.
  if ($rebuild_cache) {
    content_clear_type_cache();
  }
  return $ret;
}

/**
 * Rebuild theme registry.
 */
function markup_update_6100() {
  $ret = array();
  drupal_rebuild_theme_registry();
  $ret[] = array(
    'query' => t('Theme Registry cleared.'),
    'success' => TRUE,
  );
  return $ret;
}

Functions

Namesort descending Description
markup_disable Implements hook_disable().
markup_enable Implements hook_enable().
markup_install Implements hook_install().
markup_uninstall Implements hook_uninstall().
markup_update_6000 Convert text_markup setting to markup since form_markup module no longer uses markup setting in D6.
markup_update_6100 Rebuild theme registry.