Code tidy, trigger build id update.

This commit is contained in:
KHobbits 2011-11-01 16:54:36 +00:00
parent dd87dcdd3d
commit 375636cd36
2 changed files with 24 additions and 34 deletions

View file

@ -22,14 +22,15 @@ $build = $_GET['buildid'];
$branch = $_GET['branch']; $branch = $_GET['branch'];
$version = $_GET['version']; $version = $_GET['version'];
if ($build == "" || $branch == "" || $version == "") include('../build/function.php');
{ updateval($branch);
die();
if ($build == "" || $branch == "" || $version == "") {
die('Invalid');
} }
//Don't upload dev builds atm. //Don't upload dev builds atm.
if ($branch == "bt2") if ($branch == "bt2") {
{
die(); die();
} }

View file

@ -1,8 +1,8 @@
<?php <?php
include_once('simple_html_dom.php'); include_once('simple_html_dom.php');
function uploadit($build, $branch, $file, $version, $changes) function uploadit($build, $branch, $file, $version, $changes) {
{
file_put_contents('status.log', "\nUploading file $file to devbukkit! ", FILE_APPEND); file_put_contents('status.log', "\nUploading file $file to devbukkit! ", FILE_APPEND);
$slug = "essentials"; $slug = "essentials";
$plugin = "Essentials"; $plugin = "Essentials";
@ -18,16 +18,13 @@ function uploadit($build, $branch, $file, $version, $changes)
$params['change_markup_type'] = "html"; $params['change_markup_type'] = "html";
$params['fileurl'] = $url; $params['fileurl'] = $url;
if (stripos($version, 'Dev') !== false) if (stripos($version, 'Dev') !== false) {
{
$params['file_type'] = "a"; $params['file_type'] = "a";
} }
elseif (stripos($version, 'Pre') !== false) elseif (stripos($version, 'Pre') !== false) {
{
$params['file_type'] = "b"; $params['file_type'] = "b";
} }
else else {
{
$params['file_type'] = "r"; $params['file_type'] = "r";
} }
@ -43,12 +40,10 @@ function uploadit($build, $branch, $file, $version, $changes)
curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$result = curl_exec($ch); $result = curl_exec($ch);
if ($result === false) if ($result === false) {
{
$result = curl_error($ch); $result = curl_error($ch);
} }
elseif ($result == "") elseif ($result == "") {
{
$result = "Success uploading $file - $version"; $result = "Success uploading $file - $version";
} }
curl_close($ch); curl_close($ch);
@ -57,8 +52,7 @@ function uploadit($build, $branch, $file, $version, $changes)
return true; return true;
} }
function getChanges($job, $project) function getChanges($job, $project) {
{
$commitblacklist = array( $commitblacklist = array(
'Merge branch', 'Merge branch',
'Merge pull', 'Merge pull',
@ -72,20 +66,15 @@ function getChanges($job, $project)
$html->load_file($url); $html->load_file($url);
$output = "Change Log:<ul>"; $output = "Change Log:<ul>";
foreach ($html->find('.changelist') as $list) foreach ($html->find('.changelist') as $list) {
{ foreach ($list->find('.comment') as $comment) {
foreach ($list->find('.comment') as $comment)
{
$text = $comment->innertext; $text = $comment->innertext;
foreach ($commitblacklist as $matchtext) foreach ($commitblacklist as $matchtext) {
{ if (stripos($text, $matchtext) !== FALSE) {
if (stripos($text, $matchtext) !== FALSE)
{
$text = ""; $text = "";
} }
} }
if ($text != "") if ($text != "") {
{
$output .= "<li>$text</li>\n"; $output .= "<li>$text</li>\n";
} }
} }