コード例 #1
0
ファイル: cache_git.php プロジェクト: browserplus/borg
<?php

include "../../php/site.php";
include "../../php/db.php";
include "../../php/git.php";
$g = new GIT();
// to make sure we're the ones calling
if (isset($_GET["s"]) && $_GET["s"] == $g->get_cache_secret()) {
    echo ($g->fetch_platform_issues() ? "cached" : "error caching") . " forums\n";
}
コード例 #2
0
ファイル: fetch_git.php プロジェクト: browserplus/borg
#!/usr/bin/php
<?php 
include "/home/websites/browserplus/php/site.php";
include "/home/websites/browserplus/php/db.php";
include "/home/websites/browserplus/php/git.php";
// DOK_BASE - normally set in apache, but not available to scripts
putenv("DOK_BASE=/home/websites/browserplus/data");
$gitbase = "http://github.com/";
$db = new DB("git");
$git = new GIT();
// Fetch issues
$secret = $git->get_cache_secret();
$host = get_cfg_var('bp_env') == "local" ? "borg" : "browserplus.org";
fetch("http://{$host}/site/cache_git.php?s={$secret}");
// Fetch commits
// projects stored in data/projects/projects.json file
$all_projects = get_projects();
foreach ($all_projects as $label => $projects) {
    foreach ($projects as $purl) {
        // only process urls hosted on github (see gitbase above)
        if (substr($purl, 0, strlen($gitbase)) == $gitbase) {
            // project is "lloyd/bp-imagealter"
            $np = explode("/", substr($purl, strlen($gitbase)));
            $user = $np[0];
            $repository = $np[1];
            // fetch commit data
            $commit_url = "http://github.com/api/v1/json/{$user}/{$repository}/commit/master";
            $json = fetch($commit_url);
            if ($json) {
                // commit data is a json struct
                $data = json_decode($json, 1);