private function uploadAssetForRelease($release, $repo) {
$this->setTokenForUser($repo->owner->login);
$asset = $this->createReleaseAsset($release, $repo);
- // FIXME: use uri_template extension
$name = sprintf("%s-%s.ext.phar", $repo->name, $release->tag_name);
- $url = str_replace("{?name}", "?name=$name", $release->upload_url);
+ $url = uri_template($release->upload_url, compact("name"));
$this->github->createReleaseAsset($url, $asset, "application/phar", function($json) {
$response = $this->app->getResponse();
$response->setResponseCode(201);
}
private function createReleaseAsset($release, $repo) {
- define("STDERR", fopen("/var/log/apache2/php_errors.log", "a"));
$source = (new Task\GitClone($repo->clone_url, $release->tag_name))->run();
$iterator = new Git($source);
$meta = [
settype($repo->tags, "object");
$this->github->listHooks($repo->full_name, function($hooks) use($repo) {
$repo->hooks = $hooks;
+ $this->app->getView()->addData(["hook" => $this->checkRepoHook($repo)]);
});
$this->github->listTags($repo->full_name, 1, $this->createTagsCallback($repo));
$this->github->listReleases($repo->full_name, 1, $this->createReleasesCallback($repo));
<p>Is the <code>pharext</code> hook enabled?</p>
</div>
<div class="col-md-4 text-center">
- <?php if ($this->check($repo)) : ?>
+ <?php if (!empty($hook)) : ?>
<span class="label label-info">YES</span>
<?php else : ?>
<span class="label label-warning">NO</span>
<div class="col-md-6">
<div class="row">
- <form method="post" action="<?= $baseUrl->mod("./github/repo/". $repo->full_name ."/hook/" . ($this->check($repo) ? "upd" : "add")) ?>">
- <div class="col-md-12">
+ <form method="post" action="<?= $baseUrl->mod("./github/repo/". $repo->full_name ."/hook/" . (!empty($hook) ? "upd" : "add")) ?>">
+ <div class="col-md-6">
+ <h4>PHARext Options:</h4>
+ <div class="checkbox">
+ <label for="hook-zend">
+ <input id="hook-zend" type="checkbox" name="zend" value="1" <?= (!empty($hook) && !empty($hook->config->zend)) ? "checked":""?>>
+ Mark as a ZendExtension.
+ </label>
+ </div>
+ <div class="checkbox <?= empty($repo->package_xml) ? "disabled text-muted":"" ?>">
+ <label for="hook-pecl">
+ <input id="hook-pecl" type="checkbox" name="pecl" value="1" <?= (!empty($hook) && !empty($hook->config->pecl)) ? "checked":""?> <?= empty($repo->package_xml) ? "disabled":"" ?>>
+ Use PECL package XML file.
+ </label>
+ </div>
+ </div>
+ <div class="col-md-6">
+ <h4>Hook Options:</h4>
<div class="checkbox">
<label for="hook-tag">
- <input id="hook-tag" type="checkbox" name="tag" value="1" <?= ($hook = $this->check($repo)) && in_array("create", $hook->events) ? "checked":"" ?>>
+ <input id="hook-tag" type="checkbox" name="tag" value="1" <?= (empty($hook) || in_array("create", $hook->events)) ? "checked":"" ?>>
Automatically create a release when I push a tag.
</label>
</div>
<div class="checkbox">
<label for="hook-release">
- <input id="hook-release" type="checkbox" name="release" value="1" <?= ($hook = $this->check($repo)) && in_array("release", $hook->events) ? "checked":"" ?>>
+ <input id="hook-release" type="checkbox" name="release" value="1" <?= (empty($hook) || in_array("release", $hook->events)) ? "checked":"" ?>>
Automatically upload a PHARext package as an asset to a release.
</label>
</div>
</button>
</div>
<?php else : ?>
- <div class="col-md-12">
+ <div class="col-md-6 col-md-offset-6">
<button type="submit" class="btn btn-lg btn-block btn-success">
<span class="octicon octicon-plug"></span>
Enable Hook