Over at #1057656: Image styles don't flush for images stored non-default schemes there's a patch which fixes the core bug that was preventing it from deleting image styles on remote file schemes (like s3://). With that patch in place, amazons3_image_style_flush() no longer needs to call drupal_rmdir(), which means the hook can be simplified with the attached patch.

This patch also fixes a long-standing bug in amazons3_image_style_flush(), making it treat the $style variable as an array, rather than an object.

EDIT: I just realized that my patch is an updated version of aasarava's patch from #1695102: Actual working implementation of hook_image_style_flush(). I had forgotten that I got the original patch from that issue.

Comments

haysuess’s picture

I applied both this patch, and the one mentioned in your comment. I went to one of my Image Styles and hit update, and got this error:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1: DELETE FROM {amazons3_file} WHERE (); Array ( ) in AmazonS3StreamWrapper->rmdir() (line 710 of sites/all/modules/amazons3/AmazonS3StreamWrapper.inc).

It DID seem to flush the image style though, as my new effects are loading.

Is there something I did wrong?

haysuess’s picture

Looks like I needed to apply this patch too: https://drupal.org/node/1653316

I have the Beta 7 of Amazon S3 running, not the dev version which is a year newer, so I guess it was missing that fix.

Hope this helps someone else.

djake’s picture

Status: Needs review » Reviewed & tested by the community

This patch was a lifesaver. After updating core to 7.23, I was almost completely unable to edit or add styles. This patch fixed it. Amazon Linux, PHP 5.3.

bkonetzny’s picture

Confirming that after updating to Drupal 7.23, this patch makes image_style administration workable again.

bkonetzny’s picture

Issue summary: View changes

Giving credit where it's due.

justafish’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

This function isn't needed at all actually thanks to #1057656 and #2079315

https://github.com/justafish/amazons3/commit/bab29e12489275af58bca100416...

Status: Fixed » Closed (fixed)

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