Skip to content
colorbox.install 2.07 KiB
Newer Older
/**
 * @file
 * Install, update and uninstall functions for the colorbox module.
 * Implements 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;
}
  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;
// }