Project

General

Profile

Paste
Download (3.94 KB) Statistics
| Branch: | Revision:

root / drupal7 / sites / all / modules / media_youtube / media_youtube.install @ 70a4c29b

1
<?php
2

    
3
/**
4
 * @file
5
 * Install, update and uninstall functions for the Media: YouTube module.
6
 */
7

    
8
/**
9
 * Clear style and preset caches.
10
 */
11
function media_youtube_update_7001() {
12
  // We don't do this if we're using version 1 of Styles.
13
  if (function_exists('styles_style_flush')) {
14
    styles_style_flush();
15
  }
16

    
17
  return array();
18
}
19

    
20
/**
21
 * Add label to Media: YouTube file style.
22
 */
23
function media_youtube_update_7003() {
24
  return array();
25
}
26

    
27
/**
28
 * Rebuild themes.
29
 */
30
function media_youtube_update_7004() {
31
  drupal_theme_rebuild();
32
  return array();
33
}
34

    
35
/**
36
 * Add a large video preset and medium thumbnail.
37
 */
38
function media_youtube_update_7005() {
39
  return array();
40
}
41

    
42
/**
43
 * Add a square thumbnail preset.
44
 */
45
function media_youtube_update_7006() {
46
  return array();
47
}
48

    
49
/**
50
 * Rebuild the registry to locate class files in new location.
51
 */
52
function media_youtube_update_7007() {
53
  registry_rebuild();
54
}
55

    
56
/**
57
 * Rebuild styles presets to use camelCase.
58
 */
59
function media_youtube_update_7008() {
60
  return array();
61
}
62

    
63
/**
64
 * Change default styles presets.
65
 */
66
function media_youtube_update_7009() {
67
  return array();
68
}
69

    
70
/**
71
 * Change default styles presets.
72
 */
73
function media_youtube_update_7010() {
74
  return array();
75
}
76

    
77
/**
78
 * Add video presets based on Image styles.
79
 */
80
function media_youtube_update_7011() {
81
  return array();
82
}
83

    
84
/**
85
 * Rebuild theme and formatters.
86
 */
87
function media_youtube_update_7012() {
88
  return array();
89
}
90

    
91
/**
92
 * Add new browser for media.
93
 */
94
function media_youtube_update_7200() {
95
  return array();
96
}
97

    
98
/**
99
 * Clean up file display formatters and migrate settings.
100
 */
101
function media_youtube_update_7201() {
102
  // Required to run file_displays_load() in update.php.
103
  module_load_include('inc', 'file_entity', 'file_entity.file_api');
104

    
105
  // Get view modes.
106
  $video_view_modes = field_view_mode_settings('file', "video");
107
  $video_view_modes['default'] = array('custom_settings' => TRUE);
108
  foreach ($video_view_modes as $view_mode => $custom_settings) {
109

    
110
    $formatters = file_displays_load('video', $view_mode);
111
    $formatter = 'video__' . $view_mode . '__media_youtube_video';
112

    
113
    if (isset($formatters[$formatter])) {
114

    
115
      // Migrate chromeless=1 or controls='0' to autohide=1, showinfo=0.
116
      if (isset($formatters[$formatter]->settings['chromeless'])) {
117
        if ($formatters[$formatter]->settings['chromeless'] == 1) {
118
          $formatters[$formatter]->settings['autohide'] = 1;
119
          $formatters[$formatter]->settings['showinfo'] = 0;
120
        }
121
      }
122
      if (isset($formatters[$formatter]->settings['controls'])) {
123
        if ($formatters[$formatter]->settings['controls'] == 0) {
124
          $formatters[$formatter]->settings['autohide'] = 1;
125
          $formatters[$formatter]->settings['showinfo'] = 0;
126
        }
127
      }
128

    
129
      // Remove deprecated settings from the exportable array.
130
      foreach (array('version', 'fullscreen', 'hd', 'showsearch', 'controls', 'chromeless') as $deprecated) {
131
        if (isset($formatters[$formatter]->settings[$deprecated])) {
132
          unset($formatters[$formatter]->settings[$deprecated]);
133
        }
134
      }
135

    
136
      // Save the ctools objects
137
      $display = $formatters[$formatter];
138
      file_display_save((object) $display);
139
    }
140
  }
141
  return array();
142
}
143

    
144
/**
145
 * Empty update function.
146
 */
147
function media_youtube_update_7202() {
148
  // Code removed in response to http://drupal.org/node/1911970.
149
}
150

    
151
/**
152
 * Remove obsolete variables.
153
 */
154
function media_youtube_update_7203() {
155
  foreach (array('width', 'height', 'autohide', 'autoplay', 'color', 'enablejsapi', 'loop', 'modestbranding', 'nocookie', 'origin', 'protocol', 'protocol_specify', 'rel', 'showinfo', 'theme') as $setting) {
156
    variable_del("media_youtube__{$setting}");
157
  }
158
}
159

    
160
/**
161
 * Update the Media YouTube browser's access check.
162
 *
163
 * Check your permissions; after this update the Media YouTube browser will be
164
 * available to users with the "administer files" or "add media from remote
165
 * sources" permissions only.
166
 */
167
function media_youtube_update_7204() {
168
}