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 (
status int(2) NOT NULL default '0',
throttle tinyint(1) DEFAULT '0' NOT NULL,
bootstrap int(2) NOT NULL default '0',
schema_version smallint(2) unsigned NOT NULL,
PRIMARY KEY (filename)
) TYPE=MyISAM;
......
......@@ -650,6 +650,7 @@ CREATE TABLE system (
status integer NOT NULL default '0',
throttle smallint NOT NULL default '0',
bootstrap integer NOT NULL default '0',
schema_version int2 NOT NULL CHECK (schema_version > 0),
PRIMARY KEY (filename)
);
......
This diff is collapsed.
......@@ -105,7 +105,7 @@ function _db_query($query, $debug = 0) {
return $result;
}
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;
}
}
......
......@@ -113,7 +113,7 @@ function _db_query($query, $debug = 0) {
return $result;
}
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;
}
}
......
......@@ -92,7 +92,7 @@ function _db_query($query, $debug = 0) {
return $last_result;
}
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;
}
}
......
......@@ -974,6 +974,16 @@ function theme_username($object) {
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".
*/
......
......@@ -67,7 +67,7 @@ function HTTPGet(uri, callbackFunction, callbackParameter) {
/**
* 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 bAsync = true;
if (!callbackFunction) {
......
......@@ -9,8 +9,13 @@ body {
}
h1 {
margin: 1.6em 0 1.1em 0;
}
h1, h2, h3, h4, h5, h6 {
font-family: sans-serif;
}
ul {
margin: 0;
}
:link {
color: #0073ba;
font-weight: bold;
......@@ -20,13 +25,34 @@ h1 {
font-weight: bold;
}
div.messages {
border: 1px solid #ddd;
padding: 0.4em;
margin-top: 1em;
}
div.error {
border: 1px solid #daa;
}
/* Update styles */
h3.update {
font-size: 1em;
#update-results {
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 {
color: #6bb521;
#update-results li.none {
color: #888;
font-style: italic;
}
pre.update span.failure {
#update-results li.failure strong {
color: #b63300;
}
......@@ -2,12 +2,17 @@
* A progressbar object. Initialized with the given id. Must be inserted into
* 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');
* some_element.appendChild(pb.element);
*/
function progressBar(id) {
function progressBar(id, callback, method) {
var pb = this;
this.id = id;
this.method = method ? method : HTTPGet;
this.callback = callback;
this.element = document.createElement('div');
this.element.id = id;
......@@ -36,6 +41,9 @@ progressBar.prototype.setProgress = function (percentage, status) {
divs[i].innerHTML = status;
}
}
if (this.callback) {
this.callback(percentage, status);
}
}
/**
......@@ -61,14 +69,14 @@ progressBar.prototype.sendPing = function () {
if (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
* timer for the next ping.
*/
progressBar.prototype.receivePing = function(string, xmlhttp, pb) {
progressBar.prototype.receivePing = function (string, xmlhttp, pb) {
if (xmlhttp.status != 200) {
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