X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FGithub%2FAPI.php;h=8e51489872e106c0ce83e6eb290bcca82a93c72f;hb=c05a8f703d5a097355b5813154c264c87e3f71fe;hp=bd28f3ababa56d1bb711a4c32d18e8c69791cc35;hpb=063205ca833946e20a1c2235418c045895153c5c;p=pharext%2Fpharext.org diff --git a/app/Github/API.php b/app/Github/API.php index bd28f3a..8e51489 100644 --- a/app/Github/API.php +++ b/app/Github/API.php @@ -134,7 +134,7 @@ class API ], 0); } - function fetchToken($code, $state, callable $callback) { + function fetchToken($code, $state) { if (!$this->tokens->get("state", $orig_state, true)) { if (isset($orig_state)) { $this->logger->notice("State expired", $orig_state); @@ -152,12 +152,12 @@ class API "client_id" => $this->config->client->id, "client_secret" => $this->config->client->secret, ]); - return $call($callback); + return $call(); } - function readAuthUser(callable $callback) { + function readAuthUser() { $call = new API\Users\ReadAuthUser($this); - return $call($callback); + return $call(); } function listRepos($page, callable $callback) { @@ -241,11 +241,11 @@ class API return $call($callback); } - function uploadAssetForRelease($repo, $release, callable $callback) { - return $this->listHooks($repo->full_name, function($hooks) use($release, $repo, $callback) { + function uploadAssetForRelease($repo, $release, $config, callable $callback) { + return $this->listHooks($repo->full_name, function($hooks) use($release, $repo, $config, $callback) { $repo->hooks = $hooks; $hook = $this->checkRepoHook($repo); - $phar = new Pharext\Package($repo->clone_url, $release->tag_name, $repo->name, $hook ? $hook->config : null); + $phar = new Pharext\Package($repo->clone_url, $release->tag_name, $repo->name, $config ?: $hook->config); $name = sprintf("%s-%s.ext.phar", $repo->name, $release->tag_name); $url = uri_template($release->upload_url, compact("name")); $this->createReleaseAsset($url, $phar, "application/phar", function($json) use($release, $repo, $callback) { @@ -260,9 +260,9 @@ class API }); } - function createReleaseFromTag($repo, $tag_name, callable $callback) { + function createReleaseFromTag($repo, $tag_name, $config, callable $callback) { return $this->createRelease($repo->full_name, $tag_name, function($json) use($repo, $callback) { - $this->uploadAssetForRelease($repo, $json, $callback); + $this->uploadAssetForRelease($repo, $json, $config, $callback); }); }