- Patch #41118 by Goba: various upgrade script fixes.
parent
1ef56e36a0
commit
b362985de5
|
@ -208,15 +208,10 @@ function system_update_114() {
|
|||
|
||||
function system_update_115() {
|
||||
$ret = array();
|
||||
if ($GLOBALS['db_type'] == 'mysql') {
|
||||
$ret[] = update_sql("ALTER TABLE {watchdog} ADD severity tinyint(3) unsigned NOT NULL default '0'");
|
||||
}
|
||||
else if ($GLOBALS['db_type'] == 'pgsql') {
|
||||
$ret[] = update_sql('ALTER TABLE {watchdog} ADD severity smallint');
|
||||
$ret[] = update_sql('UPDATE {watchdog} SET severity = 0');
|
||||
$ret[] = update_sql('ALTER TABLE {watchdog} ALTER COLUMN severity SET NOT NULL');
|
||||
$ret[] = update_sql('ALTER TABLE {watchdog} ALTER COLUMN severity SET DEFAULT 0');
|
||||
}
|
||||
|
||||
// This update has been moved to update_fix_watchdog_115 in update.php because it
|
||||
// is needed for the basic functioning of the update script.
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
@ -387,7 +382,7 @@ function system_update_124() {
|
|||
$result = db_query("SELECT c.nid, c.timestamp, c.name, c.uid, COUNT(c.nid) as comment_count FROM {node} n LEFT JOIN {comments} c ON c.nid = n.nid WHERE c.status = 0 GROUP BY c.nid, c.timestamp, c.name, c.uid");
|
||||
while ($comment_record = db_fetch_object($result)) {
|
||||
$count = db_result(db_query('SELECT COUNT(cid) FROM {comments} WHERE nid = %d AND status = 0', $comment_record->nid));
|
||||
$ret[] = db_query("UPDATE {node_comment_statistics} SET comment_count = %d, last_comment_timestamp = %d, last_comment_name = '%s', last_comment_uid = %d WHERE nid = %d", $count, $comment_record->timestamp, $comment_record->name, $comment_record->uid, $comment_record->nid);
|
||||
db_query("UPDATE {node_comment_statistics} SET comment_count = %d, last_comment_timestamp = %d, last_comment_name = '%s', last_comment_uid = %d WHERE nid = %d", $count, $comment_record->timestamp, $comment_record->name, $comment_record->uid, $comment_record->nid);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
@ -1128,7 +1123,7 @@ function system_update_159() {
|
|||
$vid = db_next_id('{node_revisions}_vid');
|
||||
while ($node = db_fetch_object($result)) {
|
||||
$revisions = unserialize($node->revisions);
|
||||
if (!$revisions && is_array($revisions) && count($revisions) > 0) {
|
||||
if (isset($revisions) && is_array($revisions) && count($revisions) > 0) {
|
||||
$revisions_query = array();
|
||||
$revisions_args = array();
|
||||
$book_query = array();
|
||||
|
|
|
@ -409,6 +409,7 @@ function theme_page($content) {
|
|||
function theme_maintenance_page($content) {
|
||||
drupal_set_header('Content-Type: text/html; charset=utf-8');
|
||||
theme('add_style', 'misc/maintenance.css');
|
||||
drupal_set_html_head('<link rel="shortcut icon" href="misc/favicon.ico" type="image/x-icon" />');
|
||||
$output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
|
||||
$output .= '<html xmlns="http://www.w3.org/1999/xhtml">';
|
||||
$output .= '<head>';
|
||||
|
|
34
update.php
34
update.php
|
@ -214,6 +214,29 @@ function update_fix_sessions() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* System update 115 changes the watchdog table, which breaks the update
|
||||
* script's ability to use logging. This changes the table appropriately.
|
||||
*
|
||||
* This code, including the 'update_watchdog_115_fixed' variable, may be removed
|
||||
* when update 115 is removed. It is part of the Drupal 4.5 to 4.7 migration.
|
||||
*/
|
||||
function update_fix_watchdog_115() {
|
||||
if (drupal_get_installed_schema_version('system') < 115 && !variable_get('update_watchdog_115_fixed', FALSE)) {
|
||||
if ($GLOBALS['db_type'] == 'mysql') {
|
||||
$ret[] = update_sql("ALTER TABLE {watchdog} ADD severity tinyint(3) unsigned NOT NULL default '0'");
|
||||
}
|
||||
else if ($GLOBALS['db_type'] == 'pgsql') {
|
||||
$ret[] = update_sql('ALTER TABLE {watchdog} ADD severity smallint');
|
||||
$ret[] = update_sql('UPDATE {watchdog} SET severity = 0');
|
||||
$ret[] = update_sql('ALTER TABLE {watchdog} ALTER COLUMN severity SET NOT NULL');
|
||||
$ret[] = update_sql('ALTER TABLE {watchdog} ALTER COLUMN severity SET DEFAULT 0');
|
||||
}
|
||||
|
||||
variable_set('update_watchdog_115_fixed', TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* System update 142 changes the watchdog table, which breaks the update
|
||||
* script's ability to use logging. This changes the table appropriately.
|
||||
|
@ -280,8 +303,8 @@ function update_data($module, $number) {
|
|||
}
|
||||
|
||||
function update_selection_page() {
|
||||
$output = '<p>'. t('The version of Drupal you are updating from has been automatically detected. You can select a different version, but you should not need to.') .'</p>';
|
||||
$output .= '<p>'. t('Click Update to start the update process.') .'</p>';
|
||||
$output = '<p>The version of Drupal you are updating from has been automatically detected. You can select a different version, but you should not need to.</p>';
|
||||
$output .= '<p>Click Update to start the update process.</p>';
|
||||
|
||||
$form = array();
|
||||
$form['start'] = array(
|
||||
|
@ -299,7 +322,7 @@ function update_selection_page() {
|
|||
|
||||
$form['start'][$module] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('%name module', array('%name' => $module)),
|
||||
'#title' => $module . ' module',
|
||||
'#default_value' => array_search(drupal_get_installed_schema_version($module), $updates) + 1,
|
||||
'#options' => $updates,
|
||||
);
|
||||
|
@ -313,7 +336,7 @@ function update_selection_page() {
|
|||
);
|
||||
$form['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Update')
|
||||
'#value' => 'Update'
|
||||
);
|
||||
|
||||
drupal_set_title('Drupal database update');
|
||||
|
@ -496,8 +519,9 @@ if (($access_check == FALSE) || ($user->uid == 1)) {
|
|||
include_once './includes/install.inc';
|
||||
|
||||
update_fix_schema_version();
|
||||
update_fix_sessions();
|
||||
update_fix_watchdog_115();
|
||||
update_fix_watchdog();
|
||||
update_fix_sessions();
|
||||
|
||||
$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
|
||||
switch ($op) {
|
||||
|
|
Loading…
Reference in New Issue