Releases final class
Minn\Ops\Releases · public/minn/src/Minn/Ops/Releases.php · 87 lines
Whether a newer Minn is out, asked of the Minn update service at most once a day: its latest installable release (published on GitHub, read by the service), kept in the minn_release option (JSON) with the time it was asked. A check the service does not answer (offline, GitHub rate limiting it) keeps the last answer and waits a day like any other; no installable release (a 404) offers nothing. This is Minn asking Minn, never wordpress.org, and never GitHub directly.
Constants and properties
| const | OPTION = 'minn_release' | |
| const | TTL = 86400 | |
| const | SOURCE = 'https://updates.minn.run/v1/minn/releases/latest' | |
| private | readonly Closure $load | Promoted from the constructor. |
| private | readonly Closure $save | Promoted from the constructor. |
| private | readonly string $installed | Promoted from the constructor. |
| private | readonly string $source | Promoted from the constructor. |
| private | readonly Minn\Http $http | Promoted from the constructor. |
Public
| new | __construct(Closure $load, Closure $save, string $installed, string $source = self::SOURCE, Minn\Http $http = \Minn\Http::__set_state(array( 'within' => array ( ), 'fake' => NULL, 'refusal' => NULL, )))# |
| ||||||
| static | forSite(Minn\Content\Site $site, string $installed): self# | The check for a site, its answer kept in the site's minn_release option. | ||||||
| method | stored(): array# | The stored answer: when GitHub was last asked and the latest release then. @return array{checked: int, latest: ?array<string, string>} | ||||||
| method | due(): bool# | Whether the stored answer is a day old, or there is none. | ||||||
| method | refresh(): array# | Asks the service now and keeps the answer; `answered` says whether it did (when it did not, `latest` is the last answer kept). @return array{checked: int, latest: ?array<string, string>, answered: bool} | ||||||
| method | offer(): ?Minn\Ops\Release# | The release on offer: the latest one, when it is newer than the running engine. |
Internals 1
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | origin(string $url): string# |
Nothing matches.