2011-10-13 18:19:25 +02:00
|
|
|
<?php
|
2011-11-01 17:54:36 +01:00
|
|
|
|
2011-10-13 18:19:25 +02:00
|
|
|
include_once('simple_html_dom.php');
|
|
|
|
|
2011-11-01 17:54:36 +01:00
|
|
|
function uploadit($build, $branch, $file, $version, $changes) {
|
2011-10-13 18:19:25 +02:00
|
|
|
file_put_contents('status.log', "\nUploading file $file to devbukkit! ", FILE_APPEND);
|
|
|
|
$slug = "essentials";
|
|
|
|
$plugin = "Essentials";
|
|
|
|
$url = "http://ci.earth2me.net/guestAuth/repository/download/$branch/$build:id/$file";
|
|
|
|
$filename = explode('.', $file);
|
|
|
|
$request_url = "http://dev.bukkit.org/server-mods/$slug/upload-file.json";
|
2011-11-01 17:54:36 +01:00
|
|
|
|
2011-10-13 21:45:57 +02:00
|
|
|
include ('apikey.php');
|
2011-11-01 17:54:36 +01:00
|
|
|
|
2011-10-13 18:19:25 +02:00
|
|
|
$params['name'] = $filename[0] . '-' . $version;
|
|
|
|
$params['game_versions'] = 176;
|
|
|
|
$params['change_log'] = $changes;
|
|
|
|
$params['change_markup_type'] = "html";
|
|
|
|
$params['fileurl'] = $url;
|
2011-11-01 17:54:36 +01:00
|
|
|
|
|
|
|
if (stripos($version, 'Dev') !== false) {
|
2011-10-13 18:19:25 +02:00
|
|
|
$params['file_type'] = "a";
|
|
|
|
}
|
2011-11-01 17:54:36 +01:00
|
|
|
elseif (stripos($version, 'Pre') !== false) {
|
2011-10-13 18:19:25 +02:00
|
|
|
$params['file_type'] = "b";
|
|
|
|
}
|
2011-11-01 17:54:36 +01:00
|
|
|
else {
|
2011-10-13 18:19:25 +02:00
|
|
|
$params['file_type'] = "r";
|
2011-11-01 17:54:36 +01:00
|
|
|
}
|
2011-10-13 18:19:25 +02:00
|
|
|
|
|
|
|
$content = file_get_contents($url);
|
|
|
|
file_put_contents($file, $content);
|
|
|
|
|
|
|
|
$params['file'] = '@' . $file;
|
|
|
|
|
|
|
|
$ch = curl_init();
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $request_url);
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
|
|
|
$result = curl_exec($ch);
|
2011-11-01 17:54:36 +01:00
|
|
|
|
|
|
|
if ($result === false) {
|
2011-10-13 18:19:25 +02:00
|
|
|
$result = curl_error($ch);
|
|
|
|
}
|
2011-11-01 17:54:36 +01:00
|
|
|
elseif ($result == "") {
|
2011-10-13 18:19:25 +02:00
|
|
|
$result = "Success uploading $file - $version";
|
|
|
|
}
|
|
|
|
curl_close($ch);
|
|
|
|
|
|
|
|
file_put_contents('status.log', $result, FILE_APPEND);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-11-01 17:54:36 +01:00
|
|
|
function getChanges($job, $project) {
|
2011-10-13 18:19:25 +02:00
|
|
|
$commitblacklist = array(
|
|
|
|
'Merge branch',
|
|
|
|
'Merge pull',
|
|
|
|
'Revert',
|
|
|
|
'Cleanup',
|
|
|
|
);
|
|
|
|
|
|
|
|
$url = "http://ci.earth2me.net/viewLog.html?buildId=$job&tab=buildChangesDiv&buildTypeId=$project&guest=1";
|
|
|
|
|
|
|
|
$html = new simple_html_dom();
|
|
|
|
$html->load_file($url);
|
|
|
|
|
|
|
|
$output = "Change Log:<ul>";
|
2011-11-01 17:54:36 +01:00
|
|
|
foreach ($html->find('.changelist') as $list) {
|
|
|
|
foreach ($list->find('.comment') as $comment) {
|
2011-10-13 18:19:25 +02:00
|
|
|
$text = $comment->innertext;
|
2011-11-01 17:54:36 +01:00
|
|
|
foreach ($commitblacklist as $matchtext) {
|
|
|
|
if (stripos($text, $matchtext) !== FALSE) {
|
2011-10-13 18:19:25 +02:00
|
|
|
$text = "";
|
|
|
|
}
|
|
|
|
}
|
2011-11-01 17:54:36 +01:00
|
|
|
if ($text != "") {
|
2011-10-13 21:45:57 +02:00
|
|
|
$output .= "<li>$text</li>\n";
|
2011-10-13 18:19:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$output .= "</ul>";
|
|
|
|
|
|
|
|
file_put_contents('status.log', "Collected changes! ", FILE_APPEND);
|
|
|
|
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|