Update themeunittestdata.wordpress.xml with CORS-accessible images#89
Update themeunittestdata.wordpress.xml with CORS-accessible images#89
Conversation
|
Tested and received the following error, using Uncaught Error: Call to undefined function wp_generate_attachment_metadata()mode: playground
php: 8.0
wp: latest
WordPress latest folder already exists. Skipping download.
SQLite folder already exists. Skipping download.
blueprint steps: 2
Blueprint step completed: login
Blueprint step completed: installPlugin
PHP.run() output was: {
stdout: '<br />\n' +
'<b>Fatal error</b>: Uncaught Error: Call to undefined function wp_generate_attachment_metadata() in /var/www/html/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php:1067\n' +
'Stack trace:\n' +
"#0 /var/www/html/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php(861): **WXR_Importer->process_attachment**(Array, Array, 'https://i0.wp.c...')\n" +
'#1 /var/www/html/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php(383): **WXR_Importer->process_post**(Array, Array, Array, Array)\n' +
"#2 php-wasm run script(17): WXR_Importer->import('/tmp/import.wxr')\n" +
'#3 {main}\n' +
' thrown in <b>/var/www/html/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php</b> on line <b>1067</b><br />\n',
stderr: 'PHP Fatal error: Uncaught Error: Call to undefined function wp_generate_attachment_metadata() in /var/www/html/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php:1067\n' +
'Stack trace:\n' +
"#0 /var/www/html/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php(861): WXR_Importer->process_attachment(Array, Array, 'https://i0.wp.c...')\n" +
'#1 /var/www/html/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php(383): WXR_Importer->process_post(Array, Array, Array, Array)\n' +
"#2 php-wasm run script(17): WXR_Importer->import('/tmp/import.wxr')\n" +
'#3 {main}\n' +
' thrown in /var/www/html/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php on line 1067\n'
}possible culprits Error: PHP.run() failed with exit code 255 and the following output: PHP Fatal error: Uncaught Error: Call to undefined function wp_generate_attachment_metadata() in /var/www/html/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php:1067
Stack trace:
#0 /var/www/html/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php(861): WXR_Importer->process_attachment(Array, Array, 'https://i0.wp.c...')
#1 /var/www/html/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php(383): WXR_Importer->process_post(Array, Array, Array, Array)
#2 php-wasm run script(17): WXR_Importer->import('/tmp/import.wxr')
#3 {main}
thrown in /var/www/html/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php on line 1067
at _NodePHP.run (/Users/seth/.npm/_npx/7c65af5c66ec2a7e/node_modules/@php-wasm/node/index.cjs:72937:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.importWxr (file:///Users/seth/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-playground/blueprints/index.js:912:3)
at async o (file:///Users/seth/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-playground/blueprints/index.js:9413:30)
at async Object.run (file:///Users/seth/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-playground/blueprints/index.js:9340:23)
at async runBlueprintSteps (file:///Users/seth/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-playground/blueprints/index.js:9448:3)
at async startWPNow (file:///Users/seth/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-now/wp-now/main.js:663:5)
at async startServer (file:///Users/seth/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-now/wp-now/main.js:981:42)
at async Object.handler (file:///Users/seth/.npm/_npx/7c65af5c66ec2a7e/node_modules/@wp-now/wp-now/main.js:1167:25) {blueprint {
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"preferredVersions": {
"php": "8.2",
"wp": "6.5"
},
"phpExtensionBundles": [
"kitchen-sink"
],
"features": {
"networking": true
},
"steps": [
{
"step": "login",
"username": "admin",
"password": "password"
},
{
"step": "importWxr",
"file": {
"resource": "url",
"url": "https://raw.githubusercontent.com/WordPress/theme-test-data/try/cors-accessible-images/themeunittestdata.wordpress.xml"
}
}
]
} |
That's unrelated to this PR, that's either an Importer or Playground issue. I suspect the Importer isn't including the wp-admin related files, as it expects to be run within wp-admin only, and partly the fault of playground for not running the import in the context of wp-admin. The fact you got to that point of the process suggets the image fetch worked though, so the PR is probably good, the above error not withstanding. |
|
Ok, I tested it in another local dev environment. For some reason it wasn't able to import the following posts, errors below
otherwise the import seems to work as expected across domains |
flexseth
left a comment
There was a problem hiding this comment.
other than two posts not importing, this appears to solve the cross-origin domain issue
- Note: There are errors when attempting to import to Playground, but these appear to be related to the way the WordPress importer is loading in Playground
|
This PR isn't going to be viable. While it's a quick fix for images, it doesn't work for the dozen I feel the correct option is to include the files in the repo instead. |
8a3d77b to
883e56b
Compare
|
I've converted this to pull from github instead, which works 100%. The problem now is that Playground times out during import of attachments, as it times out waiting on PHP. Similar to what happens to most end-users during a WXR Import :) Before merging this would need |
This PR attempts to replace the image URLs in the WXR with a variant that will be importable into Playground.
This has been untested as-is. This is provided such that others can give it a try. The WXR url to be used would be this:
See #82 (comment) for the idea behind this.
See #82