In Drupal 7, how do I create a custom rules event for any and all file entities? I'm having trouble creating a small module to add an Event scenario to Rules using the Rules API.  Basically, I'm creating a rule that should detect to see if certain fields of a file entity have certain values upon saving that file.  Then, if the conditions are met, the action is to change the URL path alias of /video/ to point to the newest video file in my system (file/[fid])

But I'm getting stuck even creating the new Event to even work.  My code below does succeed in making it appear in the Rules event list, and then when setting conditions, the Data Selector exposes the correct file fields.  But, when I set a very simple condition or even no condition, my action does not fire. 

(A bigger aside: shouldn't the Rules module come pre-packaged with functionality for dealing with file entities?  There are plenty of events for nodes, users, and comments, but nothing for files.)   

So, what is wrong with my code below?

/**
 * Implementation of hook_rules_event_info().
 */
function rules_extended_rules_event_info() {
  return array(
    'rules_extended_rules_event_file_insert' =&gt; array(
      'group' =&gt; t('Entity'),
      'label' =&gt; t('After saving a new entity'),
      'module' =&gt; 'rules_extended',
      'variables' =&gt; array (
        'file' =&gt; array ('type' =&gt; 'entity', 'label' =&gt; t('created entity')),           
      ),
    ),
    'rules_extended_rules_event_file_update' =&gt; array(
      'group' =&gt; t('Entity'),
      'label' =&gt; t('After updating an existing entity'),
      'module' =&gt; 'rules_extended',
      'variables' =&gt; array (
        'file' =&gt; array ('type' =&gt; 'entity', 'label' =&gt; t('updated entity')),
      ),
    ),
  );
}
You can't just declare hook_rules_event_info(), it just tells rules about an event type, but you still need to invoke that event.

To invoke a declare event, use rules_invoke_event().

Example

/**
 * Implements hook_entity_insert().
 */
function rules_extended_entity_insert($entity, $type) {
  if ($type == 'file') {
    rules_invoke_event('rules_extended_rules_event_file_insert', $entity);
  }
}