Skip to content

Instantly share code, notes, and snippets.

@PeterBooker
Last active January 16, 2018 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PeterBooker/cfd3709447ac590b34672ced422f9934 to your computer and use it in GitHub Desktop.
Save PeterBooker/cfd3709447ac590b34672ced422f9934 to your computer and use it in GitHub Desktop.
WordPress.Org Repository Research

WordPress Plugins Repository Research

This is an overview of my research into the WordPress Plugins Repository while looking at how external tools can work with it, primarily through SVN.

Some Data

Between 2017/01/14 and 2018/01/14 there were approximately 227,998 revisions (changes). Spread equally this results in:

  • 4,385 / week.
  • 626 / day.
  • 26 / hour.
  • 0.4 / minute.

As of 2018/01/14 there were 72,037 plugins listed in the repository. This includes 11,614 which are closed (.zip URLs return 404). Of those which can be downloaded they take up 30.5 GB of diskspace, across 440,922 folders and 2,152,884 files.

WordPressOrg Code

The WordPress Plugins Directory site has an internal plugin (2) which controls updating the .zip files for each version of a plugin. The keys parts which relate to plugin updates are:

  • /cli/class-svn-watcher.php (src) watches to changes in the latest revision number to detect changes and lists the plugins which were changed.
  • /cli/class-import.php (src) controls the processing of updated plugins.

The WordPress site is handling this task in a different way than Tide/WPdirectory currently need to, as it has to maintain up-to-date versions of every tag available.

Repository Update Behavior

From a few days watching live changes, most commonly people will commit the changes they have made to /trunk/, then copy /trunk/ to a new /tags/x.x.x/ folder, before updating the Stable Tag in /trunk/readme.txt (or in a different order).

This means that while watching for code updates we need to check not only if code has been updated but also that it is the currently used code. To establish which folder is currently being used as the latest version we need to parse the /trunk/readme(.txt/.md) (1) for the Stable tag: x.x.x. If no stable tag is set, or the set tag does not exist in the /tags/ folder, then the current version is the /trunk/ folder.

If we are only concerned about plugin file changes we can also choose to ignore certain updates, primarily any which only include changes to the /assets/ and /branches/ folders as these will never be included in plugin files.

Useful SVN CLI Commands

Get the latest Revision:

svn log https://plugins.svn.wordpress.org/ -r HEAD

Get the changes between the provided Revisions:

svn log https://plugins.svn.wordpress.org/ -r 1802805:1802806

Get the list of all current Plugins in the repo:

svn list https://plugins.svn.wordpress.org/ -r HEAD

Check if a particular file or folder exists in the repo at a given Revision:

svn list https://plugins.svn.wordpress.org/health-check/tags/0.8.0/ -r HEAD

Get the contents of a file in the repo at a given Revision:

svn cat https://plugins.svn.wordpress.org/health-check/tags/0.8.0/readme.txt -r HEAD

Sources

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