mirror of
https://github.com/essentials/Essentials.git
synced 2025-01-16 21:08:29 +01:00
Made a silly little upload script, for uploading things to dev bukkit.
This commit is contained in:
parent
7034524790
commit
0e14518c15
52
WebPush/index.php
Normal file
52
WebPush/index.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
//We want to be able to continue if the client aborts.
|
||||
ignore_user_abort();
|
||||
set_time_limit(0);
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 'Off');
|
||||
ini_set('error_log', 'errors.log');
|
||||
|
||||
//Abort the browser so it doesn't hang while we do the uploading.
|
||||
ob_end_clean();
|
||||
header("Connection: close");
|
||||
ob_start();
|
||||
header("Content-Length: 0");
|
||||
ob_end_flush();
|
||||
flush();
|
||||
|
||||
//Lets get to work!
|
||||
include('upload.php');
|
||||
|
||||
$build = $_GET['buildid'];
|
||||
$branch = $_GET['branch'];
|
||||
$version = $_GET['version'];
|
||||
|
||||
if ($build == "" || $branch == "" || $version == "")
|
||||
{
|
||||
die();
|
||||
}
|
||||
|
||||
//Don't upload dev builds atm.
|
||||
if ($branch == "bt2")
|
||||
{
|
||||
die();
|
||||
}
|
||||
|
||||
sleep(60);
|
||||
|
||||
$changes = getChanges($build, $branch);
|
||||
|
||||
uploadit($build, $branch, 'Essentials.jar', $version, $changes);
|
||||
sleep(1);
|
||||
uploadit($build, $branch, 'EssentialsChat.jar', $version, $changes);
|
||||
sleep(1);
|
||||
uploadit($build, $branch, 'EssentialsSpawn.jar', $version, $changes);
|
||||
sleep(1);
|
||||
uploadit($build, $branch, 'EssentialsProtect.jar', $version, $changes);
|
||||
sleep(1);
|
||||
uploadit($build, $branch, 'EssentialsXMPP.jar', $version, $changes);
|
||||
sleep(1);
|
||||
uploadit($build, $branch, 'EssentialsGeoIP.jar', $version, $changes);
|
||||
?>
|
||||
|
8
WebPush/nbproject/private/private.properties
Normal file
8
WebPush/nbproject/private/private.properties
Normal file
@ -0,0 +1,8 @@
|
||||
copy.src.files=false
|
||||
copy.src.target=
|
||||
index.file=index.php
|
||||
remote.connection=localhost-d13e79
|
||||
remote.directory=/upload
|
||||
remote.upload=ON_SAVE
|
||||
run.as=REMOTE
|
||||
url=http://ess.khhq.net/upload/
|
7
WebPush/nbproject/project.properties
Normal file
7
WebPush/nbproject/project.properties
Normal file
@ -0,0 +1,7 @@
|
||||
include.path=${php.global.include.path}
|
||||
php.version=PHP_5
|
||||
source.encoding=UTF-8
|
||||
src.dir=.
|
||||
tags.asp=false
|
||||
tags.short=true
|
||||
web.root=.
|
9
WebPush/nbproject/project.xml
Normal file
9
WebPush/nbproject/project.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.php.project</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/php-project/1">
|
||||
<name>Push</name>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
1727
WebPush/simple_html_dom.php
Normal file
1727
WebPush/simple_html_dom.php
Normal file
File diff suppressed because it is too large
Load Diff
98
WebPush/upload.php
Normal file
98
WebPush/upload.php
Normal file
@ -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;
|
||||
}
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user