Skip to content

Commit b4534ee

Browse files
authored
Merge pull request #52 from drunomics/feature/DEV-1953
DEV-1953: Add init-media-icons script and pel library patch.
2 parents 313dedc + dbc25da commit b4534ee

3 files changed

Lines changed: 44 additions & 1 deletion

File tree

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@
144144
},
145145
"enable-patching": true,
146146
"composer-exit-on-patch-failure": true,
147-
"patches": {}
147+
"patches": {
148+
"lsolesen/pel": {
149+
"#183: PelIllegalFormatException: Unknown format: 0x0": "https://patch-diff.githubusercontent.com/raw/pel/pel/pull/199.patch"
150+
}
151+
}
148152
},
149153
"config": {
150154
"platform": {

phapp.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ commands:
2525
status: |
2626
drush status --fields=bootstrap | grep 'bootstrap' -q
2727
init: |
28+
./scripts/init-media-icons.sh &&
2829
drush sql-create -y &&
2930
zcat dumps/init.sql.gz | drush sql:cli &&
3031
drush updatedb -y &&
@@ -34,12 +35,14 @@ commands:
3435
fi &&
3536
drush locale:check && drush locale:update
3637
install: |
38+
./scripts/init-media-icons.sh &&
3739
chmod +w web/sites/default &&
3840
drush sql-create -y &&
3941
SITE=${SITE:-default} &&
4042
drush site-install -y --sites-subdir=$SITE --config-dir=../config/sync ${INSTALL_PROFILE:-minimal} &&
4143
drush en admin_toolbar_tools dsk_config_split services_env_parameter -y
4244
update: |
45+
./scripts/init-media-icons.sh &&
4346
drush updatedb -y &&
4447
# Skip config-import when there is no config.
4548
if [ -f config/sync/core.extension.yml ]; then

scripts/init-media-icons.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
# Script that moves media icons from core to public files so that
4+
# "File at public://something.png does not exist" error to be removed on setup.
5+
# Be sure files directories are setup.
6+
cd `dirname $0`/..
7+
for SITE in `ls -d web/sites/*/`; do
8+
SITE=`basename $SITE`
9+
10+
if [[ $SITE == 'all' ]] || [[ $SITE == 'default' ]]; then
11+
continue;
12+
fi
13+
14+
if [ ! -w web/sites/$SITE/files/public ]; then
15+
echo "Public files cannot be added (no write permission)." 1>&2
16+
continue;
17+
fi
18+
echo "Copying public files..."
19+
mkdir -p web/sites/$SITE/files/public/media-icons/generic \
20+
# Public files: Prepare media icon files (originally from web/core/modules/media/images/icons/*).
21+
if [[ -d web/core/modules/media/images/icons ]]; then
22+
cp -r web/core/modules/media/images/icons/. web/sites/$SITE/files/public/media-icons/generic
23+
fi
24+
25+
if [[ -d web/modules/contrib/media_entity_instagram/images/icons ]]; then
26+
cp -r web/modules/contrib/media_entity_instagram/images/icons/. web/sites/$SITE/files/public/media-icons/generic
27+
fi
28+
29+
if [[ -d web/modules/contrib/media_entity_pinterest/images/icons ]]; then
30+
cp -r web/modules/contrib/media_entity_pinterest/images/icons/. web/sites/$SITE/files/public/media-icons/generic
31+
fi
32+
if [[ -d web/modules/contrib/media_entity_twitter/images/icons ]]; then
33+
cp -r web/modules/contrib/media_entity_twitter/images/icons/. web/sites/$SITE/files/public/media-icons/generic
34+
fi
35+
36+
done

0 commit comments

Comments
 (0)