+ } elseif (!in_array($json->repository->owner->name, $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);
+ }
+ }