Hi,

Some of us have had problems with creating nodes with Feeds that have a file field configured with File Field Paths. It looks like the status of the files is set to 0 (temporary) in the file_managed table when it should be set to 1 (permanent) instead.
Cron then tries to delete them which fortunately fails because the file_usage prevents it. But what's annoying is that this creates an error log per file. The site I work on imports 300 nodes a day with Feeds so the logs are quickly flooded, making my logs unusable :(

#2409075: Did not delete temporary file "public://personals/personpic/110623-9611.jpg" during garbage collection, because it is in use by the following modules: file.
#2512824: Set file status to permanent.

Here are two issues opened in Feeds, mentioning that FileField Paths could be responsible, yet no issue seems to be opened here so I figured it could help to ask:
Do you think this could come from your module?

Comments

Nicolas Bouteille created an issue.

JordanMagnuson’s picture

I'm also encountering this issue: file saved as permanent normally, but when I enable filefield_paths on an image field, suddenly the file has status 0 in the file_managed db table.

dureaghin’s picture

You can change file status from "0" to "1" from mysql.

SELECT count(uid) FROM DB_NAME.file_managed where status = 0;
UPDATE DB_NAME.file_managed set status = 1 where status = 0;

Alex.

paul_constantine’s picture

I noticed that behavior also. And it causes a lot of error messages in my logs like the following:

Did not delete temporary file "public://images/username/coverart/Alison Krauss and Union Station – Alison Krauss + Union Station Live.jpg" during garbage collection, because it is in use by the following modules: file.

I use this module with "feeds" and "feeds tamper" to rename the album cover art for an online radio station that plays 24/7 so there are quite a lot of tracks each day.

The cause of the problem seems to be the interaction of "feeds" with "file field path".

When using feeds alone it sets the owner of the files to UID 0 (Guest), the files are saved into the folder public://images/guests/ and re-named with an added number. The file status in MYSQL was "1" which only led to problems when I wanted to delete nodes that used the files in case. The node was deleted, but the file was not since I was not the owner, not a Guest.

On my second install I wanted to change two things. I wanted the files to be renamed with real names to avoid saving the same files again with an added number. And I wanted the files to be in my users image folder so that I could delete them.

That's why I installed "File Field Path". I added a patch to be able to set "Replace File" and changed the path to my user and added tokens to set the album cover name (the audio backend always exports the cover art with the same file name).

So everything seemed fine until I noticed the errors in my logs. Upon investigating I found out the errors were causes by the file status being set to "0".

Of course I can manually set the status to "1", but that's not a good solution in my mind. How can I cure the cause of this problem?

Cheers,
Paul