You are here

function emvideo_update_2 in Embedded Media Field 6.2

Same name and namespace in other branches
  1. 6.3 contrib/emvideo/emvideo.install \emvideo_update_2()
  2. 6 contrib/emvideo/emvideo.install \emvideo_update_2()

We need a new data field for extra info stored by certain providers, such as blip.tv.

File

contrib/emvideo/emvideo.install, line 135
Installation, configuration, and removal of the emvideo module.

Code

function emvideo_update_2() {
  $ret = array();
  include_once './' . drupal_get_path('module', 'content') . '/content.module';
  include_once './' . drupal_get_path('module', 'content') . '/includes/content.admin.inc';
  content_clear_type_cache();
  $fields = content_fields();
  foreach ($fields as $field) {
    switch ($field['type']) {
      case 'emvideo':
        $columns = array(
          'data' => array(
            'type' => 'longtext',
            'not null' => TRUE,
            'default' => "''",
            'sortable' => FALSE,
          ),
        );

        // the following line will trigger (negligible) warnings if emvideo_update_2 was run before
        // (column already exists)
        @content_alter_db_field(array(), array(), $field, $columns);
        break;
    }
  }
  $ret = _emvideo_update_reset_cache();
  $ret[] = update_sql("DELETE FROM {cache}");
  return $ret;
}