You are here

video_s3.module in Video 6.5

Same filename and directory in other branches
  1. 6.4 plugins/video_s3/video_s3.module

Provides wrapper functions for the s3 amazon webservices.

File

plugins/video_s3/video_s3.module
View source
<?php

/**
 * @file
 * Provides wrapper functions for the s3 amazon webservices.
 */

/**
 * Implementation of hook_cron().
 */
function video_s3_cron() {
  if (!_video_s3_is_active_fs()) {
    return;
  }
  module_load_include('lib.inc', 'video_s3');
  $s3 = new video_amazon_s3();
  $s3
    ->connect();
  $s3
    ->updateAllExpiresHeaders();
}

/**
 * Implementation of hook_video_update().
 *
 * Submit handler to update our s3 table to include the node id.
 */
function video_s3_video_update($form, &$form_state) {

  // Lets update our video rending table to include the node id created
  if (isset($form_state['nid']) && isset($form_state['values']['video_id']) && is_array($form_state['values']['video_id'])) {
    foreach ($form_state['values']['video_id'] as $fid) {

      // Lets update our table to include the nid
      db_query('UPDATE {video_s3} SET nid = %d WHERE fid = %d', $form_state['nid'], $fid);
    }
  }
}
function video_s3_get_object_info($object) {
  module_load_include('lib.inc', 'video_s3');
  $s3 = new video_amazon_s3();
  $s3
    ->connect();
  return $s3
    ->get_object_info($object);
}
function video_s3_get_object($object, $save_to = FALSE) {
  module_load_include('lib.inc', 'video_s3');
  $s3 = new video_amazon_s3();
  $s3
    ->connect();
  return $s3
    ->get_object($object, $save_to);
}
function _video_s3_is_active_fs() {
  return variable_get('vid_filesystem', 'drupal') === 'video_s3';
}
function video_s3_ctools_plugin_directory($module, $plugin) {
  if ($module == 'video' && $plugin == 'filesystem') {
    return 'filesystem';
  }
}