? .directory
? imagecache-354607.patch
? imagecache_delete_hooks_1.patch
Index: imagecache.api.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.api.php,v
retrieving revision 1.2
diff -u -p -r1.2 imagecache.api.php
--- imagecache.api.php	17 Feb 2009 21:36:18 -0000	1.2
+++ imagecache.api.php	29 Jan 2011 03:37:59 -0000
@@ -62,4 +62,44 @@ function hook_imagecache_default_presets
     ),
   );
   return $presets;
-}
\ No newline at end of file
+}
+
+/**
+ * Allows other modules to perform actions on an imagecached image about to
+ * be flushed.
+ *
+ * This hook can be used to send purge requests to a reverse proxy or delete
+ * a file from a remote file server or CDN when the imagecached version is
+ * flushed.
+ *
+ * Implementations of hook_imagecache_image_flush should not delete the image
+ * at $filepath, as imagecache will perform this action.
+ *
+ * @param $filepath
+ *   The path to the file about to be flushed.
+ * @param $preset
+ *   an imagecache preset array.
+ * @param $path
+ *   The Drupal file path to the original image.
+ */
+function hook_imagecache_image_flush($filepath, $preset, $path) {
+}
+
+/**
+ * Allows other modules to perform actions when all imagecached images
+ * in a preset are about to be flushed.
+ *
+ * This hook can be used to send purge requests to a reverse proxy or delete
+ * files from a remote file server or CDN when the imagecached versions are
+ * flushed.
+ *
+ * Implementations of hook_imagecache_preset_flush should not delete the
+ * images in $presetdir, as imagecache will perform this action.
+ *
+ * @param $presetdir
+ *   The directory containing the images about to be flushed.
+ * @param $preset
+ *   an imagecache preset array.
+ */
+function hook_imagecache_preset_flush($presetdir, $preset) {
+}
Index: imagecache.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.module,v
retrieving revision 1.112.2.9
diff -u -p -r1.112.2.9 imagecache.module
--- imagecache.module	26 May 2010 21:08:58 -0000	1.112.2.9
+++ imagecache.module	29 Jan 2011 03:38:00 -0000
@@ -1053,6 +1053,7 @@ function imagecache_preset_flush($preset
   if (user_access('flush imagecache')) {
     $presetdir = realpath(file_directory_path() .'/imagecache/'. $preset['presetname']);
     if (is_dir($presetdir)) {
+      module_invoke_all('imagecache_preset_flush', $presetdir, $preset);
       _imagecache_recursive_delete($presetdir);
     }
   }
@@ -1065,7 +1066,9 @@ function imagecache_preset_flush($preset
  */
 function imagecache_image_flush($path) {
   foreach (imagecache_presets() as $preset) {
-    file_delete(imagecache_create_path($preset['presetname'], $path));
+    $filepath = imagecache_create_path($preset['presetname'], $path);
+    module_invoke_all('imagecache_image_flush', $filepath, $preset, $path);
+    file_delete($filepath);
   }
 }
 
