summaryrefslogtreecommitdiffstats
path: root/WebPush/upload.php
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2011-10-13 17:19:25 +0100
committerKHobbits <rob@khobbits.co.uk>2011-10-13 17:19:25 +0100
commit0e14518c15c74025d7f0886298a1b61dedd1a7e7 (patch)
tree3b9f0993bd96defb7885022ed1e49c4d77e05aca /WebPush/upload.php
parent7034524790a2940b5b136db5e354cc9120d49aa2 (diff)
downloadEssentials-0e14518c15c74025d7f0886298a1b61dedd1a7e7.tar
Essentials-0e14518c15c74025d7f0886298a1b61dedd1a7e7.tar.gz
Essentials-0e14518c15c74025d7f0886298a1b61dedd1a7e7.tar.lz
Essentials-0e14518c15c74025d7f0886298a1b61dedd1a7e7.tar.xz
Essentials-0e14518c15c74025d7f0886298a1b61dedd1a7e7.zip
Made a silly little upload script, for uploading things to dev bukkit.
Diffstat (limited to 'WebPush/upload.php')
-rw-r--r--WebPush/upload.php98
1 files changed, 98 insertions, 0 deletions
diff --git a/WebPush/upload.php b/WebPush/upload.php
new file mode 100644
index 000000000..e4f645d61
--- /dev/null
+++ b/WebPush/upload.php
@@ -0,0 +1,98 @@
+<?php
+include_once('simple_html_dom.php');
+
+function uploadit($build, $branch, $file, $version, $changes)
+{
+ 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";
+ $params['api-key'] = "c73c331c7e44c156c852f7d08de3f22bb7a6e948";
+ $params['name'] = $filename[0] . '-' . $version;
+ $params['game_versions'] = 176;
+ $params['change_log'] = $changes;
+ $params['change_markup_type'] = "html";
+ $params['fileurl'] = $url;
+
+ if (stripos($version, 'Dev') !== false)
+ {
+ $params['file_type'] = "a";
+ }
+ elseif (stripos($version, 'Pre') !== false)
+ {
+ $params['file_type'] = "b";
+ }
+ else
+ {
+ $params['file_type'] = "r";
+ }
+
+ $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);
+
+ if ($result === false)
+ {
+ $result = curl_error($ch);
+ }
+ elseif ($result == "")
+ {
+ $result = "Success uploading $file - $version";
+ }
+ curl_close($ch);
+
+ file_put_contents('status.log', $result, FILE_APPEND);
+ return true;
+}
+
+function getChanges($job, $project)
+{
+ $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>";
+ foreach ($html->find('.changelist') as $list)
+ {
+ foreach ($list->find('.comment') as $comment)
+ {
+ $text = $comment->innertext;
+ foreach ($commitblacklist as $matchtext)
+ {
+ if (stripos($text, $matchtext) !== FALSE)
+ {
+ $text = "";
+ }
+ }
+ if ($text != "")
+ {
+ $output .= "<li>$text</li>";
+ }
+ }
+ }
+ $output .= "</ul>";
+
+ file_put_contents('status.log', "Collected changes! ", FILE_APPEND);
+
+ return $output;
+}
+?>
+