Airship\Engine\Continuum\AutoUpdater::updateCheck PHP Méthode

updateCheck() public méthode

Are any updates available?
public updateCheck ( string $supplier = '', string $packageName = '', string $minVersion = '', string $apiEndpoint = 'version' ) : array
$supplier string
$packageName string
$minVersion string
$apiEndpoint string
Résultat array
    public function updateCheck(string $supplier = '', string $packageName = '', string $minVersion = '', string $apiEndpoint = 'version') : array
    {
        if (empty($supplier)) {
            $supplier = $this->supplier->getName();
        }
        $channelsConfigured = $this->supplier->getChannels();
        if (empty($channelsConfigured)) {
            throw new NoAPIResponse(\trk('errors.hail.no_channel_configured'));
        }
        foreach ($channelsConfigured as $channelName) {
            $channel = $this->getChannel($channelName);
            $publicKey = $channel->getPublicKey();
            foreach ($channel->getAllURLs() as $ch) {
                try {
                    $response = $this->hail->postSignedJSON($ch . API::get($apiEndpoint), $publicKey, ['type' => $this->type, 'supplier' => $supplier, 'package' => $packageName, 'minimum' => $minVersion]);
                    if ($response['status'] === 'error') {
                        $this->log($response['error'], LogLevel::ERROR, ['response' => $response, 'channel' => $ch, 'supplier' => $supplier, 'type' => $this->type, 'package' => $packageName]);
                        continue;
                    }
                    $updates = [];
                    foreach ($response['versions'] as $update) {
                        $updates[] = new UpdateInfo($update, $ch, $publicKey, $supplier, $packageName);
                    }
                    if (empty($updates)) {
                        $this->log('No updates found.', LogLevel::DEBUG, ['type' => \get_class($this), 'supplier' => $supplier, 'package' => $packageName, 'channelName' => $channelName, 'channel' => $ch]);
                        return [];
                    }
                    return $this->sortUpdatesByVersion(...$updates);
                } catch (SignatureFailed $ex) {
                    // Log? Definitely suppress, however.
                    $this->log('Automatic update - signature failure. (' . \get_class($ex) . ')', LogLevel::ALERT, ['exception' => \Airship\throwableToArray($ex), 'channelName' => $channelName, 'channel' => $ch]);
                } catch (TransferException $ex) {
                    // Log? Definitely suppress, however.
                    $this->log('Automatic update failure. (' . \get_class($ex) . ')', LogLevel::WARNING, ['exception' => \Airship\throwableToArray($ex), 'channelName' => $channelName, 'channel' => $ch]);
                }
            }
        }
        throw new NoAPIResponse(\trk('errors.hail.no_channel_responded'));
    }