diff --git a/web/modules/custom/imagecache_render/imagecache_render.module b/web/modules/custom/imagecache_render/imagecache_render.module index b428b6daf25e9f9c0d25dc49ad3357a2ab79d8ee..a835d36227fc24b1695bb019307d15da8f42cd67 100644 --- a/web/modules/custom/imagecache_render/imagecache_render.module +++ b/web/modules/custom/imagecache_render/imagecache_render.module @@ -62,11 +62,15 @@ function imagecache_render_imagecache_external_needs_refresh_alter(&$needs_refre date_default_timezone_set('America/New_York'); $current_hour = (int) date('G'); if ($current_hour >= 3 && $current_hour < 5) { - if (filemtime($filepath) < \Drupal::time()->getRequestTime() - 60 * 60 * 24 - (30 * 60)) { + $image_style_name = 'people_profile_image'; + $image_style = \Drupal::entityTypeManager()->getStorage('image_style')->load($image_style_name); + if ($image_style && filemtime($filepath) < \Drupal::time()->getRequestTime() - 60 * 60 * 24 - (30 * 60)) { \Drupal::logger('imagecache_external')->notice('@filepath older than 24 hours, refreshing', [ '@filepath' => $filepath, ]); $needs_refresh = TRUE; + $image_uri = str_replace('public://', '', $filepath); + $image_style->flush($image_uri); } } }