You are here

function commerce_file_license_issue_by_host_execute in Commerce File 7

Issues licenses based on a host entity

Parameters

$entity_type: The type of the entity.

$entity: The host entity that will be used to issue the licenses.

$license_status: The status for new and updated licenses.

$product_refresh: Enabling this refresh will update the as-purchased snapshot of the files on the line items with the current product files and access limits.

Return value

The count of licenses updated and created. Returns NULL if an error occurred.

1 call to commerce_file_license_issue_by_host_execute()
commerce_file_license_issue_by_host_form_submit in includes/commerce_file_license.forms.inc
Submit callback for commerce_file_license_issue_by_host_form().

File

includes/commerce_file.entities.inc, line 854
Handles file licenses and file license logs

Code

function commerce_file_license_issue_by_host_execute($entity_type, $entity, $license_status = 'pending', $product_refresh = FALSE) {
  $updated_count = 0;
  $license_status = !empty($license_status) ? $license_status : 'pending';
  $callback = 'commerce_file_license_issue_by_' . $entity_type;
  if (function_exists($callback)) {
    try {
      $updated_count = $callback($entity, $license_status, $product_refresh);
    } catch (Exception $e) {
      $updated_count = NULL;
      watchdog_exception('commerce_file', $e);
    }
  }
  return $updated_count;
}