Skip to content

Commit 1e867b1

Browse files
authored
Merge branch 'master' into patch-2
2 parents e9ebcc8 + 5cdc4c9 commit 1e867b1

4,115 files changed

Lines changed: 92704 additions & 89502 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/build.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
FORMAT="${1:-xhtml}"
6+
7+
case "$FORMAT" in
8+
xhtml) DOCROOT="output/php-chunked-xhtml" ;;
9+
php) DOCROOT="../web-php" ;;
10+
*) echo "Usage: $0 [xhtml|php]" >&2; exit 1 ;;
11+
esac
12+
13+
php ../doc-base/configure.php \
14+
--disable-libxml-check \
15+
--enable-xml-details \
16+
--redirect-stderr-to-stdout \
17+
--with-lang=en
18+
19+
php -d memory_limit=512M ../phd/render.php \
20+
--docbook ../doc-base/.manual.xml \
21+
--output ./output \
22+
--package PHP \
23+
--format "$FORMAT"
24+
25+
# Restart any existing server, then launch the new one in its own session so
26+
# Ctrl+C in the debug terminal only kills the log tail below. The server keeps
27+
# running until the next build replaces it (or the container shuts down).
28+
#
29+
# auto_prepend_file rewrites $_SERVER from the request's Host header so the PHP
30+
# format's $MYSITE-built URLs work behind Codespaces / other port forwarders.
31+
LOG="/tmp/php-server-${FORMAT}.log"
32+
pkill -f 'php -S 0.0.0.0:8080' 2>/dev/null || true
33+
PREPEND="$(cd "$(dirname "$0")" && pwd)/server-prepend.php"
34+
setsid nohup php -d "auto_prepend_file=$PREPEND" -S 0.0.0.0:8080 -t "$DOCROOT" \
35+
>"$LOG" 2>&1 </dev/null &
36+
SERVER_PID=$!
37+
38+
cat <<EOF
39+
40+
Server: http://localhost:8080 (pid $SERVER_PID, doc root: $DOCROOT)
41+
Logs: $LOG
42+
Ctrl+C exits this tail; the server keeps running.
43+
44+
EOF
45+
46+
exec tail -f "$LOG"

.devcontainer/devcontainer.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/php
3+
{
4+
"name": "PHP",
5+
"image": "mcr.microsoft.com/devcontainers/php:8.4-trixie",
6+
7+
// Features to add to the dev container. More info: https://containers.dev/features.
8+
"features": {
9+
"ghcr.io/devcontainers/features/github-cli:1": {},
10+
"ghcr.io/devcontainers/features/java:1": {
11+
"version": "lts",
12+
"installGradle": false,
13+
"installMaven": false
14+
}
15+
},
16+
17+
// Configure tool-specific properties.
18+
"customizations": {
19+
// Configure properties specific to VS Code.
20+
"vscode": {
21+
"extensions": [
22+
"editorconfig.editorconfig",
23+
"redhat.vscode-xml"
24+
],
25+
// Workspace-level launch config
26+
"settings": {
27+
"launch": {
28+
"version": "0.2.0",
29+
"configurations": [
30+
{
31+
"name": "Build XHTML & serve",
32+
"type": "node-terminal",
33+
"request": "launch",
34+
"command": ".devcontainer/build.sh xhtml"
35+
},
36+
{
37+
"name": "Build PHP web & serve",
38+
"type": "node-terminal",
39+
"request": "launch",
40+
"command": ".devcontainer/build.sh php"
41+
}
42+
]
43+
}
44+
}
45+
}
46+
},
47+
48+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
49+
"forwardPorts": [
50+
8080
51+
],
52+
53+
// Use 'postCreateCommand' to run commands after the container is created.
54+
"postCreateCommand": "sudo .devcontainer/post-create.sh",
55+
56+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
57+
// "remoteUser": "root"
58+
}

