Skip to content

Commit a85eeed

Browse files
author
Paul Bearne
committed
Merge branch 'trunk' into rename-test
# Conflicts: # tests/phpunit/tests/Functions_GetAvatarUrl_Test.php # tests/phpunit/tests/admin/Functions_UrlShorten_Test.php # tests/phpunit/tests/admin/Functions_WpIsAuthorizeApplicationPasswordRequestValid_Test.php # tests/phpunit/tests/admin/includes/Functions_WpGetPluginActionButton_Test.php # tests/phpunit/tests/admin/includes/misc/UrlShorten_Test.php # tests/phpunit/tests/admin/includes/plugin-install/WpGetPluginActionButton_Test.php # tests/phpunit/tests/admin/includes/user/WpIsAuthorizeApplicationPasswordRequestValid_Test.php # tests/phpunit/tests/admin/includes/wpGetPluginActionButton.php # tests/phpunit/tests/admin/includesMisc.php # tests/phpunit/tests/admin/includesUser.php
2 parents aa4ae89 + 2419dda commit a85eeed

3,088 files changed

Lines changed: 347449 additions & 161269 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/devcontainer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "WordPress Core Development",
44
"dockerComposeFile": "docker-compose.yml",
55
"service": "app",
6-
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
6+
"workspaceFolder": "/workspace",
77

