Skip to content
Snippets Groups Projects
Commit a19acb21 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #35924 by Neil: improved the update system.

parent e31f7abd
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -656,6 +656,7 @@ CREATE TABLE system ( ...@@ -656,6 +656,7 @@ CREATE TABLE system (
status int(2) NOT NULL default '0', status int(2) NOT NULL default '0',
throttle tinyint(1) DEFAULT '0' NOT NULL, throttle tinyint(1) DEFAULT '0' NOT NULL,
bootstrap int(2) NOT NULL default '0', bootstrap int(2) NOT NULL default '0',
schema_version smallint(2) unsigned NOT NULL,
PRIMARY KEY (filename) PRIMARY KEY (filename)
) TYPE=MyISAM; ) TYPE=MyISAM;
......
...@@ -650,6 +650,7 @@ CREATE TABLE system ( ...@@ -650,6 +650,7 @@ CREATE TABLE system (
status integer NOT NULL default '0', status integer NOT NULL default '0',
throttle smallint NOT NULL default '0', throttle smallint NOT NULL default '0',
bootstrap integer NOT NULL default '0', bootstrap integer NOT NULL default '0',
schema_version int2 NOT NULL CHECK (schema_version > 0),
PRIMARY KEY (filename) PRIMARY KEY (filename)
); );
......
This diff is collapsed.
...@@ -105,7 +105,7 @@ function _db_query($query, $debug = 0) { ...@@ -105,7 +105,7 @@ function _db_query($query, $debug = 0) {
return $result; return $result;
} }
else { else {
trigger_error(check_plain(mysql_error() ."\nquery: ". $query), E_USER_ERROR); trigger_error(check_plain(mysql_error() ."\nquery: ". $query), E_USER_WARNING);
return FALSE; return FALSE;
} }
} }
......
...@@ -113,7 +113,7 @@ function _db_query($query, $debug = 0) { ...@@ -113,7 +113,7 @@ function _db_query($query, $debug = 0) {
return $result; return $result;
} }
else { else {
trigger_error(check_plain(mysqli_error($active_db) ."\nquery: ". $query), E_USER_ERROR); trigger_error(check_plain(mysqli_error($active_db) ."\nquery: ". $query), E_USER_WARNING);
return FALSE; return FALSE;
} }
} }
......
...@@ -92,7 +92,7 @@ function _db_query($query, $debug = 0) { ...@@ -92,7 +92,7 @@ function _db_query($query, $debug = 0) {
return $last_result; return $last_result;
} }
else { else {
trigger_error(check_plain(pg_last_error() ."\nquery: ". $query), E_USER_ERROR); trigger_error(check_plain(pg_last_error() ."\nquery: ". $query), E_USER_WARNING);
return FALSE; return FALSE;
} }
} }
......
...@@ -974,6 +974,16 @@ function theme_username($object) { ...@@ -974,6 +974,16 @@ function theme_username($object) {
return $output; return $output;
} }
function theme_progress_bar($percent, $message) {
$output = '<div id="progress" class="progress">';
$output .= '<div class="percentage">'. $percent .'%</div>';
$output .= '<div class="status">'. $message .'</div>';
$output .= '<div class="bar"><div class="filled" style="width: '. $percent .'%"></div></div>';
$output .= '</div>';
return $output;
}
/** /**
* @} End of "defgroup themeable". * @} End of "defgroup themeable".
*/ */
......
...@@ -67,7 +67,7 @@ function HTTPGet(uri, callbackFunction, callbackParameter) { ...@@ -67,7 +67,7 @@ function HTTPGet(uri, callbackFunction, callbackParameter) {
/** /**
* Creates an HTTP POST request and sends the response to the callback function * Creates an HTTP POST request and sends the response to the callback function
*/ */
function HTTPPost(uri, object, callbackFunction, callbackParameter) { function HTTPPost(uri, callbackFunction, callbackParameter, object) {
var xmlHttp = new XMLHttpRequest(); var xmlHttp = new XMLHttpRequest();
var bAsync = true; var bAsync = true;
if (!callbackFunction) { if (!callbackFunction) {
......
...@@ -9,8 +9,13 @@ body { ...@@ -9,8 +9,13 @@ body {
} }
h1 { h1 {
margin: 1.6em 0 1.1em 0; margin: 1.6em 0 1.1em 0;
}
h1, h2, h3, h4, h5, h6 {
font-family: sans-serif; font-family: sans-serif;
} }
ul {
margin: 0;
}
:link { :link {
color: #0073ba; color: #0073ba;
font-weight: bold; font-weight: bold;
...@@ -20,13 +25,34 @@ h1 { ...@@ -20,13 +25,34 @@ h1 {
font-weight: bold; font-weight: bold;
} }
div.messages {
border: 1px solid #ddd;
padding: 0.4em;
margin-top: 1em;
}
div.error {
border: 1px solid #daa;
}
/* Update styles */ /* Update styles */
h3.update { #update-results {
font-size: 1em; margin-top: 3em;
padding: 0.25em;
border: 1px solid #ccc;
background: #eee;
font-size: smaller;
}
#update-results h2 {
margin-top: 0.25em;
}
#update-results h4 {
margin-bottom: 0.25em;
} }
pre.update span.success { #update-results li.none {
color: #6bb521; color: #888;
font-style: italic;
} }
pre.update span.failure { #update-results li.failure strong {
color: #b63300; color: #b63300;
} }
...@@ -2,12 +2,17 @@ ...@@ -2,12 +2,17 @@
* A progressbar object. Initialized with the given id. Must be inserted into * A progressbar object. Initialized with the given id. Must be inserted into
* the DOM afterwards through progressBar.element. * the DOM afterwards through progressBar.element.
* *
* method is the function which will perform the HTTP request to get the
* progress bar status. Either HTTPGet or HTTPPost.
*
* e.g. pb = new progressBar('myProgressBar'); * e.g. pb = new progressBar('myProgressBar');
* some_element.appendChild(pb.element); * some_element.appendChild(pb.element);
*/ */
function progressBar(id) { function progressBar(id, callback, method) {
var pb = this; var pb = this;
this.id = id; this.id = id;
this.method = method ? method : HTTPGet;
this.callback = callback;
this.element = document.createElement('div'); this.element = document.createElement('div');
this.element.id = id; this.element.id = id;
...@@ -36,6 +41,9 @@ progressBar.prototype.setProgress = function (percentage, status) { ...@@ -36,6 +41,9 @@ progressBar.prototype.setProgress = function (percentage, status) {
divs[i].innerHTML = status; divs[i].innerHTML = status;
} }
} }
if (this.callback) {
this.callback(percentage, status);
}
} }
/** /**
...@@ -61,14 +69,14 @@ progressBar.prototype.sendPing = function () { ...@@ -61,14 +69,14 @@ progressBar.prototype.sendPing = function () {
if (this.timer) { if (this.timer) {
clearTimeout(this.timer); clearTimeout(this.timer);
} }
HTTPGet(this.uri, this.receivePing, this); this.method(this.uri, this.receivePing, this);
} }
/** /**
* HTTP callback function. Passes data back to the progressbar and sets a new * HTTP callback function. Passes data back to the progressbar and sets a new
* timer for the next ping. * timer for the next ping.
*/ */
progressBar.prototype.receivePing = function(string, xmlhttp, pb) { progressBar.prototype.receivePing = function (string, xmlhttp, pb) {
if (xmlhttp.status != 200) { if (xmlhttp.status != 200) {
return alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ pb.uri); return alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ pb.uri);
} }
......
if (isJsEnabled()) {
addLoadEvent(function() {
if ($('edit-has_js')) {
$('edit-has_js').value = 1;
}
if ($('progress')) {
updateCallback = function (progress, status) {
if (progress == 100) {
window.location = window.location.href.split('op=')[0] +'op=finished';
}
}
this.progress = new progressBar('updateprogress', updateCallback, HTTPPost);
this.progress.setProgress(-1, 'Starting updates...');
$('progress').appendChild(this.progress.element);
this.progress.startMonitoring('update.php?op=do_update', 0);
}
});
}
This diff is collapsed.
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