.devcontainer/post-create.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
WORKSPACE="$(cd "$(dirname "$0")/.." && pwd)"
6+
PARENT="$(dirname "$WORKSPACE")"
7+
OWNER="$(stat -c '%U' "$WORKSPACE")"
8+
9+
# Clone doc-base, phd, and web-php as siblings of doc-en.
10+
[ -d "$PARENT/doc-base" ] || sudo -u "$OWNER" git -C "$PARENT" clone --depth 1 https://github.com/php/doc-base.git
11+
[ -d "$PARENT/phd" ] || sudo -u "$OWNER" git -C "$PARENT" clone --depth 1 https://github.com/php/phd.git
12+
[ -d "$PARENT/web-php" ] || sudo -u "$OWNER" git -C "$PARENT" clone --depth 1 https://github.com/php/web-php.git
13+
14+
# doc-base's configure.php looks for the language source as a sibling directory
15+
[ -e "$PARENT/en" ] || sudo -u "$OWNER" ln -s "$WORKSPACE" "$PARENT/en"
16+
17+
# Xdebug degrades performance and is not needed for the build, so disable it by default.
18+
rm -f /usr/local/etc/php/conf.d/xdebug.ini
19+
20+
# Pre-create the served directories
21+
sudo -u "$OWNER" mkdir -p "$WORKSPACE/output/php-chunked-xhtml" "$WORKSPACE/output/php-web"
22+
sudo -u "$OWNER" rm -rf "$PARENT/web-php/manual/en"
23+
sudo -u "$OWNER" ln -s "$WORKSPACE/output/php-web" "$PARENT/web-php/manual/en"
24+
25+
cat <<'EOF'
26+
27+
Devcontainer ready.
28+
29+
Build & serve: F5 > "Build XHTML & serve" (or "Build PHP web & serve")
30+
31+
View them: http://localhost:8080
32+
33+
EOF

