You are here

css_injector.install in CSS Injector 6

Same filename and directory in other branches
  1. 7.2 css_injector.install
  2. 7 css_injector.install

File

css_injector.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function css_injector_install() {
  drupal_install_schema('css_injector');
}

/**
 * Implementation of hook_schema().
 */
function css_injector_schema() {
  $schema['css_injector_rule'] = array(
    'fields' => array(
      'crid' => array(
        'description' => 'The primary identifier for the CSS injection rule',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'title' => array(
        'description' => 'The descriptive title of the CSS injection rule',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'rule_type' => array(
        'description' => 'The type of rule to use when determining if the CSS should be injected',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'rule_conditions' => array(
        'description' => 'The data to evaluate when determining if the CSS should be injected',
        'type' => 'text',
        'not null' => TRUE,
      ),
      'media' => array(
        'description' => 'The media type of the CSS file (screen, print, etc.)',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'preprocess' => array(
        'description' => 'Whether the CSS file should be included by the CSS preprocessor',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'crid',
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_uninstall().
 */
function css_injector_uninstall() {
  cache_clear_all('css_injector:*', 'cache', TRUE);
  $results = db_query("SELECT * FROM {css_injector_rule}");
  while ($rule = db_fetch_array($results)) {
    file_delete(file_create_path($rule['file_path']));
  }
  db_query("DROP TABLE {css_injector_rule}");
}

/**
 * Removes file path field from table
 */
function css_injector_update_6000() {
  $ret = array();
  db_drop_field($ret, 'css_injector_rule', 'file_path');
  return $ret;
}

Functions

Namesort descending Description
css_injector_install Implementation of hook_install().
css_injector_schema Implementation of hook_schema().
css_injector_uninstall Implementation of hook_uninstall().
css_injector_update_6000 Removes file path field from table