Skip to content

Commit 7ef392a

Browse files
committed
Document more TODOs
1 parent 3d46fd1 commit 7ef392a

File tree

4 files changed

+64
-6
lines changed

4 files changed

+64
-6
lines changed

components/Blueprints/Runner.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ private function validateBlueprint(): void {
213213
$v = new Validator();
214214
$is_valid = $v->validate( $this->blueprintArray );
215215
if ( ! $is_valid ) {
216+
print_r( $v->get_errors() );
216217
throw new \Exception( 'Blueprint is invalid' );
217218
}
218219

components/Blueprints/SiteResolver/NewSiteResolver.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ static private function resolveWordPressZipUrl( Client $client, ?VersionConstrai
184184
return 'https://wordpress.org/nightly-builds/wordpress-latest.zip';
185185
}
186186

187+
// @TODO Support version numbers like 6.5.1 that don't show up in the default API response.
188+
// Use query params for filtering somehow?
187189
$latestVersions = $client->fetch( 'https://api.wordpress.org/core/version-check/1.7/?channel=beta' )->json();
188190
$latestVersions = array_filter( $latestVersions['offers'], function ( $v ) {
189191
return $v['response'] === 'autoupdate';

components/Blueprints/VersionConstraint.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,17 @@ public function satisfiedBy( string $version ): bool {
3939
}
4040
}
4141
if ( $this->max !== null ) {
42-
if ( version_compare( $version, $this->max, '>' ) ) {
42+
// If max is set to 6.4 and the actual version is 6.4.1, we should still return true.
43+
// To limit the minor version number, the user must specify it explicitly.
44+
// @TODO: Don't append .999999. That's a hack. Consider all possible
45+
// WordPress and PHP version number strings and find a way of
46+
// meaningfully comparing them (or throw a warning if no meaningful
47+
// comparison can be made).
48+
$max = $this->max;
49+
if ( preg_match( '/^[0-9]+\.[0-9]+$/', $max ) ) {
50+
$max = $max . '.999999';
51+
}
52+
if ( version_compare( $version, $max, '>' ) ) {
4353
return false;
4454
}
4555
}

try-blueprints.php

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
<?php
22

33
/**
4-
* @TODO: Fast unzipping of remote Zip Files by iterating over the entries
5-
* instead of skipping over to the end central directory index entry.
6-
* @TODO: Processing Zip Files without the Content-Length header.
7-
* @TODO: HTTP Cache support for remote files.
8-
* @TODO: Restrictions on supported step types, media files types, SQL queries types, etc.
4+
* @TODO: A large test suite.
5+
* @TODO: Client HTTP queue deadlock when we enqueued a lot of requests and need to fetch a small
6+
* ad-hoc resource such as a JSON list of translations.
7+
* @TODO: Exception structure?
8+
* @TODO: Blueprint JSON validation.
9+
* @TODO: Support Zip Files without the Content-Length header.
910
* @TODO: Add importMedia step to the specification.
1011
* @TODO: How to handle the default WordPress theme? Should it be preserved for new sites?
1112
* What if we want to remove it? And what should be the semantics for existing sites?
13+
* @TODO: Production-grade HTTP Cache support for remote files. Not the stopgap we have now.
14+
* @TODO (low priority): Restrictions on supported step types, media files types, SQL queries types, etc.
15+
* @TODO (low priority): Fast unzipping of remote Zip Files by iterating over the entries
16+
* instead of skipping over to the end central directory index entry.
1217
*/
1318

1419
namespace WordPress\Blueprints\Steps;
@@ -33,6 +38,13 @@
3338
"themes" => [
3439
"adventurer"
3540
],
41+
"wordpressVersion" => "6.5",
42+
"phpVersion" => [
43+
"min" => "8.0",
44+
"max" => "8.4",
45+
"recommended" => "8.2"
46+
],
47+
"activeTheme" => "twentytwentyfour",
3648
"blueprintMeta" => [
3749
"name" => "Full Featured Blueprint",
3850
"description" => "A blueprint demonstrating most of the available features",
@@ -53,6 +65,39 @@
5365
"supports" => ["title", "editor", "author", "thumbnail", "excerpt", "comments"]
5466
]
5567
],
68+
// "muPlugins" => [
69+
// "0-test" => [
70+
// "filename" => "0-test.php",
71+
// "content" => "<?php
72+
// echo 'test';
73+
// ? >"
74+
// ]
75+
// ],
76+
"users" => [
77+
[
78+
"username" => "admin",
79+
"password" => "password",
80+
"email" => "adam@example.com",
81+
"role" => "adamadamin"
82+
]
83+
],
84+
"roles" => [
85+
[
86+
"name" => "adamadamin",
87+
// @TODO: What's the correct way to set capabilities?
88+
"capabilities" => ["manage_options"=>"manage_options"]
89+
]
90+
],
91+
"siteOptions" => [
92+
"blogname" => "Blueprint Demo Site",
93+
"timezone_string" => "America/New_York",
94+
"permalink_structure" => "/%year%/%monthnum%/%postname%/"
95+
],
96+
"siteLanguage" => "en_US",
97+
"constants" => [
98+
"WP_DEBUG" => true,
99+
"SCRIPT_DEBUG" => true
100+
],
56101
"media" => [
57102
"https://wordpress.org/files/2024/10/design-visual-6-7.png",
58103
[

0 commit comments

Comments
 (0)