.devcontainer/server-prepend.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
// This file rewrites $_SERVER from the request's Host header so the PHP
4+
// format's $MYSITE-built URLs work behind Codespaces / other port forwarders.
5+
6+
$forwardedHttps = ($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https';
7+
$hostHeader = $_SERVER['HTTP_X_FORWARDED_HOST'] ?? $_SERVER['HTTP_HOST'] ?? '';
8+
9+
if ($hostHeader !== '') {
10+
$_SERVER['HTTP_HOST'] = $hostHeader;
11+
}
12+
13+
if ($forwardedHttps) {
14+
$_SERVER['HTTPS'] = 'on';
15+
}

.docker/Dockerfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
FROM php:8.2-cli
2+
ARG UID=1000
3+
ARG GID=1000
24

35
RUN apt-get update && \
46
apt-get install -y git default-jre-headless
@@ -9,11 +11,18 @@ ADD https://api.github.com/repos/php/phd/git/refs/heads/master version-phd.json
911
ADD https://api.github.com/repos/php/doc-base/git/refs/heads/master version-doc-base.json
1012

1113
RUN git clone --depth 1 https://github.com/php/phd.git && \
12-
git clone --depth 1 https://github.com/php/doc-base.git
14+
git clone --depth 1 https://github.com/php/doc-base.git && \
15+
chown -R $UID:$GID phd doc-base
1316

1417
RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/local.ini
1518

1619
ENV FORMAT=xhtml
1720

18-
CMD php doc-base/configure.php --disable-segfault-error && \
19-
php phd/render.php --docbook doc-base/.manual.xml --output=/var/www/en/output --package PHP --format ${FORMAT}
21+
CMD ["sh", "-c", "\
22+
php doc-base/configure.php && \
23+
exec php phd/render.php \
24+
--docbook doc-base/.manual.xml \
25+
--output=/var/www/en/output \
26+
--package PHP \
27+
--format ${FORMAT}\
28+
"]

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
version: 2
22
updates:
3+
- package-ecosystem: "devcontainers"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
37
- package-ecosystem: "github-actions"
48
directory: "/"
59
schedule:

.github/workflows/check-whitespace.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/docbook-cs.yaml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# https://docs.github.com/en/actions
2+
3+
name: "DocBook Lint"
4+
5+
on:
6+
push:
7+
branches:
8+
- "master"
9+
pull_request:
10+
branches:
11+
- "master"
12+
13+
permissions:
14+
contents: "read"
15+
16+
concurrency:
17+
group: "${{ github.workflow }}-${{ github.ref }}"
18+
cancel-in-progress: true
19+
20+
jobs:
21+
docbook-cs:
22+
name: "DocBook Style Check"
23+
runs-on: "ubuntu-latest"
24+
25+
env:
26+
# Base commit to diff against: PR base on pull_request, pre-push tip on push.
27+
BASE_SHA: |-
28+
${{
29+
case(
30+
github.event_name == 'pull_request', github.event.pull_request.base.sha,
31+
github.event_name == 'push', github.event.before,
32+
'INVALID'
33+
)
34+
}}
35+
36+
strategy:
37+
matrix:
38+
language:
39+
- "en"
40+
41+
steps:
42+
- name: "Checkout php/doc-${{ matrix.language }}"
43+
uses: "actions/checkout@v7"
44+
with:
45+
ref: "${{ github.event.pull_request.head.sha }}"
46+
path: "${{ matrix.language }}"
47+
fetch-depth: 50
48+
49+
- name: "Checkout php/doc-base"
50+
uses: "actions/checkout@v7"
51+
with:
52+
path: "doc-base"
53+
repository: "php/doc-base"
54+
55+
- name: "Checkout php/docbook-cs"
56+
uses: "actions/checkout@v7"
57+
with:
58+
path: "docbook-cs"
59+
repository: "php/docbook-cs"
60+
61+
- name: "Fetch diff base"
62+
working-directory: "${{ matrix.language }}"
63+
run: |
64+
git fetch origin "$BASE_SHA" --depth=50
65+
# Deepen until the merge-base is reachable (long-lived branches)
66+
for i in 1 2 3 4 5; do
67+
git merge-base "$BASE_SHA" HEAD >/dev/null 2>&1 && break
68+
git fetch --deepen=100 origin "$BASE_SHA"
69+
done
70+
71+
- name: "Setup PHP"
72+
uses: "shivammathur/setup-php@v2"
73+
with:
74+
php-version: "8.5"
75+
extensions: "dom, libxml, simplexml"
76+
tools: composer, cs2pr
77+
78+
- name: "Build documentation"
79+
run: |
80+
php doc-base/configure.php \
81+
--disable-libxml-check \
82+
--enable-xml-details \
83+
--redirect-stderr-to-stdout \
84+
--with-lang=${{ matrix.language }}
85+
86+
- name: "Install docbook-cs"
87+
working-directory: "docbook-cs"
88+
run: composer install --no-interaction --no-progress
89+
90+
- name: "Run docbook-cs with diff"
91+
working-directory: "${{ matrix.language }}"
92+
run: |
93+
set -o pipefail
94+
git diff "$BASE_SHA"...HEAD | php ../docbook-cs/bin/docbook-cs \
95+
--report=checkstyle \
96+
--diff \
97+
--no-colors > docbook-report.xml
98+
99+
- name: "Upload report"
100+
if: ${{ ! cancelled() }}
101+
uses: "actions/upload-artifact@v7"
102+
with:
103+
name: "docbook-report"
104+
path: "${{ matrix.language }}/docbook-report.xml"
105+
106+
- name: "Annotate PR with violations"
107+
if: ${{ ! cancelled() }}
108+
working-directory: "${{ matrix.language }}"
109+
run: cs2pr docbook-report.xml --colorize --prepend-filename

.github/workflows/integrate.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ jobs:
2424

2525
steps:
2626
- name: "Checkout php/doc-${{ matrix.language }}"
27-
uses: "actions/checkout@v5"
27+
uses: "actions/checkout@v7"
2828
with:
2929
path: "${{ matrix.language }}"
3030
repository: "php/doc-${{ matrix.language }}"
3131

3232
- name: "Checkout php/doc-en as fallback"
3333
if: "matrix.language != 'en'"
34-
uses: "actions/checkout@v5"
34+
uses: "actions/checkout@v7"
3535
with:
3636
path: "en"
3737
repository: "php/doc-en"
3838

3939
- name: "Checkout php/doc-base"
40-
uses: "actions/checkout@v5"
40+
uses: "actions/checkout@v7"
4141
with:
4242
path: "doc-base"
4343
repository: "php/doc-base"
@@ -51,7 +51,7 @@ jobs:
5151
run: "php8.1 doc-base/configure.php --disable-libxml-check --enable-xml-details --redirect-stderr-to-stdout --with-lang=${{ matrix.language }}"
5252

5353
- name: "Upload .manual.xml"
54-
uses: actions/upload-artifact@v4
54+
uses: actions/upload-artifact@v7
5555
with:
5656
name: .manual.xml
5757
path: doc-base/.manual.xml

CODEOWNERS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
# For more information, see the GitHub CODEOWNERS documentation:
99
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
1010

11-
/reference/dom @nielsdos
11+
/reference/dom @ndossche
1212
/reference/hash @TimWolla
13-
/reference/libxml @nielsdos
13+
/reference/libxml @ndossche
1414
/reference/mysqli @kamil-tekiela
1515
/reference/mysqlnd @kamil-tekiela
1616
/reference/pdo @kamil-tekiela
1717
/reference/pdo_mysql @kamil-tekiela
1818
/reference/random @TimWolla
19+
/reference/uri @TimWolla

0 commit comments

Comments
 (0)