You are here

function imageapi_optimize_pipeline_flush in Image Optimize (or ImageAPI Optimize) 7.2

Flushes cached media for a pipeline.

Parameters

$pipeline: An image pipeline array.

5 calls to imageapi_optimize_pipeline_flush()
imageapi_optimize_default_pipeline_revert in ./imageapi_optimize.module
Reverts the changes made by users to a default image pipeline.
imageapi_optimize_pipeline_delete in ./imageapi_optimize.module
Deletes an image pipeline.
imageapi_optimize_pipeline_save in ./imageapi_optimize.module
Saves an image pipeline.
imageapi_optimize_processor_delete in ./imageapi_optimize.module
Deletes an image processor.
imageapi_optimize_processor_save in ./imageapi_optimize.module
Saves an image processor.

File

./imageapi_optimize.module, line 464

Code

function imageapi_optimize_pipeline_flush($pipeline) {

  // Let other modules update as necessary on flush.
  module_invoke_all('imageapi_optimize_pipeline_flush', $pipeline);

  // Clear image pipeline and processor caches.
  cache_clear_all('imageapi_optimize_pipelines', 'cache');
  cache_clear_all('imageapi_optimize_processors:', 'cache', TRUE);
  drupal_static_reset('imageapi_optimize_pipelines');
  drupal_static_reset('imageapi_optimize_processors');

  // Flush all the image pipelines using this pipeline.
  $styles = image_styles();
  foreach ($styles as $style) {
    foreach ($style['effects'] as $effect) {
      if ($effect['name'] == 'imageapi_optimize' && isset($effect['data']['pipeline']) && $effect['data']['pipeline'] == $pipeline['name']) {
        image_style_flush($style);
      }
    }
  }
}