Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drupal Upstream
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ASC IRIS Web Services
Drupal Upstream
Commits
441a2c81
Commit
441a2c81
authored
7 months ago
by
Michael Lee
Browse files
Options
Downloads
Patches
Plain Diff
update opic cache hook to also flush image style when refreshing images
parent
601f6fbd
No related branches found
Branches containing commit
No related tags found
1 merge request
!168
update OPIC cache hook to also flush image style when refreshing images
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
web/modules/custom/imagecache_render/imagecache_render.module
+5
-1
5 additions, 1 deletion
...modules/custom/imagecache_render/imagecache_render.module
with
5 additions
and
1 deletion
web/modules/custom/imagecache_render/imagecache_render.module
+
5
−
1
View file @
441a2c81
...
...
@@ -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
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment