aspirepress / AspireUpdate

A plugin that allows for rewriting the URLs used to fetch updates from WordPress.org to some other endpoint
15 stars 4 forks source link

AspirePress Updater Plugin

This plugin allows a WordPress user to automatically rewrite certain URLs and URL paths to a new URL. This is helpful because it allows for the rewriting of api.wordpress.org to some other repository that contains the plugins the user wants.

The plugin supports multiple rewrites, and also supports rewriting the URL paths of the requests on a per-host basis. This improves the capacity of the plugin to adequately support newer or different repositories.

Requirements

This plugin requires:

Installation

To install this plugin, follow these steps:

  1. Download a copy of this plugin as a ZIP file.
  2. Go to your wp-admin section and log in.
  3. Go to the plugins section and click on "Add New Plugin".
  4. Select "Upload Plugin" and upload the plugin's ZIP file.
  5. Activate the plugin.
  6. Configure the plugin by updating your wp-config.php file with the configuration options in the next section.
  7. Test.

Configuration

The plugin settings screen shows the core plugin settings. To enable an advanced mode for the plugin settings, add "&advanced=true" query parameter to the plugin settings page URL.

The plugin uses the following configuration options. If these are set in the plugin settings UI they override settings configured with code.

<?php

define('AP_UPDATER_HOST_REWRITES', [
    'api.wordpress.org' => 'your-repo.com',
]);

There are other options for defining the plugin's functionality, as well. They are:

Authentication

Authentication is provided by way of a randomly generated token combined with the WP_SITEURL constant. This token is then Base64-encoded with the separate parts of the credentials separated by a colon. It's added to the Authorization header.

If no API key is supplied, the API key is omitted.

Debugging

The plugin supports debugging. To enable debugging, define the AP_UPDATER_DEBUG constant in your wp-config.php file.

There are three output options, all enabled by default:

These are turned on by default but you can remove ones you don't need by defining them in the AP_UPDATER_DEBUG_TYPES_EXCLUDE constant.

License

This plugin is licensed under the GPLv2, as it is a WordPress plugin and that is the license required.

Contributing

Contributions are welcome. Here's a short to-do list:

Support

If you need help with this plugin, please file an issue explaining the following:

Issues that are not filed with this information will be closed. We will do our best to assist, but we cannot guarantee a response.