Skip to content

Commit

Permalink
new updater: linux ok
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsito committed Oct 14, 2015
1 parent 95cb1b4 commit 1b23228
Showing 3 changed files with 44 additions and 15 deletions.
2 changes: 1 addition & 1 deletion agility/console/frm_myAdmin.php
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
$config =Config::getInstance();
?>

<img class="mainpage" src="/agility/server/getRandomImage.php" alt="wallpaper" width="640" height="480" align="middle" />
<img class="mainpage" src="/agility/server/getRandomImage.php" alt="wallpaper" width="700" height="480" align="middle" />

<!-- FORMULARIO DE introduccion de usuario y contrasenya -->
<div id="myAdmin-window" style="position:relative;width:640px;height:375px;padding:20px 20px">
2 changes: 1 addition & 1 deletion agility/server/auth/system.ini
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ author = "Juan Antonio Martinez"
email = "[email protected]"
license = "GPL"
version_name = "2.1.1"
version_date = "20151011_2009"
version_date = "20151014_1336"
database_name = "agility"
database_host = "localhost"
database_user = "agility_operator"
55 changes: 42 additions & 13 deletions agility/upgrade.php
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ function logProgress($str) {
fwrite($fp,$str."\n");
fflush($fp); // volcar la salida antes de liberar el bloqueo
flock($fp, LOCK_UN); // libera el bloqueo
$this->logProgress($str);
logTrace($str);
} else {
$res=false;
logTrace('ERROR: logProgress(): flock() failed');
@@ -293,18 +293,45 @@ public function doUpgrade() {
textarea {
-moz-box-sizing:border-box;
box-sizing:border-box;
width:276px;
height:172px;
width:800px;
height:300px;
padding:20px;
overflow:auto;
border:none;
background:#ccc url(/agility/images/AgilityContest.png) no-repeat center scroll;
background-size:100% 100%;
background:#eee url(/agility/images/AgilityContest.png) no-repeat right scroll;
background-size:50% 100%;
}
</style>
<script src="/agility/lib/jquery-1.11.3.min.js" type="text/javascript" charset="utf-8" > </script>
<script type="text/javascript" charset="utf-8">
jQuery.fn.putCursorAtEnd = function() {
return this.each(function() {
$(this).focus()
// If this function exists...
if (this.setSelectionRange) {
// ... then use it (Doesnt work in IE)
// Double the length because Opera is inconsistent about whether a carriage return is one character or two. Sigh.
var len = $(this).val().length * 2;
this.setSelectionRange(len, len);
} else {
// ... otherwise replace the contents with itself
// (Doesnt work in Google Chrome)
$(this).val($(this).val());
}
// Scroll to the bottom, in case we are in a text area
// (Necessary for Firefox and Google Chrome)
this.scrollTop = 99999;
});
};
function restart() {
window.location="https://localhost/agility/console";
}
function fireUpdater() {
var txarea=$("#progress");
txarea.blur();
$.ajax({
type:"GET",
url:"/agility/upgrade.php",
@@ -313,18 +340,16 @@ function fireUpdater() {
Operation: "progress"
},
success: function(data) {
var txarea=$("#progress");
var done=false;
var str=txarea.val();
for(var n=0 ; n<data.length; n++) {
var a=data[n];
str=str+"\n"+a;
txarea.val(txarea.val()+"\\n"+a);
if (a.indexOf("DONE")==0) done=true;
if (a.indexOf("FATAL")==0) done=true;
}
txarea.val(str);
if (!done) setTimeout(fireUpdater,5000); // call myself in 2.5 seconds
if (!done) setTimeout(fireUpdater,500); // call myself in 0.5 second
else $("#doneBtn").css("display","inline");
txarea.putCursorAtEnd();
},
error: function(XMLHttpRequest,textStatus,errorThrown) {
alert("Error: "+textStatus + " "+ errorThrown );
@@ -335,11 +360,15 @@ function fireUpdater() {
</head>
<body onload="fireUpdater();">
<h2>Updating AgilityContest...</h2>
<h3>New version: {$up->getVersionName()} - {$up->getVersionDate()} </h3>
<form id="updater" name="updater">
<h3>New version: '.$up->getVersionName().' - '.$up->getVersionDate().' </h3>
<form id="updater" name="updater" action="/agility/console">
<label for="progress">Progress status:</label><br/>
<textarea id="progress" form="updater" name="progress" cols="80" rows="40" readonly="readonly"></textarea><br/>
<input id="doneBtn" type="button" name="Done" value="Done" style="display:none;">
<span id="doneBtn" style="display:none;">
Update completed. Press restart to reload AgilityContest
<input type="button" name="Restart" value="Restart" onclick="restart();">
</span>
</form>
</body>
</html>

0 comments on commit 1b23228

Please sign in to comment.