Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
stage_file_proxy
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
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
project
stage_file_proxy
Merge requests
!95
Issue
#3521812
: Use public stream wrapper for generating the redirect URL
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3521812
: Use public stream wrapper for generating the redirect URL
issue/stage_file_proxy-3521812:3521812-use-stream-wrapper-for-url
into
3.1.x
Overview
0
Commits
1
Pipelines
4
Changes
9
Open
codebymikey
requested to merge
issue/stage_file_proxy-3521812:3521812-use-stream-wrapper-for-url
into
3.1.x
1 month ago
Overview
0
Commits
1
Pipelines
4
Changes
9
Expand
Closes
#3521812
0
0
Merge request reports
Compare
3.1.x
version 3
fb344768
1 month ago
version 2
48975026
1 month ago
version 1
4fe5166b
1 month ago
3.1.x (HEAD)
and
latest version
latest version
a3ac4f27
1 commit,
1 month ago
version 3
fb344768
1 commit,
1 month ago
version 2
48975026
1 commit,
1 month ago
version 1
4fe5166b
1 commit,
1 month ago
9 files
+
639
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
9
Search (e.g. *.vue) (Ctrl+P)
src/EventSubscriber/StageFileProxyConfigSubscriber.php
0 → 100644
+
54
−
0
Options
<?php
declare
(
strict_types
=
1
);
namespace
Drupal\stage_file_proxy\EventSubscriber
;
use
Drupal\Core\Cache\CacheTagsInvalidatorInterface
;
use
Drupal\Core\Config\ConfigCrudEvent
;
use
Drupal\Core\Config\ConfigEvents
;
use
Symfony\Component\EventDispatcher\EventSubscriberInterface
;
/**
* Stage file proxy subscriber for configuration changes.
*/
class
StageFileProxyConfigSubscriber
implements
EventSubscriberInterface
{
/**
* Constructs a StageFileProxyConfigSubscriber object.
*/
public
function
__construct
(
protected
CacheTagsInvalidatorInterface
$cacheTagsInvalidator
,
)
{
}
/**
* Invalidates 4xx-response cache tag if the origin is added.
*
* @param \Drupal\Core\Config\ConfigCrudEvent $event
* The configuration event.
*/
public
function
onConfigSave
(
ConfigCrudEvent
$event
):
void
{
$saved_config
=
$event
->
getConfig
();
if
(
$saved_config
->
getName
()
===
'stage_file_proxy.settings'
)
{
if
(
$event
->
isChanged
(
'origin'
)
&&
empty
(
$event
->
getConfig
()
->
getOriginal
(
'origin'
)))
{
// The default behavior is to do nothing if the origin is undefined,
// so once a new origin is added, any previous 4xx responses in the
// cache should be invalidated so that stage_file_proxy may intercept
// it.
$this
->
cacheTagsInvalidator
->
invalidateTags
([
'4xx-response'
]);
}
}
}
/**
* {@inheritdoc}
*/
public
static
function
getSubscribedEvents
():
array
{
$events
=
[];
$events
[
ConfigEvents
::
SAVE
][]
=
[
'onConfigSave'
];
return
$events
;
}
}
Loading