Skip to content
Snippets Groups Projects
Commit b7781ead authored by Peter Rotich's avatar Peter Rotich
Browse files

Change HTTP header code from 304 to 201, Add random query string on reload

parent c9f08ef5
No related branches found
No related tags found
No related merge requests found
......@@ -34,10 +34,15 @@ class UpgraderAjaxAPI extends AjaxController {
exit;
}
if($upgrader->isAborted()) {
Http::response(416, "We have a problem ... wait a sec.");
exit;
}
if($upgrader->getNumPendingTasks()) {
if($upgrader->doTasks() && !$upgrader->getNumPendingTasks() && $ost->isUpgradePending()) {
//Just reporting done...with tasks - break in between patches!
header("HTTP/1.1 304 Not Modified");
//Just reporting done...with tasks - break in between patches with scripted tasks!
Http::response(201, "TASKS DONE!");
exit;
}
} elseif($ost->isUpgradePending() && $upgrader->isUpgradable()) {
......@@ -50,7 +55,7 @@ class UpgraderAjaxAPI extends AjaxController {
} elseif(!$ost->isUpgradePending()) {
$upgrader->setState('done');
session_write_close();
header("HTTP/1.1 304 Not Modified");
Http::response(201, "DONE!");
exit;
}
......
......@@ -42,14 +42,14 @@ jQuery(function($) {
setTimeout(function() { _lp(count+1); }, 2);
},
304: function() {
201: function() {
$('#loading #msg').html("We're done... cleaning up!");
setTimeout(function() { location.href =url;}, 3000);
setTimeout(function() { location.href =url+'?c='+count+'&r='+Math.floor((Math.random()*100)+1); }, 3000);
}
},
error: function() {
$('#loading #msg').html("Something went wrong");
setTimeout(function() { location.href =url;}, 1000);
setTimeout(function() { location.href =url+'?c='+count+'&r='+Math.floor((Math.random()*100)+1); }, 1000);
}
});
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment