Skip to content

Commit 48a18c9

Browse files
authored
Merge pull request #213 from Islandora-Devops/issues_212
Reinstall islandora & views for make local
2 parents 371eac9 + 0a7deff commit 48a18c9

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ demo: generate-secrets
341341
$(MAKE) reindex-fcrepo-metadata ENVIROMENT=demo
342342
$(MAKE) reindex-solr ENVIROMENT=demo
343343
$(MAKE) reindex-triplestore ENVIROMENT=demo
344+
$(MAKE) fix-masonry
344345
$(MAKE) secrets_warning
345346

346347
.PHONY: local
@@ -505,6 +506,8 @@ set_admin_password:
505506
echo "$(PASSWORD)" | $(CMD) secrets/live/DRUPAL_DEFAULT_ACCOUNT_PASSWORD >> /dev/null
506507
@echo "\ndone."
507508

509+
# Hot fix section. These are not meant to be run normally but are meant to be run when needed.
510+
508511
LATEST_VERSION := $(shell curl -s https://api.github.com/repos/desandro/masonry/releases/latest | grep '\"tag_name\":' | sed -E 's/.*\"([^\"]+)\".*/\1/')
509512

510513
.PHONY: fix-masonry
@@ -515,3 +518,10 @@ fix-masonry:
515518
docker-compose exec drupal bash -lc "[ -d '/var/www/drupal/web/libraries' ] && exit ; mkdir -p /var/www/drupal/web/libraries ; chmod 755 /var/www/drupal/web/libraries ; chown 1000:nginx /var/www/drupal/web/libraries"
516519
docker-compose exec drupal bash -lc "cd /var/www/drupal/web/libraries/ ; [ ! -d '/var/www/drupal/web/libraries/masonry' ] && git clone --quiet --branch ${LATEST_VERSION} https://github.com/desandro/masonry.git || echo Ready"
517520
docker-compose exec drupal bash -lc "cd /var/www/drupal/web/libraries/ ; [ -d '/var/www/drupal/web/libraries/masonry' ] && chmod -R 755 /var/www/drupal/web/libraries/masonry ; chown -R 1000:nginx /var/www/drupal/web/libraries/masonry"
521+
522+
.PHONY: fix_views
523+
.SILENT: fix_views
524+
## This fixes a know issues with views when using the make local build. The error must be triggered before this will work.
525+
fix_views:
526+
docker cp scripts/patch_views.sh $$(docker ps --format "{{.Names}}" | grep drupal):/var/www/drupal/patch_views.sh
527+
docker-compose exec -T drupal with-contenv bash -lc "bash /var/www/drupal/patch_views.sh ; rm /var/www/drupal/patch_views.sh ; drush cr"

docs/troubleshooting.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,14 @@ To fix this:
128128
* edit your .env file, an increase ALPACA_HOUDINI_TIMEOUT (and other similar timeouts if necessary). Note these values are in milliseconds.
129129
* make docker-compose.yml (this is necessary to pick up the change and re-write docker-compose.yml)
130130
* restart containers
131+
132+
## Uncaught PHP Exception InvalidArgumentException or Flysystem driver is missing
133+
134+
Error message likely to see.
135+
> FastCGI sent in stderr: "PHP message: Uncaught PHP Exception InvalidArgumentException: "A valid cache entry key is required. Use getAll() to get all table data." at /var/www/drupal/web/core/modules/views/src/ViewsData.php line 140" while reading response header from upstream
136+
137+
A log of the error is needed for the fix to review. A full description of the issue and how the error triggered is on https://github.com/Islandora-Devops/isle-dc/pull/213.
138+
139+
To fix this:
140+
141+
* Run `make fix_views`

scripts/patch_views.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# To be precise on the error message that matches the error this should address.
5+
ERROR_MESSAGE=$(drush watchdog:show --severity=Error --filter="InvalidArgumentException: A valid cache entry key is required" | awk '{print $6}')
6+
7+
# If error message equals to "No such file or directory", then exit.
8+
if [[ $ERROR_MESSAGE == *'InvalidArgumentException'* ]]; then
9+
10+
# Install Drupal Console.
11+
drupal_console_installed() {
12+
composer show 'drupal/console' | grep -q '/var/www/drupal/vendor/drupal/console'
13+
}
14+
if drupal_console_installed; then
15+
echo 'Package installed'
16+
else
17+
composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader -W
18+
fi
19+
20+
# Reinstall views
21+
enabled_view=`/var/www/drupal/vendor/drupal/console/bin/drupal debug:views --status='Enabled' | cut -d ' ' -f 2 | tail -n +2`
22+
for dis_view in $enabled_view; do
23+
echo "Disabling view $dis_view"
24+
/var/www/drupal/vendor/drupal/console/bin/drupal views:disable $dis_view
25+
done
26+
27+
for en_view in $enabled_view; do
28+
echo "Reenabling view $en_view"
29+
/var/www/drupal/vendor/drupal/console/bin/drupal views:enable $en_view
30+
done
31+
32+
# Install devel.
33+
devel_installed() {
34+
composer show 'drupal/devel' | grep -q '/var/www/drupal/web/modules/contrib/devel'
35+
}
36+
if devel_installed; then
37+
echo 'Package installed'
38+
else
39+
composer require 'drupal/devel:^4.1' -W
40+
fi
41+
drush pm:enable -y devel
42+
43+
echo -e "\n\nThis will likely throw an error, but that's okay. It's just a patch.\n\n"
44+
{ # try
45+
drush dev:reinstall -y islandora
46+
} || { # catch
47+
echo -e "\nIgnore these errors. This will fail if any content is already created.\n\n"
48+
}
49+
50+
# Clear caches
51+
/var/www/drupal/vendor/drupal/console/bin/drupal cache:rebuild
52+
/var/www/drupal/vendor/drupal/console/bin/drupal cr all
53+
/var/www/drupal/vendor/drupal/console/bin/drupal node:access:rebuild
54+
drush cron
55+
fi

0 commit comments

Comments
 (0)