1 function updateSelf() {
3 var query = "backend.php?op=pluginhandler&plugin=updater&method=updateSelf";
5 if (dijit.byId("updateSelfDlg"))
6 dijit.byId("updateSelfDlg").destroyRecursive();
8 var dialog = new dijit.Dialog({
10 title: __("Update Tiny Tiny RSS"),
11 style: "width: 600px",
13 performUpdate: function(step) {
14 dijit.byId("self_update_start_btn").attr("disabled", true);
15 dijit.byId("self_update_stop_btn").attr("disabled", true);
17 notify_progress("Loading, please wait...", true);
18 new Ajax.Request("backend.php", {
19 parameters: "op=pluginhandler&plugin=updater&method=performUpdate&step=" + step +
20 "¶ms=" + param_escape(JSON.stringify(dialog.attr("update-params"))),
21 onComplete: function(transport) {
23 rv = JSON.parse(transport.responseText);
27 rv['log'].each(function(line) {
28 $("self_update_log").innerHTML += "<li>" + line + "</li>";
31 dialog.attr("update-params", rv['params']);
34 window.setTimeout("dijit.byId('updateSelfDlg').performUpdate("+(step+1)+")", 500);
36 dijit.byId("self_update_stop_btn").attr("disabled", false);
40 console.log(transport.responseText);
41 notify_error("Received invalid data from server.");
44 dialog.attr("updated", true);
46 exception_error("updateSelf/inner", e);
51 if (dialog.attr("updated")) {
52 window.location.reload();
58 if (prompt(__("Backup your tt-rss directory before continuing. Please type 'yes' to continue.")) == 'yes') {
59 dialog.performUpdate(0);
66 exception_error("batchSubscribe", e);