Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WordPress: preserve PHP attributes and wp-config.php whitespace #964

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions packages/playground/wordpress/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ RUN cd wordpress && \
# Remove any empty directories
find . -type d -empty -delete

FROM php:7.4-cli AS php
FROM php:8.0-cli AS php
WORKDIR /root/
COPY --from=emscripten /root/wordpress ./wordpress
RUN apt update && apt install unzip
Expand Down Expand Up @@ -144,11 +144,17 @@ RUN cd wordpress && \
cp /root/export-wxz.php wp-content/mu-plugins/export-wxz.php

# Strip whitespaces from PHP files.
# PHP 7.4 is a safe choice here: `php -w` ran on 7.4
# produces code compatible with PHP 8+, but the reverse
# isn't true.
# PHP >= 8.0 is needed to preserve PHP 8.0 attributes,
# like #[Attribute] and #[Pure]. In PHP 7.4, they are
# treated as comments and removed by the whitespace stripping.
RUN cd wordpress && \
for phpfile in $(find ./ -type f -name '*.php' -not -path '*wordpress-importer*' -not -path '*wp-content*' ); do \
for phpfile in $(\
find ./ -type f -name '*.php' \
-not -path '*wordpress-importer*' \
-not -path '*wp-content*' \
# wp-cli expects an unminified wp-config.php
-not -path '*wp-config.php' \
); do \
# Remove whitespace from PHP files
php -w $phpfile > $phpfile.small && \
# remove set_time_limit function calls as they invoke the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"squizlabs/php_codesniffer": "^3.7",
"wp-coding-standards/wpcs": "^3.0",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"squizlabs/php_codesniffer": "3.7.0",
"wp-coding-standards/wpcs": "~2.3.0",
"phpcompatibility/phpcompatibility-wp": "~2.1.3",
"yoast/phpunit-polyfills": "^1.0.1"
},
"config": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

<rule ref="WordPress-Core"/>
<rule ref="WordPress-Docs"/>
<rule ref="WordPress.CodeAnalysis.EmptyStatement"/>

<!-- Directories and third party library exclusions. -->
<exclude-pattern>/vendor/*</exclude-pattern>
<exclude-pattern>/tests/*</exclude-pattern>

<!-- Allow the WP DB Class and related tests for usage of direct database access functions. -->
<rule ref="WordPress.DB.RestrictedClasses.mysql__PDO">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Contributors: wordpressdotorg, aristath
Requires at least: 6.0
Tested up to: 6.4
Requires PHP: 5.6
Stable tag: 2.1.6
Stable tag: 2.1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: performance, database

SQLite integration plugin by the WordPress Team.
SQLite-integration plugin from the WordPress Performance Team.

== Description ==

Expand Down
393 changes: 244 additions & 149 deletions packages/playground/wordpress/src/wordpress/wp-6.1.data

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/playground/wordpress/src/wordpress/wp-6.1.js

Large diffs are not rendered by default.

399 changes: 247 additions & 152 deletions packages/playground/wordpress/src/wordpress/wp-6.2.data

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/playground/wordpress/src/wordpress/wp-6.2.js

Large diffs are not rendered by default.

401 changes: 248 additions & 153 deletions packages/playground/wordpress/src/wordpress/wp-6.3.data

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/playground/wordpress/src/wordpress/wp-6.3.js

Large diffs are not rendered by default.

706 changes: 364 additions & 342 deletions packages/playground/wordpress/src/wordpress/wp-6.4.data

Large diffs are not rendered by default.

Loading
Loading