Media Mover's advanced configuration option that says "Delete Media Mover items with nodes" does not seem to work when the "media mover item" is a file stored on Amazon's S3 service. Any insight?

Basically, I have a node that has a media mover array attached to it, with this info:
...
harvest_file (String, 49 characters ) sites/default/files/Busan Beach 1 - ribbon1_0.zip
process_file (String, 49 characters ) sites/default/files/Busan Beach 1 - ribbon1_0.zip
storage_file (String, 70 characters ) http://s3.amazonaws.com/pixeled-memories/Busan Beach 1 - ribbon1_0.zip
complete_file (String, 70 characters ) http://s3.amazonaws.com/pixeled-memories/Busan Beach 1 - ribbon1_0.zip
...

When I delete this node, I want the storage file on Amazon S3 to be deleted.

I have "delete original file" and "replace source file" checked in my Media Mover settings, in the "complete" operation.

Comments

msonnabaum’s picture

How is this file being harvested? From a cck field or a from a directory?

I'm guessing it's being harvested with mm_dir, which in that case, media mover doesn't know which node it's associated with, so that option won't work.

Let us know if that's not the case.

jordanmagnuson’s picture

The file is being harvested from a cck field (and as I mentioned earlier, I have "delete original file" and "replace source file" checked in my Media Mover settings, in the "complete" operation). Everything is working fine (file is moved to Amazon S3, original file is deleted, cck field is updated), except that when I delete the node the remote file on S3 is not deleted.

(Also, I have this unrelated problem: http://drupal.org/node/707038)

jordanmagnuson’s picture

Category: support » bug

Any more help on this? Since it looks like intended functionality is missing here, I'm going to change the status to bug report, if that's okay...

msonnabaum’s picture

Try the latest dev. I just committed a fix that should take care of it.

jordanmagnuson’s picture

Thanks a lot for working on this Mark--I really appreciate it!

Okay, first off, the good news: the remote S3 file IS now being deleted when media mover runs, after the containing node has been deleted. So that's great!

A couple of things, though:

1. When MM is run for the first time (test file not yet harvested and stored to S3), I get this error:

warning: unlink(sites/default/files/bunnies_crocs04.zip) [function.unlink]: No such file or directory in /srv/www/pixeledmemories.com/public_html/sites/all/modules/patched/media_mover/contrib/mm_s3/mm_s3.module on line 421.

Everything seems to work correctly, but still, the error message is there.



2. Not sure if this should be a separate issue, but say I have a node with a file that has been harvested and stored to S3 from a CCK field, and then the CCK field has been updated (as per my first post). If I edit the node and DELETE the file, but DO NOT delete the node itself, the remote S3 file is NOT deleted on the next MM run, though it seems like it should be.

Likewise, if, instead of deleting the file outright, I replace it (by deleting it and then uploading a new file to the local server), the new file is now processed by MM when cron runs, and transfered to S3, and the cck filefield is updated, but the old file is not removed from S3. If I manually delete the file form the files list on the MM configuration page (where it shows each file with the mmfid), it is THEN deleted from S3 on the next cron run.



3. Finally, I thought I'd point you to this issue, in case you didn't see it. Not sure if this needs to be resolved in the S3 module or in MM api, but once a file is moved to S3, MM continues to try and process it every cron run (and fails to harvest it). What it should do, I believe, is check to see whether the cck filefield now points to a remote location, and if so, skip the file (don't try to harvest or process it).



Again: thank you very much for your efforts to get the MM S3 module 100% functional!

jordanmagnuson’s picture

Title: Amazon S3: Delete remote file when node is deleted » Amazon S3: Delete remote file when file is removed from cck field

Any more help on this? Can anyone point me in the right direction for fixing the code here? Changing the issue title to reflect the current issue.

jordanmagnuson’s picture

Not sure, but this may be an issue with mm_cck.module, rather than mm_s3.module. See http://drupal.org/node/724208

Am I right?

msonnabaum’s picture

Just committed a fix for the unlink error. Let me know if that works for you.

Let's address the rest in the other issues that have been opened already.

jordanmagnuson’s picture

Title: Amazon S3: Delete remote file when file is removed from cck field » Amazon S3: Delete remote file when node is deleted
Status: Active » Fixed

Unlink error appears to be fixed--thanks! Changing the issue title back, and marking as fixed.

Status: Fixed » Closed (fixed)

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