Skip to content

Commit

Permalink
Merge pull request #52 from drunomics/feature/DEV-1953
Browse files Browse the repository at this point in the history
DEV-1953: Add init-media-icons script and pel library patch.
  • Loading branch information
petarbasic authored Jun 23, 2022
2 parents 313dedc + dbc25da commit b4534ee
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@
},
"enable-patching": true,
"composer-exit-on-patch-failure": true,
"patches": {}
"patches": {
"lsolesen/pel": {
"#183: PelIllegalFormatException: Unknown format: 0x0": "https://patch-diff.githubusercontent.com/raw/pel/pel/pull/199.patch"
}
}
},
"config": {
"platform": {
Expand Down
3 changes: 3 additions & 0 deletions phapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ commands:
status: |
drush status --fields=bootstrap | grep 'bootstrap' -q
init: |
./scripts/init-media-icons.sh &&
drush sql-create -y &&
zcat dumps/init.sql.gz | drush sql:cli &&
drush updatedb -y &&
Expand All @@ -34,12 +35,14 @@ commands:
fi &&
drush locale:check && drush locale:update
install: |
./scripts/init-media-icons.sh &&
chmod +w web/sites/default &&
drush sql-create -y &&
SITE=${SITE:-default} &&
drush site-install -y --sites-subdir=$SITE --config-dir=../config/sync ${INSTALL_PROFILE:-minimal} &&
drush en admin_toolbar_tools dsk_config_split services_env_parameter -y
update: |
./scripts/init-media-icons.sh &&
drush updatedb -y &&
# Skip config-import when there is no config.
if [ -f config/sync/core.extension.yml ]; then
Expand Down
36 changes: 36 additions & 0 deletions scripts/init-media-icons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

# Script that moves media icons from core to public files so that
# "File at public://something.png does not exist" error to be removed on setup.
# Be sure files directories are setup.
cd `dirname $0`/..
for SITE in `ls -d web/sites/*/`; do
SITE=`basename $SITE`

if [[ $SITE == 'all' ]] || [[ $SITE == 'default' ]]; then
continue;
fi

if [ ! -w web/sites/$SITE/files/public ]; then
echo "Public files cannot be added (no write permission)." 1>&2
continue;
fi
echo "Copying public files..."
mkdir -p web/sites/$SITE/files/public/media-icons/generic \
# Public files: Prepare media icon files (originally from web/core/modules/media/images/icons/*).
if [[ -d web/core/modules/media/images/icons ]]; then
cp -r web/core/modules/media/images/icons/. web/sites/$SITE/files/public/media-icons/generic
fi

if [[ -d web/modules/contrib/media_entity_instagram/images/icons ]]; then
cp -r web/modules/contrib/media_entity_instagram/images/icons/. web/sites/$SITE/files/public/media-icons/generic
fi

if [[ -d web/modules/contrib/media_entity_pinterest/images/icons ]]; then
cp -r web/modules/contrib/media_entity_pinterest/images/icons/. web/sites/$SITE/files/public/media-icons/generic
fi
if [[ -d web/modules/contrib/media_entity_twitter/images/icons ]]; then
cp -r web/modules/contrib/media_entity_twitter/images/icons/. web/sites/$SITE/files/public/media-icons/generic
fi

done

0 comments on commit b4534ee

Please sign in to comment.