Projet

Général

Profil

Paste
Télécharger (2,23 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ddblock / ddblock.install @ 87dbc3bf

1
<?php
2

    
3
/**
4
 * @file
5
 * Installation file to implement the dynamic display block schema
6
 */
7

    
8
/**
9
 * Implements hook_schema().
10
 */
11
function ddblock_schema() {
12
  $schema['ddblock_block'] = array(
13
    'description' => 'The base tables for ddblocks.',
14
    'fields' => array(
15
      'delta' => array(
16
        'description' => 'Number of the block.',
17
        'type' => 'serial',
18
        'unsigned' => TRUE,
19
        'not null' => TRUE,
20
      ),
21
      'title' => array(
22
        'description' => 'Title of the block.',
23
        'type' => 'varchar',
24
        'length' => 64,
25
        'not null' => TRUE,
26
        'default' => '',
27
      ),
28
      'module' => array(
29
        'description' => 'The name of the module that provided the original block.',
30
        'type' => 'varchar',
31
        'length' => 64,
32
        'not null' => TRUE,
33
        'default' => '',
34
      ),
35
      'delta_original' => array(
36
        'description' => 'The delta of the original block.',
37
        'type' => 'varchar',
38
        'length' => 32,
39
        'not null' => TRUE,
40
        'default' => '0',
41
      ),
42
      'enabled' => array(
43
        'description' => 'Support for dynamic display block enabled.',
44
        'type' => 'int',
45
        'size' => 'tiny',
46
        'unsigned' => TRUE,
47
        'not null' => TRUE,
48
        'default' => 0,
49
      ),
50
    ),
51
    'primary key' => array('delta'),
52
  );
53

    
54
  return $schema;
55
}
56

    
57
/**
58
 * Implements hook_install().
59
 */
60
function ddblock_install() {
61
  // TODO The drupal_(un)install_schema functions are called automatically in D7.
62
  // drupal_install_schema('ddblock')
63
}
64

    
65
/**
66
 * Implements hook_uninstall().
67
 */
68
function ddblock_uninstall() {
69
  //Drop tables
70
  // TODO The drupal_(un)install_schema functions are called automatically in D7.
71
  // DONE these lines can be removed
72
  // drupal_uninstall_schema('ddblock')
73
  // Remove variables
74
  // TODO Please review the conversion of this statement to the D7 database API syntax.
75
  // DONE
76
  /* db_query("DELETE FROM {variable} WHERE name LIKE 'ddblock_%%'") */
77
  db_delete('variable')
78
  ->condition('name', 'ddblock_%%', 'LIKE')
79
  ->execute();
80
  cache_clear_all('variables', 'cache');
81
  drupal_set_message(t("Dynamic display block module uninstalled successfully."));
82
}