A bit new to this module, but helping to debug it within Open Atrium.

When using the Photo plugin in the latest version of OA 2.30, it fails. When tracking this down, I found that in _fbsmp_file_save_upload() it first calls file_save_upload to save the photo, which works. But then it goes into a loop to call any module that implements the "file_insert" hook.

One module that implements this hook is the file_entity module. It has the file_entity_file_insert() function which inserts the meta data into the file_metadata table.

However, the previous file_save_upload has already done this! So the db_insert fails because the items already exist in the db.

I believe this used to work in a previous version, so maybe file_save_upload changed in a recent version of Drupal. But since file_save_upload definitely has a loop to call file_insert hooks you should remove this duplicate loop from _fbsmp_file_save_upload().

CommentFileSizeAuthor
#1 fbsmp-file_insert_fail-2425557-1.patch563 bytesmpotter
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpotter’s picture

Here is a patch that removes the hook loop

jbrundle’s picture

Mike, The patch works nicely on OA2 7.x-2.30 stable release. Many thanks!

--J

  • IceCreamYou committed e833958 on 7.x-1.x
    Issue #2425557, #2372777 by cesarmiquel, mpotter: Fixed saving photos...
IceCreamYou’s picture

Status: Active » Fixed

Interesting, this patch is identical to the one in #2372777: PDOException: SQLSTATE[23000]: Integrity constraint violation when saving images, provided almost at the same time. Committed, and I tagged a new alpha release. Thanks!

Status: Fixed » Closed (fixed)

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