diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c793cc3..b93b94d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,30 +1,18 @@ -FROM mcr.microsoft.com/devcontainers/php:0-7.4-bullseye +ARG imageVariant +FROM mcr.microsoft.com/devcontainers/php:1-${imageVariant} # Replaces invalid key. Required to use apt-get when running this PHP 7.4 image. -RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ - echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list +# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ +# echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list # Install packages RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ - && apt-get install -y mariadb-client libpng-dev \ + && apt-get install -y mariadb-client libpng-dev apache2 bash-completion subversion \ && apt-get clean -y && rm -rf /var/lib/apt/lists/* # Install php-mysql driver RUN docker-php-ext-install mysqli pdo pdo_mysql pcntl gd -# Install additional packages -RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ - && apt-get -y install --no-install-recommends bash-completion subversion - -# Set up self signed SSL certificate and enable SSL -RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/localhost.key -out /etc/ssl/certs/localhost.crt -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=localhost" \ - && a2enmod ssl \ - && a2ensite default-ssl - -# Add self signed ssl certificate to site config -RUN sed -i 's/SSLCertificateFile.*/SSLCertificateFile \/etc\/ssl\/certs\/localhost.crt/g' /etc/apache2/sites-available/default-ssl.conf \ - && sed -i 's/SSLCertificateKeyFile.*/SSLCertificateKeyFile \/etc\/ssl\/private\/localhost.key/g' /etc/apache2/sites-available/default-ssl.conf - # Install WP-CLI RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \ && chmod +x wp-cli.phar \ @@ -34,7 +22,14 @@ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli RUN curl -O https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash \ && mv wp-completion.bash /etc/bash_completion.d/wp-completion.bash -RUN a2enmod headers mime rewrite +# Generate self-signed SSL certificate and add to site conf +RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt \ + -subj "/C=US/ST=State/L=City/O=Organization/OU=Unit/CN=example.com" \ + && sed -i 's/SSLCertificateFile\t\/etc\/ssl\/certs\/ssl-cert-snakeoil.pem/SSLCertificateFile \/etc\/ssl\/certs\/apache-selfsigned.crt/g' /etc/apache2/sites-available/default-ssl.conf \ + && sed -i 's/SSLCertificateKeyFile \/etc\/ssl\/private\/ssl-cert-snakeoil.key/SSLCertificateKeyFile \/etc\/ssl\/private\/apache-selfsigned.key/g' /etc/apache2/sites-available/default-ssl.conf + +RUN a2enmod headers mime rewrite ssl +RUN a2ensite default-ssl # [Optional] Uncomment this line to install global node packages. # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 41ff0be..25c10f1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,21 +6,16 @@ "service": "app", "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", "forwardPorts": [ - 80, - 443, - 3306, - 8080, - 8001 + 443 ], "containerEnv": { "XDEBUG_MODE": "off" }, // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": { - "symlink-to-www": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html", + "apache": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html && sudo service apache2 start", "symlink-npmrc-to-user-catalog": "ln -s \"$(pwd)/.devcontainer/config/.npmrc\" /home/vscode/.npmrc", - "start-apache": "sudo service apache2 start", - "add-github-token-to-composer": "composer config github-oauth.github.com $MUNICIPIO_GITHUB_TOKEN" + "add-github-token-to-composer": "composer config github-oauth.github.com $MUNICIPIO_GITHUB_TOKEN", }, // Features to add to the dev container. More info: https://containers.dev/features. "features": { @@ -28,7 +23,7 @@ "version": "16" } }, - "waitFor": "postCreateCommand", + // "waitFor": "postCreateCommand", // Configure tool-specific properties. "customizations": { "vscode": { @@ -54,18 +49,13 @@ "onAutoForward": "openPreview", "requireLocalPort": false, "protocol": "https" - }, - "8080": { - "label": "phpMyAdmin" - }, - "8001": { - "label": "RedisInsight " } }, "intelephense.environment.includePaths": [ "/tmp/wordpress-tests-lib", "/tmp/wordpress" - ] + ], + "intelephense.environment.phpVersion": "8.3" } } } diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 60e6cdc..498efb4 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -5,6 +5,9 @@ services: build: context: . dockerfile: Dockerfile + args: + imageVariant: 8.0-bullseye + env_file: - .env @@ -35,7 +38,7 @@ services: image: phpmyadmin/phpmyadmin restart: always ports: - - '8080:80' + - '80' environment: PMA_HOST: db MYSQL_ROOT_PASSWORD: mariadb @@ -50,7 +53,7 @@ services: redis-insight: image: "redislabs/redisinsight:latest" ports: - - '8001:8001' + - '8001' environment: - REDIS_URI=redis://redis:6379 diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index affd896..625bf6e 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: helsingborg-stad/municipio-deploy/3.0@master + - uses: helsingborg-stad/municipio-deploy/4.0@master with: deploy-host: ${{ secrets.DEPLOY_REMOTE_HOST_PROD }} deploy-port: ${{ secrets.DEPLOY_REMOTE_PORT_PROD }} diff --git a/.github/workflows/deploy-stage.yml b/.github/workflows/deploy-stage.yml index 9ce1218..c19d01a 100644 --- a/.github/workflows/deploy-stage.yml +++ b/.github/workflows/deploy-stage.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: helsingborg-stad/municipio-deploy/3.0@master + - uses: helsingborg-stad/municipio-deploy/4.0@master with: deploy-host: ${{ secrets.DEPLOY_REMOTE_HOST_STAGE }} deploy-port: ${{ secrets.DEPLOY_REMOTE_PORT_STAGE }} diff --git a/composer.json b/composer.json index e9e540b..889a3cd 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ } ], "require": { - "php": ">=7.4", + "php": "^8.0", "apix/log": "^1.2.2", "aws/aws-sdk-php": "^3.282.1", "composer/installers": "~1.0", @@ -41,47 +41,48 @@ "helsingborg-stad/acf-ux-collapse": "~2.0.0", "helsingborg-stad/active-directory-api-wp-integration": "~3.0.7", "helsingborg-stad/algolia-index": "~3.0.6", - "helsingborg-stad/algolia-index-js-searchpage-addon": "~2.0.2", + "helsingborg-stad/algolia-index-js-searchpage-addon": "^3.0.2", "helsingborg-stad/algolia-index-modularity-addon": "~3.0.5", - "helsingborg-stad/api-alarm-integration": "~3.0.4", - "helsingborg-stad/api-event-manager-integration": "~1.2.7", + "helsingborg-stad/api-alarm-integration": "^4.0.1", + "helsingborg-stad/api-event-manager-integration": "^2.0.1", "helsingborg-stad/api-project-manager-integration": "~2.0.2", - "helsingborg-stad/api-volunteer-manager-integration": "~2.2.19", + "helsingborg-stad/api-volunteer-manager-integration": "^3.0.1", "helsingborg-stad/attachment-revisions": "~3.0.4", "helsingborg-stad/better-post-ui": "~3.0.3", + "helsingborg-stad/blade": "^3.4.3", "helsingborg-stad/broken-link-detector": "~3.0.3", - "helsingborg-stad/component-library": "~3.17.2", + "helsingborg-stad/component-library": "^4.0.14", "helsingborg-stad/content-scheduler": "~3.0.5", "helsingborg-stad/custom-short-links": "~3.0.4", "helsingborg-stad/customer-feedback": "~4.0.6", "helsingborg-stad/easy-to-read-alternative": "~3.0.4", "helsingborg-stad/force-ssl": "~3.0.2", - "helsingborg-stad/gdi-modularity-cases": "~1.0.3", - "helsingborg-stad/gdi-modularity-invoices": "~1.0.4", - "helsingborg-stad/gdi-modularity-my-pages-about-me": "~1.0.3", - "helsingborg-stad/global-blade-engine": "~2", - "helsingborg-stad/job-listings": "~4.1.2", - "helsingborg-stad/like-posts": "~1.1.0", + "helsingborg-stad/gdi-modularity-cases": "~1.0.4", + "helsingborg-stad/gdi-modularity-invoices": "~1.0.5", + "helsingborg-stad/gdi-modularity-my-pages-about-me": "~1.0.4", + "helsingborg-stad/job-listings": "~4.1.3", + "helsingborg-stad/kirki": "~5.1.0", + "helsingborg-stad/like-posts": "^2.1.1", "helsingborg-stad/lix-calculator": "~4.0.2", "helsingborg-stad/media-usage": "~3.0.4", - "helsingborg-stad/mod-my-pages": "~1.0.3", - "helsingborg-stad/modularity": "~5.23.2", + "helsingborg-stad/mod-my-pages": "~1.0.5", + "helsingborg-stad/modularity": "^6.0.10", "helsingborg-stad/modularity-contact-banner": "~3.1.0", - "helsingborg-stad/modularity-entryscape": "~3.0.3", + "helsingborg-stad/modularity-entryscape": "^4.0.0", "helsingborg-stad/modularity-form-builder": "~3.1.2", "helsingborg-stad/modularity-guides": "~4.0.2", "helsingborg-stad/modularity-interactive-img-map": "~4.0.2", "helsingborg-stad/modularity-json-render": "~3.0.2", "helsingborg-stad/modularity-local-events": "~3.1.0", - "helsingborg-stad/modularity-open-street-map": "~1.1.3", - "helsingborg-stad/modularity-products": "~2.0.2", - "helsingborg-stad/modularity-recommend": "~2.0.2", + "helsingborg-stad/modularity-open-street-map": "^2.0.1", + "helsingborg-stad/modularity-products": "^3.0.0", + "helsingborg-stad/modularity-recommend": "^3.0.0", "helsingborg-stad/modularity-sections": "~3.0.2", "helsingborg-stad/modularity-testimonials": "~3.0.2", - "helsingborg-stad/modularity-timeline": "~3.0.2", + "helsingborg-stad/modularity-timeline": "^4.0.0", "helsingborg-stad/multi-network-urls": "~2.0.0", "helsingborg-stad/multisite-role-propagation": "~3.0.3", - "helsingborg-stad/municipio": "~3.67.2", + "helsingborg-stad/municipio": "^4.1.8", "helsingborg-stad/redirection-extended": "~3.0.3", "helsingborg-stad/s3-uploads-custom-endpoint": "~2.0.0", "helsingborg-stad/search-notices": "~3.0.2", @@ -90,6 +91,7 @@ "helsingborg-stad/wp-page-for-term": "~3.0.2", "helsingborg-stad/wp-search-statistics": "~1.0.1", "helsingborg-stad/wpmu-acf-google-maps-key": "~1.0.0", + "helsingborg-stad/wpmu-correct-file-paths": "~1.1.3", "helsingborg-stad/wpmu-litespeed-common-settings": "~2.0.1", "helsingborg-stad/wpmu-mu-plugins-url-everywhere": "~2.0.1", "helsingborg-stad/wpmu-network-admin-url": "~2.0.3", @@ -112,22 +114,19 @@ "wpackagist-plugin/autodescription": "~4.2.8", "wpackagist-plugin/cookies-and-content-security-policy": "~2.22", "wpackagist-plugin/fakerpress": "~0.6.2", - "helsingborg-stad/kirki": "~5.0.0", "wpackagist-plugin/litespeed-cache": "~5.6", "wpackagist-plugin/network-plugin-auditor": "~1.10.1", "wpackagist-plugin/nginx-helper": "^2.2.4", - "wpackagist-plugin/performant-translations": "~1.1.1", "wpackagist-plugin/redirection": "~5.4.2", "wpackagist-plugin/redis-cache": "2.5.0", "wpackagist-plugin/simple-smtp": "~1.3.3", - "wpackagist-plugin/stream":"~3.10.0", + "wpackagist-plugin/stream": "~3.10.0", "wpackagist-plugin/user-switching": "~1.7.2", "wpackagist-plugin/username-changer": "~3.2.2", "wpackagist-plugin/varnish-http-purge": "~5.2.1", "wpackagist-plugin/wp-multi-network": "~2.5.2", "wpackagist-plugin/wp-nested-pages": "~3.2.4", - "wpackagist-plugin/wp-sentry-integration": "^6.26", - "helsingborg-stad/wpmu-correct-file-paths": "~1.1.3" + "wpackagist-plugin/wp-sentry-integration": "^6.26" }, "extra": { "path": "/", @@ -135,11 +134,7 @@ "installer-paths": { "wp-content/mu-plugins/{$name}": [ "type:wordpress-muplugin", - "type:acf-plugin", - "kirki-framework/kirki", - "helsingborg-stad/kirki", - "wpackagist-plugin/kirki", - "wpackagist-plugin/performant-translations" + "type:acf-plugin" ], "wp-content/plugins/{$name}": [ "type:wordpress-plugin" @@ -167,13 +162,11 @@ "scripts": { "post-install-cmd": [ "mkdir -p wp-content/uploads/cache/blade-cache", - "composer dump-autoload -o", - "if [ -d vendor/helsingborg-stad/kirki ]; then mv vendor/helsingborg-stad/kirki wp-content/mu-plugins/kirki/; fi" + "composer dump-autoload -o" ], "post-update-cmd": [ "composer dump-autoload -o --working-dir ./wp-content/plugins/s3-uploads/", - "composer dump-autoload -o", - "if [ -d vendor/helsingborg-stad/kirki ]; then mv vendor/helsingborg-stad/kirki wp-content/mu-plugins/kirki/; fi" + "composer dump-autoload -o" ] } } diff --git a/wp-content/object-cache.php b/wp-content/object-cache.php index dc4f3e2..f436f85 100644 --- a/wp-content/object-cache.php +++ b/wp-content/object-cache.php @@ -2535,6 +2535,11 @@ public function fast_build_key( $key, $group = 'default' ) { * @return string Sanitized string. */ protected function sanitize_key_part( $part ) { + + if( $part === null ) { + return ''; + } + return str_replace( ':', '-', $part ); }