use separate skip dir
authorMichael Wallner <mike@php.net>
Fri, 1 Apr 2016 14:12:40 +0000 (16:12 +0200)
committerMichael Wallner <mike@php.net>
Fri, 1 Apr 2016 14:27:17 +0000 (16:27 +0200)
.gitignore
bin/pecl
public/mirror.php [deleted file]
skip/.gitkeep [new file with mode: 0644]

index 9c3ad39b3f63326feb978ce98a5db4cfc55ec5f1..27c837942f9cab92190d4c0c70a516d5aead52f4 100644 (file)
@@ -7,4 +7,6 @@ public/phars/*
 !public/phars/.gitkeep
 build/*
 !build/.gitkeep
+skip/*
+!skip/.gitkeep
 vendor
index 296c8036c5f1753c070ea98c16b64adf355132b0..a696acb7c7620156e4485ccdf40d72d226209e7f 100755 (executable)
--- a/bin/pecl
+++ b/bin/pecl
@@ -59,7 +59,7 @@ if (($sxe = simplexml_load_file("http://pecl.php.net/feeds/$what.rss"))) {
                $url = (string) $item->link;
                $pkg = basename(dirname($url));
                $ver = basename($url);
-               $skp = sprintf("%s/../build/%s-%s.skip", __DIR__, $pkg, $ver);
+               $skp = sprintf("%s/../skip/%s/%s", __DIR__, $pkg, $ver);
                $ext = sprintf("%s/../public/phars/%s/%s-%s.ext.phar", __DIR__, $pkg, $pkg, $ver);
                $dir = dirname($ext);
 
diff --git a/public/mirror.php b/public/mirror.php
deleted file mode 100644 (file)
index 27f3c61..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-use http\Env\Request;
-use http\Env\Response;
-use http\Params;
-
-$request = new Request;
-$response = new Response;
-$response->setResponseCode(500);
-ob_start($response);
-
-$owners = explode(",", getenv("owners") ?: "m6w6");
-$mirror = getenv("mirror") ?: "/var/github";
-$secret = getenv("secret") ?: trim(file_get_contents("$mirror/.secret"));
-
-$sig = $request->getHeader("X-Hub-Signature");
-$evt = $request->getHeader("X-Github-Event");
-
-if (!$sig || !$evt) {
-       $response->setResponseCode(400);
-       $response->setContentType("message/http");
-       $response->getBody()->append($request);
-       return $response->send();
-}
-
-foreach ((new Params($sig))->params as $algo => $mac) {
-       if ($mac["value"] !== hash_hmac($algo, $request->getBody(), $secret)) {
-               $response->setResponseCode(403);
-               $response->getBody()->append("Invalid signature");
-               return $response->send();
-       }
-}
-
-switch ($evt) {
-       default:
-               $response->setResponseCode(202);
-               $response->getBody()->append("Not a configured event");
-               break;
-       case "ping";
-       case "push":
-               if (!($json = json_decode($request->getBody()))) {
-                       $response->setResponseCode(415);
-                       $response->setContentType($request->getHeader("Content-Type"));
-                       $response->getBody()->append($request->getBody());
-               } elseif (!in_array(isset($json->repository->owner->name)?$json->repository->owner->name:$json->repository->owner->login, $owners, true)) {
-                       $response->setResponseCode(403);
-                       $response->getBody()->append("Invalid owner");
-               } else {
-                       $repo = $json->repository->full_name;
-                       $path = $mirror . "/" . $repo;
-                       if (is_dir($path) && chdir($path)) {
-                               passthru("git fetch -vp 2>&1", $rv);
-                               if ($rv == 0) {
-                                       $response->setResponseCode(200);
-                               }
-                       } elseif (mkdir($path, 0755, true) && chdir($path)) {
-                               $source = escapeshellarg($json->repository->clone_url);
-                               $description = escapeshellarg($json->repository->description);
-                               passthru("git clone --mirror $source . 2>&1", $rv);
-                               passthru("git config gitweb.description $description 2>&1");
-                               unlink("description");
-                               if ($rv == 0) {
-                                       $response->setResponseCode(200);
-                               }
-                       }
-               }
-               break;
-}
-
-$response->send();
diff --git a/skip/.gitkeep b/skip/.gitkeep
new file mode 100644 (file)
index 0000000..e69de29