I ran into this in comment #5 of the issue 'Moved files are physically in the original directory on the server', but it should be another bug, probably.

To reproduce this:

1. created folders 'test' and 'test2' at the top level
2. upload one or more files into 'test' (I tried with 1-2, but suspect it'll happen with more).
3. move one or more files uploaded in step 2. into 'test2'.
4. upload a file into 'test2'. The only file in 'test2's listing is now the file just uploaded. The moved files are also gone from filedepot_private.

CommentFileSizeAuthor
#5 801066_changedfiles-v2.zip20.11 KBblainelang

Comments

ldav1s’s picture

This can be fixed by commenting out these lines in filedepot.module around line 855:

foreach ($depotfiles as $id => $remove) {
$filedepot->deleteFile($id);
}

Unfortunately, content management uses this to track files also, so just commenting them out will break those functions.

blainelang’s picture

I can confirm the issue but that is definitely not the fix -- give me some time to work on it.

blainelang’s picture

Assigned: Unassigned » blainelang
blainelang’s picture

This is a lot more complex and is related (as I believe) to the node cache. When moving the files, the module has to unlink and link the related attachments to the node relationship and the code is not presently doing that. The folder relationships as maintained by filedepot tables are updated but when a new file is added (to original folder or the new folder) the cached node data will make it appear to the existing filedepot code that you either just added files or remove files via the native drupal interface.

I am presently working on a solution but has anyone seen a module that moves attachments between nodes?

I am testing code now to attach the attachment related file object to the node and use node_save() but was having issues last night - maybe fresh coffee this morning will help.

blainelang’s picture

StatusFileSize
new20.11 KB

It's not really the node cache that is at fault but the related CCK table that tracks the attachments for the cck filefield that makes up the filedepot_folder content type node record.

The table 'content_field_filedepot_file' - has a record for each file (node attachment), needs to be updated and my attempts to do this through the node_save was not successful and I did not see an available API to do this but have a solution that looks to be working. Unfortunately, I needed to resort to direct table updates.

Has anyone seen a module that moves node attachments or cck node fields between nodes?

Attached is a zip file with the 2 modified files - please test and let me know if you see any more issues related to moving files and uploading files into effected folders after the move.

ldav1s’s picture

I applied the patch, and tried steps 1-4 with just one file. It worked.

I also went to the content administration page and this is the _first_ time I've noticed that a moved file has showed up in the Edit menu's Folder File.

Nice job!

blainelang’s picture

Whew - thanks!
I am updating CVS now in preparation for a new release.

blainelang’s picture

Status: Active » Fixed
ldav1s’s picture

Fixed in 1.0-rc3.

Status: Fixed » Closed (fixed)

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

  • Commit 336feed on master, 8.x-1.x by blainelang:
    Fix for issue: #802680 to fix problem moving  file(s) between nodes.