| 1 |
<?php
|
| 2 |
// $Id: video_cck.install,v 1.1 2007/06/05 16:43:59 aaron Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function video_cck_install() {
|
| 8 |
}
|
| 9 |
|
| 10 |
/**
|
| 11 |
* we need to make sure to show our new 'embed code' filter on views
|
| 12 |
*/
|
| 13 |
function video_cck_update_1() {
|
| 14 |
return _video_cck_update_reset_cache();
|
| 15 |
}
|
| 16 |
|
| 17 |
/**
|
| 18 |
* we need a new data field for extra info stored by certain providers, such as blip.tv
|
| 19 |
*/
|
| 20 |
function video_cck_update_2() {
|
| 21 |
$ret = array();
|
| 22 |
|
| 23 |
include_once('./'. drupal_get_path('module', 'content') .'/content.module');
|
| 24 |
include_once('./'. drupal_get_path('module', 'content') .'/content_admin.inc');
|
| 25 |
|
| 26 |
content_clear_type_cache();
|
| 27 |
$fields = content_fields();
|
| 28 |
|
| 29 |
foreach ($fields as $field) {
|
| 30 |
switch ($field['type']) {
|
| 31 |
case 'video_cck':
|
| 32 |
$columns = array(
|
| 33 |
'data' => array('type' => 'longtext', 'not null' => TRUE, 'default' => "''", 'sortable' => false),
|
| 34 |
);
|
| 35 |
// the following line will trigger (negligible) warnings if video_cck_update_2 was run before
|
| 36 |
// (column already exists)
|
| 37 |
@content_alter_db_field(array(), array(), $field, $columns);
|
| 38 |
break;
|
| 39 |
}
|
| 40 |
}
|
| 41 |
$ret = _video_cck_update_reset_cache();
|
| 42 |
$ret[] = update_sql("DELETE FROM {cache}");
|
| 43 |
return $ret;
|
| 44 |
}
|
| 45 |
|
| 46 |
function _video_cck_update_reset_cache() {
|
| 47 |
$ret = array();
|
| 48 |
$ret[] = update_sql("DELETE FROM {cache_content}");
|
| 49 |
$ret[] = update_sql("DELETE FROM {cache_views}");
|
| 50 |
return $ret;
|
| 51 |
}
|
| 52 |
|