You are here

function brightcove_handle_ingest_callback in Brightcove Video Connect 7.7

Same name and namespace in other branches
  1. 7.6 brightcove.module \brightcove_handle_ingest_callback()

Page callback for Brightcove ingestion.

Parameters

$callback: A callback data array returned by brightcove_callback_load().

Return value

null

See also

brightcove_menu()

1 string reference to 'brightcove_handle_ingest_callback'
brightcove_menu in ./brightcove.module
Implements hook_menu().

File

./brightcove.module, line 2682
Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.

Code

function brightcove_handle_ingest_callback($callback) {

  // The metadata here could be obsolete if a module implementing hook_brightcove_ingest() updates it.
  // Best to unset it here. If you need it use brightcove_get_callback_metadata().
  unset($callback['metadata']);
  $fid = $callback['fid'];
  $file = file_load($fid);
  if ($file) {
    file_delete($file);
  }
  db_delete('brightcove_callback')
    ->condition('hash', $callback['hash'])
    ->execute();
  $json = file_get_contents("php://input");
  $data = json_decode($json, TRUE);
  watchdog('ingest', var_export($data, TRUE), [], WATCHDOG_DEBUG);
  module_invoke_all('brightcove_ingest', $callback, $data);
  return NULL;
}