Skip to content

Skip predefined meta keys in WXR import#281

Open
fredrikekelund wants to merge 2 commits into
WordPress:trunkfrom
fredrikekelund:f26d/import-skip-predefined-meta-keys
Open

Skip predefined meta keys in WXR import#281
fredrikekelund wants to merge 2 commits into
WordPress:trunkfrom
fredrikekelund:f26d/import-skip-predefined-meta-keys

Conversation

@fredrikekelund
Copy link
Copy Markdown
Contributor

The canonical WordPress Importer skips a few predefined post meta keys (_wp_attached_file, _wp_attachment_metadata, and _edit_lock). The php-toolkit implementation doesn't, which breaks attachment URLs during WXR imports.

This PR changes that. It applies the equivalent logic to the canonical WordPress Importer to skip over those predefined meta keys.

Testing instructions

  1. Have Studio installed
  2. Create a new site in Studio
  3. Quit Studio
  4. Run ln -s SITEDIR/wp-content/mu-plugins/sqlite-database-integration/ SITEDIR/wp-content/plugins/sqlite-database-integration
  5. Download this blueprint bundle: http://blueprintlibrary.wordpress.com/?blueprint=829
  6. Extract it
  7. Run composer build-blueprints-phar
  8. Run php dist/blueprints.phar exec PATH_TO_BLUEPRINT_JSON --mode=apply-to-existing-site --site-path=PATH_TO_SITE --site-url=http://localhost:PORT --db-engine=sqlite (where PATH_TO_BLUEPRINT_JSON is the path to the blueprint.json file in the blueprint bundle you extracted before, PATH_TO_SITE is the path to the site you created in Studio, and PORT is the port of the site)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file are not part of the core purpose of this PR. However, blueprints.phar failed when the PHP opening and closing tags were present, which seems to make sense, as this content is concatenated with components/Blueprints/Steps/scripts/import-content.php (which doesn't have a closing PHP tag)

@fredrikekelund
Copy link
Copy Markdown
Contributor Author

@adamziel @ashfame I'd appreciate a review here when you get a chance 🙏

The failing CI run seems like a fluke. Should hopefully pass if you retrigger it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant