Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F21967878
script.ex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1011 B
Referenced Files
None
Subscribers
None
script.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Web.MediaProxy.Invalidation.Script
do
@moduledoc
false
@behaviour
Pleroma.Web.MediaProxy.Invalidation
require
Logger
@impl
Pleroma.Web.MediaProxy.Invalidation
def
purge
(
urls
,
%{
script_path
:
script_path
}
=
_options
)
do
args
=
urls
|>
List
.
wrap
()
|>
Enum
.
uniq
()
|>
Enum
.
join
(
" "
)
path
=
Path
.
expand
(
script_path
)
Logger
.
debug
(
"Running cache purge:
#{
inspect
(
urls
)
}
,
#{
path
}
"
)
case
do_purge
(
path
,
[
args
])
do
{
result
,
exit_status
}
when
exit_status
>
0
->
Logger
.
error
(
"Error while cache purge:
#{
inspect
(
result
)
}
"
)
{
:error
,
inspect
(
result
)}
_
->
{
:ok
,
"success"
}
end
end
def
purge
(
_
,
_
),
do
:
{
:error
,
"not found script path"
}
defp
do_purge
(
path
,
args
)
do
System
.
cmd
(
path
,
args
)
rescue
error
->
{
inspect
(
error
),
1
}
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Sun, Dec 28, 3:23 AM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
839721
Default Alt Text
script.ex (1011 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment