Skip to content
css_injector.install 2.02 KiB
Newer Older
function css_injector_install() {
  drupal_install_schema('css_injector');
}

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;
}

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;
}