Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import WXR step: Fails when importing audio metadata #1444

Closed
justintadlock opened this issue May 21, 2024 · 3 comments · Fixed by #1475
Closed

Import WXR step: Fails when importing audio metadata #1444

justintadlock opened this issue May 21, 2024 · 3 comments · Fixed by #1475
Labels
[Feature] Import Export [Priority] High [Type] Bug An existing feature does not function as intended
Milestone

Comments

@justintadlock
Copy link
Collaborator

When importing audio into Playground, the importer isn't loading the wp_read_audio_metadata() function. I'm also wondering if we might hit a similar issue with video metadata.

playground-import-audio

@bgrgicak
Copy link
Collaborator

We had to add this script for images to work. I'm wondering if there is another import that we are missing.

@bgrgicak bgrgicak added this to the Zero Crashes milestone May 22, 2024
@bgrgicak bgrgicak added [Type] Bug An existing feature does not function as intended [Priority] High [Feature] Import Export labels May 22, 2024
@bgrgicak
Copy link
Collaborator

@justintadlock do you maybe have a blueprint we could use for testing?

I'm assuming this include is missing wp-admin/includes/media.php.

@dd32
Copy link
Member

dd32 commented May 31, 2024

See #1475 which is me independently running into this. Includes a blueprint to test with.

bgrgicak pushed a commit that referenced this issue Jun 2, 2024
## What is this PR doing?

Similar to #1357, but taking a deeper cut at it, as import expects to be
run within an admin interface.

## What problem is it solving?

The following fatal will be triggered:
```
PHP Fatal error:  Uncaught Error: Call to undefined function wp_read_audio_metadata() in /wordpress/wp-admin/includes/image.php:2
Stack trace:
#0 /wordpress/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php(1067): wp_generate_attachment_metadata(821, '/wordpress/wp-c...')
#1 /wordpress/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php(861): WXR_Importer->process_attachment(Array, Array, 'https://raw.git...')
#2 /wordpress/wp-content/plugins/WordPress-Importer-master/class-wxr-importer.php(383): WXR_Importer->process_post(Array, Array, Array, Array)
#3 /internal/eval.php(20): WXR_Importer->import('/tmp/import.wxr')
#4 {main}
  thrown in /wordpress/wp-admin/includes/image.php on line 2
```

Fixes #1444 (Since found this issue)

## How is the problem addressed?

Including includes/admin.php which pulls in all admin-related
functionality, rather than just the cropping functionality.

Alternatively, this could've been done by selectively importing
`includes/media.php` as well as `includes/image.php`, but I anticipate
that core is likely to include other related admin functions.

## Testing Instructions

Note: This is an untested change.

Try running
https://playground.wordpress.net/builder/builder.html#{%22preferredVersions%22:{%22php%22:%228.0%22,%22wp%22:%22latest%22},%22phpExtensionBundles%22:[%22kitchen-sink%22],%22features%22:{%22networking%22:true},%22steps%22:[{%22step%22:%22login%22,%22username%22:%22admin%22,%22password%22:%22password%22},{%22step%22:%22importWxr%22,%22file%22:{%22resource%22:%22url%22,%22url%22:%22https://raw.githubusercontent.com/WordPress/theme-test-data/try/cors-accessible-images/themeunittestdata.wordpress.xml%22}}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Import Export [Priority] High [Type] Bug An existing feature does not function as intended
3 participants