Skip to content

Commit c481162

Browse files
authored
Merge pull request #144 from akunzai/upgrade-joomla-5.4.0
Modernize PHP - Drop support for Joomla 3.10 and 4.x
2 parents 39043c3 + a9dddb9 commit c481162

140 files changed

Lines changed: 3165 additions & 3752 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,18 @@ mkcert -cert-file .secrets/cert.pem -key-file .secrets/key.pem 'auth.dev.local'
1818
# set up hosts in Host
1919
echo "127.0.0.1 auth.dev.local www.dev.local" | sudo tee -a /etc/hosts
2020

21-
# starting container or open folder in container
21+
# starting container
2222
docker compose up -d
2323

24-
# install the Joomla! (requires Joomla! version >= 4.3)
24+
# starting container with for debug
25+
# > use VSCode to attach running joomla container for Xdebug
26+
docker compose -f compose.yml -f compose.debug.yml up -d
27+
28+
# install or update the Joomla extension
2529
./joomla/install.sh
30+
31+
# force re-install the Joomla extension
32+
./joomla/install.sh --force
2633
```
2734

2835
## URLs

.devcontainer/compose.debug.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
services:
2+
joomla:
3+
environment:
4+
# https://xdebug.org/docs/all_settings
5+
XDEBUG_CONFIG: 'client_host=localhost log=/tmp/xdebug.log'
6+
XDEBUG_MODE: develop,debug
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ services:
6464
environment:
6565
JOOMLA_DB_HOST: ${JOOMLA_DB_HOST:-mysql}
6666
JOOMLA_DB_PASSWORD: ${JOOMLA_DB_PASSWORD:-${MYSQL_ROOT_PASSWORD:-secret}}
67-
# https://xdebug.org/docs/all_settings
68-
# XDEBUG_CONFIG: 'client_host=localhost log=/tmp/xdebug.log'
69-
# XDEBUG_MODE: develop,debug
7067
ports:
7168
- 127.0.0.1:80:80
7269
depends_on:

.devcontainer/devcontainer.json

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"name": "Joomla External Login",
44
// https://github.com/devcontainers/images/tree/main/src/php
5-
"dockerComposeFile": "compose.yaml",
5+
"dockerComposeFile": "compose.yml",
66
"service": "joomla",
77
"workspaceFolder": "/workspace",
88
"portsAttributes": {
@@ -21,13 +21,16 @@
2121
"remoteEnv": {
2222
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
2323
},
24+
"mounts": [
25+
"source=${localEnv:HOME}/.local/share/opencode/auth.json,target=/tmp/opencode-auth.json,type=bind,consistency=cached"
26+
],
2427
"customizations": {
2528
"vscode": {
2629
"extensions": [
2730
"bmewburn.vscode-intelephense-client",
31+
"fill-labs.dependi",
2832
"mhutchie.git-graph",
29-
"mrmlnc.vscode-apache",
30-
"pflannery.vscode-versionlens",
33+
"ms-azuretools.vscode-containers",
3134
"redhat.vscode-xml",
3235
"xdebug.php-debug"
3336
],
@@ -38,7 +41,12 @@
3841
},
3942
// https://containers.dev/features
4043
"features": {
41-
"ghcr.io/devcontainers/features/git:1": {},
42-
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
44+
"ghcr.io/danzilberdan/devcontainers/opencode:0": {},
45+
"ghcr.io/devcontainers/features/git:1": {
46+
"version": "system"
47+
},
48+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
49+
"moby": false
50+
}
4351
}
4452
}

.devcontainer/joomla/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG PHP_VERSION=8.3.24
22
ARG PHP_EXTRA_BUILD_DEPS=""
33
# https://hub.docker.com/_/joomla
4-
ARG JOOMLA_VERSION=5.3.4
4+
ARG JOOMLA_VERSION=5.4.0
55

66
FROM joomla:${JOOMLA_VERSION}-apache AS joomla
77

@@ -16,7 +16,7 @@ RUN --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \
1616
set -eux; \
1717
apt-get update; \
1818
# install the system tools we need
19-
apt-get install -y --no-install-recommends mariadb-client; \
19+
apt-get install -y --no-install-recommends mariadb-client unzip; \
2020
# install the PHP extensions we need
2121
savedAptMark="$(apt-mark showmanual)"; \
2222
apt-get install -y --no-install-recommends \

.devcontainer/joomla/install.sh

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,52 @@
11
#!/usr/bin/env bash
22

3-
if docker compose exec joomla test -f configuration.php; then
4-
echo "Joomla! already installed!"
5-
exit 0
6-
fi
7-
83
# shellcheck disable=1091
94
[[ -f .env ]] && source .env
105

6+
echo "Checking database ..."
117
for _ in $(seq 1 20); do
128
# shellcheck disable=2312
139
docker compose exec mysql sh -c "mysql -u${JOOMLA_DB_USER:-root} -p${JOOMLA_DB_PASSWORD:-${MYSQL_ROOT_PASSWORD:-secret}} -e 'show databases;' 2>/dev/null" | grep -qF 'joomla' && break
1410
sleep 1
1511
done
1612

17-
if ! docker compose exec joomla test -f installation/joomla.php; then
18-
echo "Joomla! CLI installer not found! (requires Joomla! version >= 4.3)"
19-
exit 1
13+
if ! docker compose exec joomla test -f configuration.php && docker compose exec joomla test -f installation/joomla.php; then
14+
# https://docs.joomla.org/J4.x:Joomla_CLI_Installation
15+
docker compose exec --user www-data joomla php installation/joomla.php install \
16+
--site-name DEMO \
17+
--admin-user ADMIN \
18+
--admin-username "${ADMIN_USERNAME:-admin}" \
19+
--admin-password "${ADMIN_PASSWORD:-ChangeTheP@ssw0rd}" \
20+
--admin-email "${ADMIN_EMAIL:-admin@example.com}" \
21+
--db-host "${JOOMLA_DB_HOST:-mysql}" \
22+
--db-name "${JOOMLA_DB_NAME:-joomla}" \
23+
--db-user "${JOOMLA_DB_USER:-root}" \
24+
--db-pass "${JOOMLA_DB_PASSWORD:-${MYSQL_ROOT_PASSWORD:-secret}}" \
25+
--db-prefix "${JOOMLA_DB_PREFIX:-vlqhe_}" \
26+
--no-interaction
2027
fi
2128

22-
# https://docs.joomla.org/J4.x:Joomla_CLI_Installation
23-
docker compose exec --user www-data joomla php installation/joomla.php install \
24-
--site-name DEMO \
25-
--admin-user ADMIN \
26-
--admin-username "${ADMIN_USERNAME:-admin}" \
27-
--admin-password "${ADMIN_PASSWORD:-ChangeTheP@ssw0rd}" \
28-
--admin-email "${ADMIN_EMAIL:-admin@example.com}" \
29-
--db-host "${JOOMLA_DB_HOST:-mysql}" \
30-
--db-name "${JOOMLA_DB_NAME:-joomla}" \
31-
--db-user "${JOOMLA_DB_USER:-root}" \
32-
--db-pass "${JOOMLA_DB_PASSWORD:-${MYSQL_ROOT_PASSWORD:-secret}}" \
33-
--db-prefix "${JOOMLA_DB_PREFIX:-vlqhe_}" \
34-
--no-interaction
29+
echo "Bundling extension ..."
30+
docker compose exec -w /workspace joomla ./bundle.sh >/dev/null
31+
32+
# https://docs-next.joomla.org/docs/command-line-interface/using-the-cli/
33+
if docker compose exec joomla test -f /var/www/html/cli/joomla.php; then
34+
35+
if [[ "${1:-}" == "--force" ]]; then
36+
docker compose exec joomla bash -c "php /var/www/html/cli/joomla.php extension:list | grep -iE '(external|caslogin)' | awk '{print \$2}' | xargs -I{} php /var/www/html/cli/joomla.php extension:remove -n {}" || true
37+
fi
38+
39+
docker compose exec joomla php /var/www/html/cli/joomla.php extension:install --path /workspace/dist/pkg_externallogin.zip
40+
41+
docker compose exec joomla php /var/www/html/cli/joomla.php cache:clean || true
42+
43+
echo "Configuring logging ..."
44+
docker compose exec joomla php /var/www/html/cli/joomla.php config:set log_path=/tmp
45+
if ! docker compose exec joomla grep -q "log_everything" /var/www/html/configuration.php; then
46+
docker compose exec joomla sed -i "s|^}$|\tpublic \$log_everything = 1;\n}|" /var/www/html/configuration.php
47+
fi
48+
49+
fi
3550

3651
echo "Fixing permissions ..."
3752
docker compose exec joomla chown -R www-data:www-data /var/www/html

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v5
17-
- name: Build package
18-
run: ./build.sh
17+
- name: Bundle extension
18+
run: ./bundle.sh
1919
- name: Pre-release
2020
uses: softprops/action-gh-release@v2
2121
if: startsWith(github.ref, 'refs/tags/') && (contains(github.ref,'dev') || contains(github.ref,'beta') || contains(github.ref,'alpha') || contains(github.ref,'rc'))

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ Thumbs.db
2525
/tmp/
2626

2727
# misc
28-
/dist/
28+
/dist/
29+
.claude/

.php-cs-fixer.dist.php

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,50 @@
11
<?php
2-
$finder = PhpCsFixer\Finder::create()
2+
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
6+
7+
$finder = Finder::create()
38
->in([__DIR__ . '/src']);
49

5-
$config = new PhpCsFixer\Config();
10+
$config = new Config();
611
return $config
7-
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
12+
->setParallelConfig(ParallelConfigFactory::detect())
813
->setRules([
914
'@PSR12' => true,
10-
'@PHP81Migration' => true
15+
'@PHP81Migration' => true,
16+
17+
// PHPDoc rules
18+
'phpdoc_align' => ['align' => 'left'],
19+
'phpdoc_annotation_without_dot' => true,
20+
'phpdoc_indent' => true,
21+
'phpdoc_inline_tag_normalizer' => true,
22+
'phpdoc_no_access' => true,
23+
'phpdoc_no_empty_return' => true,
24+
'phpdoc_no_package' => true,
25+
'phpdoc_no_useless_inheritdoc' => true,
26+
'phpdoc_order' => true,
27+
'phpdoc_return_self_reference' => true,
28+
'phpdoc_scalar' => true,
29+
'phpdoc_separation' => true,
30+
'phpdoc_single_line_var_spacing' => true,
31+
'phpdoc_summary' => true,
32+
'phpdoc_trim' => true,
33+
'phpdoc_trim_consecutive_blank_line_separation' => true,
34+
'phpdoc_types' => true,
35+
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
36+
'phpdoc_var_annotation_correct_order' => true,
37+
'phpdoc_var_without_name' => true,
38+
39+
// Additional documentation rules
40+
'no_blank_lines_after_phpdoc' => true,
41+
'no_empty_phpdoc' => true,
42+
'no_superfluous_phpdoc_tags' => [
43+
'allow_mixed' => true,
44+
'remove_inheritdoc' => false,
45+
],
46+
47+
// Type hints
48+
'native_function_type_declaration_casing' => true,
1149
])
1250
->setFinder($finder);

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"recommendations": [
3+
"bmewburn.vscode-intelephense-client",
34
"mhutchie.git-graph",
5+
"ms-azuretools.vscode-containers",
6+
"sst-dev.opencode",
47
"streetsidesoftware.code-spell-checker"
58
]
69
}

0 commit comments

Comments
 (0)