API / Minn\Ops / Directory

Directory final class

Minn\Ops\Directory · public/minn/src/Minn/Ops/Directory.php · 76 lines

The Minn update service, https://updates.minn.run: the one place the engine asks about anything it does not have yet, so a site running Minn talks to Minn and never to wordpress.org. The service speaks wordpress.org's own endpoints under /v1/ (plugin and theme update checks, directory search and information, translations) with every address a site would fetch pointed back at itself: packages under /v1/download/, icons, screenshots and emoji under /v1/assets/. It also serves Minn's own releases and changelogs. Every request names the engine and the WordPress version it is compatible with (which judges a plugin's "Requires at least"), never the site's address. A development install says "(lab)" after the version, so the service counts it apart from real sites.

Constants and properties

constORIGIN = 'https://updates.minn.run/'
constBASE = 'https://updates.minn.run/v1/'
privateLAB_HOST = '/(^localhost$|\\.(localhost|test|local|example|invalid|internal|lan|home\\.arpa)$)/'

Host names only a development install answers to.

constPACKAGES = 'https://updates.minn.run/v1/download/'

Where plugin, theme and translation packages download from.

privatestatic ?bool $lab

Public

staticurl(string $path): string#

An address on the service: a path under /v1/, such as "plugins/info/1.2/".

staticuserAgent(): string#

How the engine introduces itself: its version, "(lab)" from a development install, and nothing about the site.

staticlab(string $home, string $environment = ''): bool#

Whether a site is a development install: its environment type is local or development, or its address names a development host (localhost, a .localhost, .test, .local, .example, .invalid or .internal name, a private or loopback address). Staging counts as a real site.

staticpost(Minn\Http $http, string $path, array $form, Minn\Ops\Asking $asking = Minn\Ops\Asking::Now): array#

A form POST to the service (the update checks) over the caller's client, its answer decoded. The daily pass's checks are marked (Asking::Daily): the service counts those, one a site, as the sites running Minn that day, and keeps nothing else about it.

$formarray<string, string>
@return array<string, mixed>

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatehome(): string#

The site's address (wp-config's WP_HOME, else the home option), through the options store; '' when it cannot be read.