WordPress / WordPress/php-toolkit
Make Blueprint steps documentRoot agnostic
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 61
- Forks
- 21
- Avg merge
- 19h 34m
- Merged PRs (30d)
- 7
Description
Description
I've found some users setSiteOptions blueprint step on wp-now get some errors due the documentRoot being hardcoded instead of reading the value from
Can we make the
Steps to reproduce
- Create a file called
blueprint.jsonwith this content
{
"landingPage": "/friends/",
"steps": [
{
"step": "setSiteOptions",
"options": {
"permalink_structure": "/%year%/%monthnum%/%day%/%postname%/"
}
}
]
}
- Run
npx @wp-now/wp-now start --blueprint=blueprint.json - See the error:
npx @wp-now/wp-now start --blueprint=blueprint.json х INT 16m 25s Node 20.8.1 11:18:08
Starting the server......
directory: /Users/macbookpro/Downloads/downloads/friends
mode: plugin
php: 8.0
wp: latest
WordPress latest folder already exists. Skipping download.
SQLite folder already exists. Skipping download.
blueprint steps: 1
PHPResponse {
headers: {
'x-powered-by': [ 'PHP/8.0.10-dev' ],
'content-type': [ 'text/html; charset=UTF-8' ]
},
bytes: Uint8Array(516) [
60, 98, 114, 32, 47, 62, 10, 60, 98, 62, 87, 97,
114, 110, 105, 110, 103, 60, 47, 98, 62, 58, 32, 32,
105, 110, 99, 108, 117, 100, 101, 40, 119, 111, 114, 100,
112, 114, 101, 115, 115, 47, 119, 112, 45, 108, 111, 97,
100, 46, 112, 104, 112, 41, 58, 32, 70, 97, 105, 108,
101, 100, 32, 116, 111, 32, 111, 112, 101, 110, 32, 115,
116, 114, 101, 97, 109, 58, 32, 78, 111, 32, 115, 117,
99, 104, 32, 102, 105, 108, 101, 32, 111, 114, 32, 100,
105, 114, 101, 99,
... 416 more items
],
errors: 'PHP Warning: include(wordpress/wp-load.php): Failed to open stream: No such file or directory in php-wasm run script on line 2\n' +
"PHP Warning: include(): Failed opening 'wordpress/wp-load.php' for inclusion (include_path='.:') in php-wasm run script on line 2\n" +
'PHP Fatal error: Uncaught Error: Call to undefined function update_option() in php-wasm run script:5\n' +
'Stack trace:\n' +
'#0 {main}\n' +
' thrown in php-wasm run script on line 5\n',
exitCode: 2,
httpStatusCode: 200
}
Blueprint step completed: setSiteOptions
/Users/macbookpro/.npm/_npx/7c65af5c66ec2a7e/node_modules/@php-wasm/node/index.cjs:17841
throw reason;
^
Error: Failed to run code: <br />
<b>Warning</b>: include(wordpress/wp-load.php): Failed to open stream: No such file or directory in <b>php-wasm run script</b> on line <b>2</b><br />
<br />
<b>Warning</b>: include(): Failed opening 'wordpress/wp-load.php' for inclusion (include_path='.:') in <b>php-wasm run script</b> on line <b>2</b><br />
<br />
<b>Fatal error</b>: Uncaught Error: Call to undefined function update_option() in php-wasm run script:5
Stack trace:
#0 {main}
thrown in <b>php-wasm run script</b> on line <b>5</b><br />
PHP Warning: include(wordpress/wp-load.php): Failed to open stream: No such file or directory in php-wasm run script on line 2
PHP Warning: include(): Failed opening 'wordpress/wp-load.php' for inclusion (include_path='.:') in php-wasm run script on line 2
PHP Fatal error: Uncaught Error: Call to undefined function update_option() in php-wasm run script:5
Stack trace:
#0 {main}
thrown in php-wasm run script on line 5
at Q (file:///Users/macbookpro/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-playground/blueprints/index.js:502:27)
at Module.Ce [as setSiteOptions] (file:///Users/macbookpro/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-playground/blueprints/index.js:486:10)
at async o (file:///Users/macbookpro/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-playground/blueprints/index.js:2044:30)
at async Object.run (file:///Users/macbookpro/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-playground/blueprints/index.js:2007:21)
at async yt (file:///Users/macbookpro/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-playground/blueprints/index.js:2079:3)
at async startWPNow (file:///Users/macbookpro/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-now/wp-now/main.js:596:5)
at async startServer (file:///Users/macbookpro/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-now/wp-now/main.js:865:42)
at async Object.handler (file:///Users/macbookpro/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-now/wp-now/main.js:1037:25)
Node.js v20.8.1
Expected:
3. Observe the WordPress site opening correctly and non errors appear in the console.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/playground/blueprints/src/lib/steps/site-data.ts around line 37 and reproduce the issue with the provided blueprint.json and wp-now command. Trace how setSiteOptions determines the WordPress path, then verify that the same blueprint works with a non-default documentRoot and no console errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, php, typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100