Problem/Motivation

When adding the reuse: true to the processing definition in a migration, the process plugin checks should check if a potentially reused file is currently marked as temporary in the database - if so it should be marked as permanent. This is already implemented, but the if-statement is wrong:

if (!$file->isTemporary()) {
  $file->setPermanent();
  $file->save();
}

This says: If the file for reuse is NOT temporary, mark it as permanent, which is useless ;)

To get this really working, this has to be switched to (no "!" before $file->isTemporary()):

if ($file->isTemporary()) {
  $file->setPermanent();
  $file->save();
}

Proposed resolution

  • Fix the if-statement, so temporary files are marked as permanent

Remaining tasks

  • Provide a patch

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Release notes snippet

Fix temporary files are not marked as permanent when reused

CommentFileSizeAuthor
#2 3108527-2.patch606 byteshctom

Comments

hctom created an issue. See original summary.

hctom’s picture

Status: Active » Needs review
StatusFileSize
new606 bytes

...and here is the proposed patch fixing this issue

nuuou’s picture

Patch applies cleanly for me, and does exactly what it says. Saved me the headache of "oh no where'd my files go". Thanks!

  • drclaw committed 4bebb4a on 2.0.x authored by hctom
    Issue #3108527 by hctom: Marking temporary files as permanent does not...
drclaw’s picture

Status: Needs review » Fixed

Thanks for the report! Silly mistake on my part. Not sure how this went unreported for so long though...

Committed to dev for now, new release soon!

Status: Fixed » Closed (fixed)

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