Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
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
drupal
Merge requests
!10693
Issue
#3060509
: Reprovision default media thumbnails when not found at icon_base_uri
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3060509
: Reprovision default media thumbnails when not found at icon_base_uri
issue/drupal-3060509:3060509-reprovision-default-media
into
11.x
Overview
0
Commits
1
Pipelines
2
Changes
2
Open
artis.bajars
requested to merge
issue/drupal-3060509:3060509-reprovision-default-media
into
11.x
5 months ago
Overview
0
Commits
1
Pipelines
2
Changes
2
Expand
Closes
#3060509
0
0
Merge request reports
Compare
11.x
version 1
b0d7d8b9
5 months ago
11.x (HEAD)
and
latest version
latest version
b8cfc3d6
1 commit,
5 months ago
version 1
b0d7d8b9
1 commit,
5 months ago
2 files
+
22
−
7
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
core/modules/media/media.install
+
13
−
7
Options
@@ -16,6 +16,19 @@
*/
#[ProceduralHookScanStop]
function
media_install
():
void
{
_media_provision_icons
();
// Grant the "view media" permission to all users by default.
if
(
\Drupal
::
moduleHandler
()
->
moduleExists
(
'user'
))
{
user_role_grant_permissions
(
RoleInterface
::
ANONYMOUS_ID
,
[
'view media'
]);
user_role_grant_permissions
(
RoleInterface
::
AUTHENTICATED_ID
,
[
'view media'
]);
}
}
/**
* Copies the default media icons to the public files directory.
*/
function
_media_provision_icons
():
void
{
$source
=
\Drupal
::
service
(
'extension.list.module'
)
->
getPath
(
'media'
)
.
'/images/icons'
;
$destination
=
\Drupal
::
config
(
'media.settings'
)
->
get
(
'icon_base_uri'
);
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
@@ -37,15 +50,8 @@ function media_install(): void {
catch
(
FileException
)
{
// Ignore and continue.
}
}
}
// Grant the "view media" permission to all users by default.
if
(
\Drupal
::
moduleHandler
()
->
moduleExists
(
'user'
))
{
user_role_grant_permissions
(
RoleInterface
::
ANONYMOUS_ID
,
[
'view media'
]);
user_role_grant_permissions
(
RoleInterface
::
AUTHENTICATED_ID
,
[
'view media'
]);
}
}
/**
Loading