88
// Features to add to the dev container. More info: https://containers.dev/features.
99
"features": {

‎.devcontainer/docker-compose.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ services:
1212
WORDPRESS_DB_PASSWORD: examplepass
1313
WORDPRESS_DB_NAME: exampledb
1414
volumes:
15-
- ../..:/workspaces:cached
15+
- ..:/workspace:cached
1616

1717
db:
1818
image: mariadb

‎.devcontainer/setup.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ else
99
fi
1010

1111
# Install dependencies
12-
cd /workspaces/wordpress-develop
12+
cd /workspace
1313
npm install && npm run build:dev
1414

1515
# Install WordPress and activate the plugin/theme.

‎.env.example‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ LOCAL_PORT=8889
1414
# Where to run WordPress from. Valid options are 'src' and 'build'.
1515
LOCAL_DIR=src
1616

17+
# Whether or not to enable text compression (gzip) in the web server.
18+
# Valid options are 'on' and 'off'.
19+
LOCAL_NGINX_COMPRESSION=off
20+
1721
# The PHP version to use. Valid options are 'latest', and '{version}-fpm'.
1822
LOCAL_PHP=latest
1923

@@ -46,12 +50,12 @@ LOCAL_DB_TYPE=mysql
4650
##
4751
# The database version to use.
4852
#
49-
# Defaults to 8.0 with the assumption that LOCAL_DB_TYPE is set to `mysql` above.
53+
# Defaults to 9.7 with the assumption that LOCAL_DB_TYPE is set to `mysql` above.
5054
#
5155
# When using `mysql`, see https://hub.docker.com/_/mysql for valid versions.
5256
# When using `mariadb`, see https://hub.docker.com/_/mariadb for valid versions.
5357
##
54-
LOCAL_DB_VERSION=8.0
58+
LOCAL_DB_VERSION=9.7
5559

5660
# Whether or not to enable multisite.
5761
LOCAL_MULTISITE=false
@@ -67,3 +71,8 @@ LOCAL_WP_TESTS_DOMAIN=example.org
6771

6872
# The URL to use when running e2e tests.
6973
WP_BASE_URL=http://localhost:${LOCAL_PORT}
74+
75+
##
76+
# This silences the tips output by the dotenv package.
77+
##
78+
DOTENV_CONFIG_QUIET=true

‎.eslintignore‎

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

‎.eslintrc-jsdoc.js‎

Lines changed: 59 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,61 @@
1-
module.exports = {
2-
rules: {
3-
'require-jsdoc': 'off',
4-
'valid-jsdoc': [ 'error', {
5-
prefer: {
6-
arg: 'param',
7-
argument: 'param',
8-
extends: 'augments',
9-
returns: 'return',
1+
/**
2+
* ESLint v10 flat config file for JSDoc linting.
3+
* This config is based on the original valid-jsdoc rules.
4+
*/
5+
6+
const jsdocPlugin = require( 'eslint-plugin-jsdoc' );
7+
8+
module.exports = [
9+
{
10+
plugins: {
11+
jsdoc: jsdocPlugin,
12+
},
13+
settings: {
14+
jsdoc: {
15+
tagNamePreference: {
16+
'arg': 'param',
17+
'argument': 'param',
18+
'extends': 'augments',
19+
'returns': 'return',
20+
},
21+
preferredTypes: {
22+
'array': 'Array',
23+
'bool': 'boolean',
24+
'Boolean': 'boolean',
25+
'float': 'number',
26+
'Float': 'number',
27+
'function': 'Function',
28+
'int': 'number',
29+
'integer': 'number',
30+
'Integer': 'number',
31+
'Number': 'number',
32+
'object': 'Object',
33+
'String': 'string',
34+
'Void': 'void',
35+
},
1036
},
11-
preferType: {
12-
array: 'Array',
13-
bool: 'boolean',
14-
Boolean: 'boolean',
15-
float: 'number',
16-
Float: 'number',
17-
int: 'number',
18-
integer: 'number',
19-
Integer: 'number',
20-
Number: 'number',
21-
object: 'Object',
22-
String: 'string',
23-
Void: 'void',
24-
},
25-
requireParamDescription: false,
26-
requireReturn: false,
27-
} ],
37+
},
38+
rules: {
39+
'jsdoc/check-param-names': 'error',
40+
'jsdoc/check-types': 'error',
41+
'jsdoc/check-tag-names': [ 'error', {
42+
definedTags: [
43+
'memberOf',
44+
'output',
45+
'ticket',
46+
'link',
47+
],
48+
} ],
49+
'jsdoc/require-param': [ 'error', {
50+
enableFixer: false,
51+
} ],
52+
'jsdoc/require-param-type': 'error',
53+
'jsdoc/require-returns-check': 'error',
54+
'jsdoc/require-returns-description': 'error',
55+
'jsdoc/require-returns': 'error',
56+
'jsdoc/require-returns-type': 'error',
57+
'jsdoc/check-syntax': 'error',
58+
'jsdoc/require-description': 'error',
59+
},
2860
},
29-
};
61+
];

‎.git-blame-ignore-revs‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,27 @@ f4f1b4821342fd1d58708356b3ec39d6fefe31ac # [33411]
4848

4949
# Coding Standards
5050
8f95800d52c1736d651ae6e259f90ad4a0db2c3f # [42343]
51+
52+
# 6.8 Coding Standards
53+
a4d6fb7c96cb46859e6d48a5d4c06fdeea7d039b # [59292]
54+
9dd87b8f91300917447c271968d3c36289b440e8 # [59558]
55+
# 903b1fe840d4232bbc249d32d8981824e5fa71de # [59953] includes a punctuation change
56+
a96fa164b00ed51c7c0481574834cff92ab9b1f0 # [60043]
57+
7607cbc5d1e770451f1a2b61d851820dfa23bb43 # [60044]
58+
7047a91c0ecdbf43d4a7a0a591464cd1ed2f2c4b # [60046]
59+
1aa6da693ad739b78752a55d154cd48cb757b90b # [60047]
60+
d44e1c2ce2dc638e89ed6a1d02b1cfadb8a15fe7 # [60048]
61+
a18719e7ea49ab7ac0091e076840cb7efdf51cc5 # [60049]
62+
63+
# 6.9 Coding Standards
64+
d0d89b62485e724e3d06f01981dd1940b2f36fce # [60074]
65+
c53010159b60735ffa6ba5fa8a416ff0e86a159c # [60109]
66+
cbb6519119276ceba4279eaee73ab66294ebd820 # [60402]
67+
3d736c763e0b1384c65abfa3bcf6d3bc45869516 # [60664]
68+
b96f25f5c31bfd1580c21084c368098792b4c741 # [60780]
69+
ff6c5fadfa6272685d910b474917ecb6adc17f10 # [60808]
70+
08b2f9cfe9064873a501c3543e2c995405431dcc # [60816]
71+
e683403cc1856113e3cb010b1579dcd01cdef5fc # [61036]
72+
8d24041c08a58b2f79504699fb3f63d01737b876 # [61075]
73+
87cbbb1dfcf19fcfc128fc66603462a649d01502 # [61087]
74+
db1b4811e5ab8df343b03032d7607abe01a9e8e2 # [61138]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Smoke check a WordPress installation'
2+
description: 'Serves an installed single site with PHP built-in web server and checks that its front end, REST API, and admin respond.'
3+
4+
inputs:
5+
admin-user:
6+
description: 'The username of an administrator account on the site.'
7+
required: true
8+
admin-password:
9+
description: 'The password of the administrator account.'
10+
required: true
11+
12+
runs:
13+
using: 'composite'
14+
steps:
15+
- name: Serve the site and check it
16+
shell: bash
17+
run: bash "${GITHUB_ACTION_PATH}/smoke-check.sh"
18+
env:
19+
WP_ADMIN_USER: ${{ inputs.admin-user }}
20+
WP_ADMIN_PASSWORD: ${{ inputs.admin-password }}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#!/bin/bash
2+
#
3+
# Smoke checks an installed WordPress single site over HTTP.
4+
#
5+
# Runs from the root of the installation, with WP-CLI available. Multisite is not supported because
6+
# a network's domain lives in wp-config.php and the database, not just an option.
7+
8+
set -euo pipefail
9+
10+
: "${RUNNER_TEMP:?}" "${WP_ADMIN_USER:?}" "${WP_ADMIN_PASSWORD:?}"
11+
12+
site_port=8889
13+
site_url="http://127.0.0.1:${site_port}"
14+
server_log="${RUNNER_TEMP}/server.log"
15+
jar="${RUNNER_TEMP}/cookies.txt"
16+
: > "${jar}"
17+
response="${RUNNER_TEMP}/response.txt"
18+
code="${RUNNER_TEMP}/http-code.txt"
19+
http_code=''
20+
21+
version="$(wp core version)"
22+
23+
# Nothing undoes these, so the site is only good for this check afterwards.
24+
wp option update home "${site_url}"
25+
wp option update siteurl "${site_url}"
26+
# A fresh install shows posts here already, but the front page check below needs it.
27+
wp option update show_on_front posts
28+
# Both make requests no check asked for, and the update checks call api.wordpress.org.
29+
wp config set DISABLE_WP_CRON true --raw
30+
wp config set WP_HTTP_BLOCK_EXTERNAL true --raw
31+
32+
# opcache counts php -S as a web SAPI, so the runner's JIT runs here and segfaults.
33+
php -d opcache.jit=disable -S "127.0.0.1:${site_port}" -t . > "${server_log}" 2>&1 &
34+
server_pid=$!
35+
36+
stop_server() {
37+
local status=$?
38+
kill "${server_pid}" 2> /dev/null || true
39+
wait "${server_pid}" 2> /dev/null || true
40+
[ "${status}" -eq 0 ] || cat "${server_log}" || true
41+
exit "${status}"
42+
}
43+
trap stop_server EXIT
44+
45+
# No connection prints 000 and exits 7, which set -e would take as fatal.
46+
deadline=$(( SECONDS + 30 ))
47+
while :; do
48+
ready_code="$(curl --silent --max-time 5 --output /dev/null --write-out '%{http_code}' "${site_url}/" || true)"
49+
[ "${ready_code}" = '000' ] || break
50+
[ "${SECONDS}" -lt "${deadline}" ] || { echo '::error::the server never answered'; exit 1; }
51+
sleep 1
52+
done
53+
54+
fail() {
55+
echo "::error::${1}"
56+
tail -n 20 "${response}"
57+
exit 1
58+
}
59+
60+
# An HTTP error returns to the caller. No reply at all is fatal.
61+
fetch() {
62+
local path="${1}" status=0
63+
shift
64+
: > "${response}"
65+
curl --silent --show-error --max-time 30 --output "${response}" \
66+
--write-out '%{http_code}' --cookie "${jar}" --cookie-jar "${jar}" \
67+
"$@" "${site_url}${path}" > "${code}" || status=$?
68+
http_code="$(cat "${code}")"
69+
[ "${status}" -eq 0 ] || [ "${status}" -eq 22 ] \
70+
|| fail "${path} got no reply and curl exited ${status}"
71+
return "${status}"
72+
}
73+
74+
check() {
75+
local path="${1}" marker status=0
76+
shift
77+
fetch "${path}" --fail-with-body || status=$?
78+
[ "${status}" -eq 0 ] || fail "${path} returned HTTP ${http_code}"
79+
for marker in "$@"; do
80+
grep -qF -e "${marker}" "${response}" || fail "${path} did not contain: ${marker}"
81+
done
82+
echo "ok ${path}"
83+
}
84+
85+
# A fatal mid-page still returns 200, so every check also asks for the closing tag.
86+
check '/' "content=\"WordPress ${version}\"" 'Hello world!' '</html>'
87+
88+
fetch '/?rest_route=/' --fail-with-body || fail "/?rest_route=/ returned HTTP ${http_code}"
89+
jq -e --arg url "${site_url}" '.url == $url and ( .namespaces | index( "wp/v2" ) )' "${response}" > /dev/null \
90+
|| fail 'the REST index was not the expected JSON'
91+
echo 'ok /?rest_route=/'
92+
93+
# It prints this for an empty database too, which the checks above rule out.
94+
check '/wp-admin/upgrade.php' 'No Update Required' '</html>'
95+
96+
fetch '/?p=99999999' || true
97+
[ "${http_code}" = '404' ] || fail "a missing post returned ${http_code}, expected 404"
98+
grep -qF '</html>' "${response}" || fail 'the 404 page was cut short'
99+
echo 'ok 404 handling'
100+
101+
login_status=0
102+
fetch '/wp-login.php' --fail-with-body \
103+
--data-urlencode "log=${WP_ADMIN_USER}" --data-urlencode "pwd=${WP_ADMIN_PASSWORD}" || login_status=$?
104+
[ "${login_status}" -eq 0 ] || fail "logging in returned HTTP ${http_code}"
105+
grep -qF 'wordpress_logged_in_' "${jar}" || fail 'logging in did not set an authentication cookie'
106+
echo 'ok login'
107+
108+
# The admin bar renders only for a logged-in user.
109+
check '/wp-admin/' 'id="wpadminbar"' '</html>'
110+
111+
# Catches a fatal during shutdown. An empty log would let the grep pass silently.
112+
[ -s "${server_log}" ] || { echo '::error::the server wrote no log'; exit 1; }
113+
if grep -qE 'Fatal error|Uncaught|Segmentation fault' "${server_log}"; then
114+
echo '::error::the server logged a fatal error'
115+
exit 1
116+
fi
117+
echo 'ok server log'

‎.github/dependabot.yml‎

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

0 commit comments

Comments
 (0)