summaryrefslogtreecommitdiffstats
path: root/colorbox.install
blob: 956de0383146981310ffd6fa2e63639c66dfe772 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
// $Id$

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

/**
 * Implementation of hook_requirements().
 */
function colorbox_requirements($phase) {
  $requirements = array();

  if ($phase == 'runtime') {
    $t = get_t();
    $status = _colorbox_status();

    if (!$status['colorbox_plugin']) {
      $requirements['colorbox_plugin'] = array(
        'title' => $t('Colorbox plugin'),
        'value' => $t('At least @a', array('@a' => COLORBOX_MIN_PLUGIN_VERSION)),
        'severity' => REQUIREMENT_ERROR,
        'description' => $t('You need to download the !colorbox and extract the entire contents of the archive into the %path folder of your server.', array('!colorbox' => l(t('Colorbox plugin'), 'http://colorpowered.com/colorbox/'), '%path' => 'sites/all/libraries')),
      );
    }
    else {
      $requirements['colorbox_plugin'] = array(
        'title' => $t('Colorbox plugin'),
        'severity' => REQUIREMENT_OK,
        'value' => colorbox_get_version(),
      );
    }
  }

  return $requirements;
}

/**
 * Implementation of hook_uninstall().
 */
function colorbox_uninstall() {
  db_query("DELETE FROM {variable} WHERE name LIKE 'colorbox_%'");
}

/**
 * Provides a upgrade path for Thickbox users.
 * Replaces "thickbox" with "colorbox" in
 * content_node_field_instance -> display_settings
 */
// function colorbox_update_6001() {
//   $ret = array();
//
//   $result = db_query("SELECT *  FROM {content_node_field_instance}");
//   while ($type = db_fetch_array($result)) {
//     $new_settings = array();
//     $display_settings = unserialize($type['display_settings']);
//     if (!empty($display_settings)) {
//       foreach ($display_settings as $key => $val) {
//         $new_settings[$key] = $val;
//         if ($key == 'format' && is_array($val)) {
//           $new_settings[$key]['exclude'] = 0;
//         }
//       }
//     }
//     db_query("UPDATE {content_node_field_instance} SET display_settings='%s' WHERE field_name='%s' AND type_name='%s'", serialize($new_settings), $type['field_name'], $type['type_name']);
//   }
//
//   return $ret;
// }