-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.load.php
More file actions
26 lines (20 loc) · 942 Bytes
/
function.load.php
File metadata and controls
26 lines (20 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
$trancateQuery = "TRUNCATE TABLE statistic";
mysql_query($trancateQuery);
$owner = preg_replace('/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})?\/([\/\w \.-]*)?\/([A-Za-z0-9.-]+)\/?([a-z\.]{2,6})*\/?$/', '$4', $_POST['repository']);
$repo = preg_replace('/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})?\/([\/\w \.-]*)?\/([A-Za-z0-9.-]+)\/?([a-z\.]{2,6})*\/?$/', '$5', $_POST['repository']);
$dateStart = $_POST['date_start'];
$dateEnd = $_POST['date_end'];
$client = new GitHubClient();
$client->setPage();
$commits = $client->repos->commits->listCommitsOnRepository($owner, $repo, null, null, null, $dateStart, $dateEnd);
foreach($commits as $commit)
{
$author = $commit->getAuthor()->getLogin();
$fullCommit = $client->repos->commits->getSingleCommit($owner, $repo, $commit->getSha());
foreach($fullCommit->getFiles() as $file)
{
statistic_insert($file->getFilename(),$author);
}
}
header('Location: /');