You are here

function kaltura_batch_import in Kaltura 7.3

Imports Kaltura media entries in batch.

Parameters

array $entry_ids: Entry IDs of items to be imported.

int $new_last_updated: Timestamp of maximum of 'updatedAt' properties.

1 string reference to 'kaltura_batch_import'
kaltura_import_submit in includes/kaltura.admin.inc
Form submission handler for kaltura_import().

File

includes/kaltura.admin.inc, line 763
Contains functions for administration use of the kaltura core module.

Code

function kaltura_batch_import(array $entry_ids, $new_last_updated, &$context) {
  if (empty($context['sandbox'])) {
    $context['sandbox']['progress'] = 0;
    $context['sandbox']['max'] = count($entry_ids);

    // Store other needed information for 'finished' callback.
    $context['results']['new last updated'] = $new_last_updated;
  }

  // @todo Make the length value configurable.
  $ids = array_slice($entry_ids, $context['sandbox']['progress'], 100);
  kaltura_import_entries($ids);
  $context['message'] = t('Completed @current of @total.', array(
    '@current' => $context['sandbox']['progress'] + count($ids),
    '@total' => $context['sandbox']['max'],
  ));
  $context['sandbox']['progress'] += 100;
  if ($context['sandbox']['progress'] < $context['sandbox']['max']) {
    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
  }
}