One more go on the media mover hook

Here's the cleaned up version of the media mover hook. Changes are: renamed "new_config" to "new config", added "edit config", created support for editing and deleting individual configurations. There's quite a bit of clean up on the main media_mover module in this round, but obviously there is a fair bit to go, particularly in the admin side of things.

I'm considering adding a testing option into the hook to provide the admin an opportunity to run a config and see live error reporting on a specific configuration. Since there are potentially so many places for issues, it would be nice to get a report instead of digging through drupal's error logs.

Additionally, while the module currently runs on cron, I'd like to expose each configuration (ie: a set of harvest, process, and store settings) as an action so that a specific configuration can be run via workflows. Originally, I had planned on integrating this system directly with workflows, but I think this is a better way to integrate because of the tight integration between the three parts of the process.

/**
 * Implementation of media_mover hook
 */
function media_mover_media_mover($op, $action = null, $configuration = null, &$file = array() ) {

switch ($op) {

// give your driver a distinct name
case 'name':
  return "Media Mover module";
break;

// create a new configuration option set
// $action is used to ensure namespacing is kept consistent, form
// elements must be named $form[{$action}:your variable name]
// returns a form array
case 'new config':
  switch($action){
    case "harvest:select drupal uploaded files":
      return _media_mover_admin_harvest_new_config($action);
    break;
  }
break;

// create edit configuration option set
// $action is used to ensure namespacing is kept consistent, form
// elements must be named $form[{$action}:your variable name]
// $configuration is an array, settings stored on a per config basis
case 'edit config':
  switch($action){
    case "harvest:select drupal uploaded files":
      return _media_mover_admin_harvest_edit_config($action, $configuration);
    break;
}
break;

// set standard configuration for this module
// displayed on admin/settings/media_mover
// returns a form array
case 'admin':
  return _media_mover_admin();
break;

// defines what type of driver this module is
// array of harvest, process, storage
// a module may operate more than one verb
case 'verbs':
  return array("harvest");
break;

// defines the name of what this module does
// array of definitions
case 'actions':
  return array("select drupal uploaded files");
break;

// defines directories (under master media_mover directory)
// this module uses
// array of directories, will be created under the default
// media_mover directory, set in admin
case 'directories':
break;

// allows for module to add additional data in a different db
// add file to db action. called from media_mover's mm_files_db_add
// by default, medial_mover's files table is used. $file is available
case 'add':
break;

// allows for module to fetch additional data
// added to $file to db action. called from media_mover's mm_files_db_fetch
// by default, medial_mover's files table is used. $file is available
case 'fetch':
break;

// allows for module to update additional critera
// add file to db action. called from media_mover's mm_files_db_update
// by default, medial_mover's files table is used. $file is available
case 'update':
break;

// functions called on harvest op
// returns an array of $files
case 'harvest':
  return _mm_harvest();
break;

// functions called on process op
case 'process':
break;

// functions called on storage op
case 'storage':
break;

// custom theme a file assoicated with this module
case 'theme':
break;

default:
  return;
break;

}
return;
}

Download media_mover and related files

Any word on when the local

Any word on when the local storage module will be done?

I have a version that I wrote, but I want to see if yours will be done soon -- I am not happy with my own.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <code> <pre> <embed> <object> <b></div>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.