Permalink
Browse files

Add $verbose flag for more detailed output

  • Loading branch information...
1 parent 5e6894f commit 0f9c8d66ce66e265f11160ee0640dacc8368c655 @lukaseder lukaseder committed Jul 13, 2012
Showing with 11 additions and 4 deletions.
  1. +11 −4 trac2github.php
View
@@ -44,6 +44,9 @@
$save_milestones = '/tmp/trac_milestones.list';
$save_tickets = '/tmp/trac_tickets.list';
+// Set this to true if you want to see the JSON output sent to GitHub
+$verbose = false;
+
// Uncomment to refresh cache
// @unlink($save_milestones);
// @unlink($save_tickets);
@@ -184,22 +187,26 @@ function github_post($url, $json, $patch = false) {
}
function github_add_milestone($data) {
- global $project, $repo;
+ global $project, $repo, $verbose;
+ if ($verbose) print_r($data);
return json_decode(github_post("/repos/$project/$repo/milestones", json_encode($data)), true);
}
function github_add_issue($data) {
- global $project, $repo;
+ global $project, $repo, $verbose;
+ if ($verbose) print_r($data);
return json_decode(github_post("/repos/$project/$repo/issues", json_encode($data)), true);
}
function github_add_comment($issue, $body) {
- global $project, $repo;
+ global $project, $repo, $verbose;
+ if ($verbose) print_r($body);
return json_decode(github_post("/repos/$project/$repo/issues/$issue/comments", json_encode(array('body' => $body))), true);
}
function github_update_issue($issue, $data) {
- global $project, $repo;
+ global $project, $repo, $verbose;
+ if ($verbose) print_r($body);
return json_decode(github_post("/repos/$project/$repo/issues/$issue", json_encode($data), true), true);
}

0 comments on commit 0f9c8d6

Please sign in to comment.