Uh oh!
There was an error while loading. Please reload this page.
[Blueprints v2] Blueprint validation - #144
Conversation
33fd536 to
4134899Compare4134899 to
a7ba5a8CompareJanJakes
commented
Aug 13, 2025
Here's a bit of a demo of what this WIP does now: $ blueprint.php info blueprint.json
ERRORS FOUND:
themes:
Invalid path "wp-content/invalid/test.php". Expected to match "wp-content/themes/*".
plugins:
Invalid path "wp-content/invalid/test.php". Expected to match "wp-content/plugins/*".
media:
Invalid path "wp-content/invalid/image.jpg". Expected to match "wp-content/uploads/*".
content:
Invalid path "wp-content/content/invalid/test.xml". Expected to match "wp-content/content/posts/*".
Invalid path "wp-content/content/invalid/test.xml". Expected to match "wp-content/content/posts/*".
BLUEPRINT:
version: 2
siteLanguage: "en_US"
wordpressVersion: "6.7"
constants: {"TEST_CONSTANT":"plugins"}
siteOptions: {"blogname":"Full Featured Test Site"}
plugins: ["./wp-content/plugins/test.php","./wp-content/invalid/test.php"]
themes: ["./wp-content/themes/test.php","./wp-content/invalid/test.php"]
media: ["./wp-content/uploads/image.jpg","./wp-content/invalid/image.jpg"]
content: [{"type":"posts","source":"./wp-content/content/posts/test.xml"},{"type":"posts","source":"./wp-content/content/invalid/test.xml"},{"type":"posts","source":["./wp-content/content/posts/test.xml","./wp-content/content/invalid/test.xml"]}]
additionalStepsAfterExecution: []
EXECUTION PLAN:
[1] defineConstants
constants: {"TEST_CONSTANT":"plugins"}
[2] setSiteOptions
options: {"blogname":"Full Featured Test Site"}
[3] installTheme
source: "./wp-content/themes/test.php"
active: false
importStarterContent: false
[4] installTheme
source: "./wp-content/invalid/test.php"
active: false
importStarterContent: false
[5] installPlugin
source: "./wp-content/plugins/test.php"
[6] installPlugin
source: "./wp-content/invalid/test.php"
[7] importMedia
media: ["./wp-content/uploads/image.jpg","./wp-content/invalid/image.jpg"]
[8] setSiteLanguage
language: "en_US"
[9] importContent
content: [{"type":"posts","source":"./wp-content/content/posts/test.xml"},{"type":"posts","source":"./wp-content/content/invalid/test.xml"},{"type":"posts","source":["./wp-content/content/posts/test.xml","./wp-content/content/invalid/test.xml"]}] |
JanJakes
commented
Aug 13, 2025
@adamziel The validation is not complete yet — some steps have more complex requirements — but I think this architecture could work. At the moment, the I think I could take this further and make the parser (maybe renaming it to |
a7ba5a8 to
0a823e0Compare45ea455 to
8114999Compare48839cd to
a9e0e95Comparea9e0e95 to
eb04387Compareadamziel
commented
Aug 25, 2025
This could be potentially useful in the future but it wouldn't make that much of a difference now. Let's keep this in mind and revisit it when a good use-case comes up. |
| } | ||
| private function is_bundle_source( string $source ): bool { | ||
| return ! str_contains( $source, '://' ) && str_contains( $source, '/' ); |
There was a problem hiding this comment.
We'd need to run this against a list of data references and confirm that URLReference, GitPath etc. fail to resolve while the AbsoluteLocalPath resolves successfully, similarly to what DataReference::create() does. We have a bunch of data reference syntaxes with possibly more to come, and not even all of them are strings.
| $this->assertSame( [ | ||
| [ | ||
| 'line' => 5, | ||
| 'message' => 'Invalid plugin path. The path must start with "wp-content/plugins/": ./wp-content/invalid/invalid-plugin-file.php' |
There was a problem hiding this comment.
The message slightly confused me at first, as in I went "oh, it's about the ./ prefix. No, wait, it's about the /plugins/ part". I wonder if we could rephrase it somehow to make it clear it's about the parent path, not syntax micronuances.
adamziel
commented
Aug 25, 2025
This looks good @JanJakes! I've left a few notes and there's a few failing tests. We're pretty close to merging |
WIP alternative exploration to #142.
Closes#132.