WordPress / WordPress/Learn

DX Enhancement: Improve the ImportTestContent script

Open
#1,864 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

[Component] Environment [Type] Enhancement Dev
Dominant language
PHP
Stars
333
Forks
127
Avg merge
1d 7h
Merged PRs (30d)
11

Description

Last July, @tellyworth merged the ImportTestContent script, as a way to get data from Learn WordPress into a local development environment, which was a great improvement over what was available at the time, which was sharing an XML file.

However, it would be ideal if that import script were improved upon, to help with the process of fixing bugs and testing PRs.

I'm opening this issue to discuss some ways to achieve this, and then once there is consensus I suggest we create separate issues for each improvement.

  1. Currently the importer script imports 50 pages, tutorials, and lesson plans. However, it does not check if the items being imported already exist in the local database. It would be great if it could either perform this check, to prevent duplicates, or simply wipe the current data and import the new data. The second option would probably be quicker, but it would wipe any data defined locally by the developer.
  2. The importer does not import any Topics, and one is required to create a topic and add Tutorials and Lesson plans to that topic manually. It would be ideal if a default topic was created, and all tutorials and lesson plans were assigned to it.
  3. The importer does not import any courses. This could be due to one of 2 reasons: a) the course content is not available via the REST API, or b) the course content is available via the REST API, but requires authentication. One possible way to solve this would be to ship a JSON file with one or two small demo courses as part of the codebase and import that.
  4. Depending on the network connection, the importer can time out, resulting in an incomplete import. Currently updating the timeout argument of the wp_remote_get function call to 30 seems to resolve this issue.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the ImportTestContent script and its wp_remote_get calls, then inspect how pages, tutorials, lesson plans, topics, and courses are currently retrieved and stored. Confirm which content is available through the REST API and whether the proposed import behaviors should be split into separate issues. Done means the scope is agreed and each improvement has a concrete implementation and verification plan.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.