I was wondering what is the use of the machine_name key in the mentioned hook. I noticed that the following code doesn't work:

function cr_info_cdn_unique_file_identifier_info(){

  $identifier['cr_deploy_mtime_compare'] = array(
    'label'   => t('Most recent of Deployment Date or MTime'),
    'machine_name'   => 'some_machine_name',
    'description'   => t('Uses the most resent of either the deployment or the modification time of the file'),
    'filesystem'   => TRUE,
    'callback'  =>  '_cr_info_deploy_mtime_compare',
    'prefix' => 'deploymtime',
 );
}

This is because the key returned array key 'cr_deploy_mtime_compare' does not match the machine name 'some_machine_name' (see line 232 in cdn.basic.farfuture.inc file). If these 2 keys need to be identical why do we use a machine name anymore?

CommentFileSizeAuthor
#3 1434358-3_D7.patch2.96 KBWim Leers
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Good find. I'll look into this. Seems like a design fail on my behalf.

andreiashu’s picture

Correct me if I'm wrong but I think the machine_name key was meant so that we can use it as a UFI identifier in the 'cdn_farfuture_unique_identifier_mapping' variable.? This is what I thought initially.

Which means that, given the above implementation of an identifier, I should be able to have this in my textarea mapping:

sites/all/modules/*:sites/all/themes/*|some_machine_name
Wim Leers’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Assigned: Unassigned » Wim Leers
Category: support » bug
Priority: Normal » Minor
Status: Active » Needs review
FileSize
2.96 KB

Design fail it is. Currently, the array key *must* match the machine name. Patch for D7 attached. Probably applies to D6 as well.

Wim Leers’s picture

Title: Use of machine_name key in hook_cdn_unique_file_identifier_info() implementation » Clean-up: keys in hook_cdn_unique_file_identifier_info() implementations *are* the machine names
Category: bug » task
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.