I came across some redundant rows in entity table with nid=0 and temporary set to 0.

I suppose they came from _wysiwyg_imageupload_create_inline_entity when user uploads an image and then cancel's the wysiwyg_imageupload form (or inserts and then deletes the image). After that on save node _wysiwyg_imageupload_cleanup_temps doesn't catch up such rows because of nid param.

Steps to reproduce:
1) open create new node
2) open wysiwyg imageupload form
3) upload a file or select existing
4) cancel form (or insert then delete the image)
5) don't save (or save and $entity->imgupload_images would be null)
6) see rows in db with nid=0 and temporary=0

Not sure where and when to clean up these rows.
Notice that such rows could prevent unused file cleanups (if user selects already uploaded image).

Comments

eugenmayer’s picture

Thank you for the detailed information on this error!

Well as you suggested, that beh. is not expected / planned.

it can be that nid=0, but then you have cid!=0 as its a image for an comment-field.
the most interesting thing is that temporary=1, as thats exactly what should not be.

If you create a new node, you yet have no nid, so the entity will be created with nid=0, cid=0, vid=, temporary=1.
If you cancel, that entry resides in the DB until the cron is run. then it actually all entries with temporary=1 should get removed.

dgovorunov’s picture

Oh, I just realized that mistaken in 6th step. I mean rows with temporary=1 not 0.

So the rows are - "nid=0, cid=0, vid=, temporary=1".

Even if I open an existing node and will try to add a picture I am able to see fresh rows "nid=0, cid=0, vid=, temporary=1".

But I can't see any cron activity against these rows (only rows from table files with status=0). Could you please point where the logic to look in.

What happen if cron will remove temp entries while user is editing his page? It seems that user will miss newly added files.

eugenmayer’s picture

The last thing you pointed out is currently discussed in the other issue open. There are side-effects which need to be handled very strictly. I hope i will find to work on this, patches are welcome :)

eugenmayer’s picture

Status: Active » Fixed

Actually in once sense, it was supposed to be that way, in the other its not because they are actually not cleaned. Now, on every cron run, when the file you uploaded gets deleted due to "temporary", all wui entries referencing it will also be deleted. So its doing an auto-clean up.

eugenmayer’s picture

Fixed in 2.4

Status: Fixed » Closed (fixed)

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