Skip to content

Conversation

@adamziel
Copy link
Collaborator

Description

PR #343 added a "virtualize" option so Playground can define new PHP constants without changing the WordPress files in the filesystem.

This is incredibly useful. At the same time, mixing defineWpConfigConst calls with and without the "virtualize" option may lead to a situation where some constants are lost or when Playground tries to load a non-existing playground-consts.json file – see #735.

Since I can't think of a good rationale to keep the non-virtualized version around, let's reduce complexity and always virtualize the constants. The "virtualize" option will now be noop and is only kept to avoid breaking Blueprint schema validation for existing apps.

Testing instructions

  • Confirm unit tests pass
  • Confirm the WordPress PR previewer loads Pull Requests without triggering any warnings

Follow-up work

  • Adjust Blueprint schema validation to tolerate the virtualize option so we can remove it from the type
  • Call this step definePHPConsts as there is nothing specific to wp-config.php in it

Closes #735

…ineWpConfigConsts step

PR #343 added a "virtualize" option so Playground can define new PHP
constants without changing the WordPress files in the filesystem.

This is incredibly useful. At the same time, mixing defineWpConfigConst
calls with and without the "virtualize" option may lead to a situation
where some constants are lost or when Playground tries to load a non-existing
playground-consts.json file – see #735.

Since I can't think of a good rationale to keep the non-virtualized
version around, let's reduce complexity and always virtualize the constants.
The "virtualize" option will now be noop and is only kept to avoid
breaking Blueprint schema validation for existing apps.

Closes #735
@adamziel
Copy link
Collaborator Author

cc @sejas @danielbachhuber @wojtekn for visibility as this is relevant for wp-now. No changes required on your end.

@adamziel
Copy link
Collaborator Author

I'll go ahead and merge.

@adamziel adamziel merged commit 85a8ef5 into trunk Nov 13, 2023
@adamziel adamziel deleted the always-virtualize-wp-consts-file branch November 13, 2023 10:41
adamziel added a commit that referenced this pull request Nov 17, 2023
#738 introduced a
change that made all WordPress constants be defined by including a
"virtualized" wp-consts.php file. However, the required
`setPhpIniEntry()` call was sometimes happening after the initial
`php.run()` which made it noop. This broke the networking support merged
in #724.

This commit solves that by exposing a new `php.defineConstant()` API
that handles the file virtualization. I'm not super happy about
virtualizing files so let's revisit that in the future, see #750.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pull Request previewer not working with errors after loading

2 participants