mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-19 09:48:53 +00:00
Various updates ... still missing PostgreSQL user_timezone change ... it's a slight nightmare.
git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@2582 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
56ca0b0045
commit
65cf2b59b7
1 changed files with 532 additions and 474 deletions
|
@ -1,6 +1,43 @@
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<?php
|
<?php
|
||||||
|
/***************************************************************************
|
||||||
|
* update_to_xxx.php
|
||||||
|
* -------------------
|
||||||
|
* begin : Wednesday, May 16, 2002
|
||||||
|
* copyright : (C) 2001 The phpBB Group
|
||||||
|
* email : support@phpbb.com
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
function _sql($sql, &$errored, &$error_ary, $echo_dot = true)
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
|
||||||
|
if( !$db->sql_query($sql) )
|
||||||
|
{
|
||||||
|
$errored = true;
|
||||||
|
$error_ary['sql'][] = ( is_array($sql) ) ? $sql[$i] : $sql;
|
||||||
|
$error_ary['error_code'][] = $db->sql_error();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $echo_dot )
|
||||||
|
{
|
||||||
|
echo ".";
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
define('IN_PHPBB', 1);
|
define('IN_PHPBB', 1);
|
||||||
$phpbb_root_path = './';
|
$phpbb_root_path = './';
|
||||||
|
@ -11,6 +48,60 @@ include($phpbb_root_path . 'includes/functions.'.$phpEx);
|
||||||
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
|
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
|
||||||
include($phpbb_root_path . 'includes/db.'.$phpEx);
|
include($phpbb_root_path . 'includes/db.'.$phpEx);
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
$updates_to_version = ".0.1";
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;">
|
||||||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
|
||||||
|
font,th,td,p,body { font-family: "Courier New", courier; font-size: 11pt }
|
||||||
|
|
||||||
|
a:link,a:active,a:visited { color : #006699; }
|
||||||
|
a:hover { text-decoration: underline; color : #DD6900;}
|
||||||
|
|
||||||
|
hr { height: 0px; border: solid #D1D7DC 0px; border-top-width: 1px;}
|
||||||
|
|
||||||
|
.maintitle,h1,h2 {font-weight: bold; font-size: 22px; font-family: "Trebuchet MS",Verdana, Arial, Helvetica, sans-serif; text-decoration: none; line-height : 120%; color : #000000;}
|
||||||
|
|
||||||
|
.ok {color:green}
|
||||||
|
|
||||||
|
/* Import the fancy styles for IE only (NS4.x doesn't use the @import function) */
|
||||||
|
@import url("templates/subSilver/formIE.css");
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body bgcolor="#FFFFFF" text="#000000" link="#006699" vlink="#5584AA">
|
||||||
|
|
||||||
|
<table width="100%" border="0" cellspacing="0" cellpadding="10" align="center">
|
||||||
|
<tr>
|
||||||
|
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||||
|
<tr>
|
||||||
|
<td><img src="templates/subSilver/images/logo_phpBB.gif" border="0" alt="Forum Home" vspace="1" /></td>
|
||||||
|
<td align="center" width="100%" valign="middle"><span class="maintitle">Updating to latest stable release</span></td>
|
||||||
|
</tr>
|
||||||
|
</table></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br clear="all" />
|
||||||
|
|
||||||
|
<h2>Information</h2>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
echo '<p>Database type :: <b>' . SQL_LAYER . '</b><br />';
|
||||||
|
|
||||||
$sql = "SELECT config_value
|
$sql = "SELECT config_value
|
||||||
FROM " . CONFIG_TABLE . "
|
FROM " . CONFIG_TABLE . "
|
||||||
WHERE config_name = 'version'";
|
WHERE config_name = 'version'";
|
||||||
|
@ -19,127 +110,31 @@ if ( !($result = $db->sql_query($sql)) )
|
||||||
die("Couldn't obtain version info");
|
die("Couldn't obtain version info");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $row = $db->sql_fetchrow($result) )
|
$row = $db->sql_fetchrow($result);
|
||||||
{
|
|
||||||
switch ( $row['config_value'] )
|
|
||||||
{
|
|
||||||
case 'RC-3':
|
|
||||||
case 'RC-4':
|
|
||||||
case '.0.0':
|
|
||||||
$sql = array();
|
|
||||||
|
|
||||||
switch ( $row['config_value'] )
|
|
||||||
{
|
|
||||||
case 'RC-3':
|
|
||||||
switch ( SQL_LAYER )
|
|
||||||
{
|
|
||||||
case 'mysql':
|
|
||||||
case 'mysql4':
|
|
||||||
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
|
|
||||||
COLUMN user_autologin_key";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'mssql-odbc':
|
|
||||||
case 'mssql':
|
|
||||||
case 'msaccess':
|
|
||||||
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
|
|
||||||
COLUMN user_autologin_key";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'postgresql':
|
|
||||||
$sql[] = "ALTER TABLE " . USERS_TABLE . " ALTER
|
|
||||||
COLUMN user_autologin_key DROP";
|
|
||||||
default:
|
|
||||||
die("No DB LAYER found!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$errored = false;
|
|
||||||
for($i = 0; $i < count($sql); $i++)
|
|
||||||
{
|
|
||||||
echo "Running :: " . $sql[$i];
|
|
||||||
flush();
|
|
||||||
|
|
||||||
if ( !($result = $db->sql_query($sql[$i])) )
|
|
||||||
{
|
|
||||||
$errored = true;
|
|
||||||
$error = $db->sql_error();
|
|
||||||
echo " -> <b>FAILED (Ignoring)</b> ---> <u>" . $error['message'] . "</u><br /><br />\n\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo " -> <b>COMPLETED</b><br /><br />\n\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($sql);
|
|
||||||
|
|
||||||
switch ( $row['config_value'] )
|
|
||||||
{
|
|
||||||
case 'RC-3':
|
|
||||||
case 'RC-4':
|
|
||||||
case '.0.0':
|
|
||||||
$sql = "SELECT topic_id, topic_moved_id
|
|
||||||
FROM " . TOPICS_TABLE . "
|
|
||||||
WHERE topic_moved_id <> 0";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
die("Couldn't update version info");
|
|
||||||
}
|
|
||||||
|
|
||||||
$topic_ary = array();
|
|
||||||
while ( $row = $db->sql_fetchrow($result) )
|
|
||||||
{
|
|
||||||
$topic_ary[$row['topic_id']] = $row['topic_moved_id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
while ( list($topic_id, $topic_moved_id) = each($topic_ary) )
|
|
||||||
{
|
|
||||||
$sql = "SELECT MAX(post_id) AS last_post, MIN(post_id) AS first_post, COUNT(post_id) AS total_posts
|
|
||||||
FROM " . POSTS_TABLE . "
|
|
||||||
WHERE topic_id = $topic_moved_id";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not get post ID', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $row = $db->sql_fetchrow($result) )
|
|
||||||
{
|
|
||||||
$sql = "UPDATE " . TOPICS_TABLE . "
|
|
||||||
SET topic_replies = " . ( $row['total_posts'] - 1 ) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . "
|
|
||||||
WHERE topic_id = $topic_id";
|
|
||||||
if ( !$db->sql_query($sql) )
|
|
||||||
{
|
|
||||||
message_die(GENERAL_ERROR, 'Could not update topic', '', __LINE__, __FILE__, $sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($sql);
|
|
||||||
|
|
||||||
$sql = "UPDATE " . CONFIG_TABLE . "
|
|
||||||
SET config_value = '.0.1'
|
|
||||||
WHERE config_name = 'version'";
|
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
|
||||||
{
|
|
||||||
die("Couldn't update version info");
|
|
||||||
}
|
|
||||||
|
|
||||||
sync('all forums');
|
|
||||||
|
|
||||||
die("UPDATING COMPLETE -> 2.0.1 Final installed");
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
die("NO UPDATES REQUIRED");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = array();
|
$sql = array();
|
||||||
|
|
||||||
|
switch ( $row['config_value'] )
|
||||||
|
{
|
||||||
|
case '':
|
||||||
|
echo 'Previous version :: <b>< RC-3</b></p><br />';
|
||||||
|
break;
|
||||||
|
case 'RC-3':
|
||||||
|
echo 'Previous version :: <b>RC-3</b></p><br />';
|
||||||
|
break;
|
||||||
|
case 'RC-4':
|
||||||
|
echo 'Previous version :: <b>RC-4</b></p><br />';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo 'Previous version :: <b>2' . $row['config_value'] . '</b><br />';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo 'Updated version :: <b>2' . $updates_to_version . '</b></p>' ."\n";
|
||||||
|
|
||||||
|
switch ( $row['config_value'] )
|
||||||
|
{
|
||||||
|
case '':
|
||||||
switch ( SQL_LAYER )
|
switch ( SQL_LAYER )
|
||||||
{
|
{
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
|
@ -233,9 +228,11 @@ switch ( SQL_LAYER )
|
||||||
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "users]
|
$sql[] = "CREATE INDEX [IX_" . $table_prefix . "users]
|
||||||
ON [" . USERS_TABLE . "]([user_session_time]) ON [PRIMARY]";
|
ON [" . USERS_TABLE . "]([user_session_time]) ON [PRIMARY]";
|
||||||
|
|
||||||
/* DROP FORUM TABLE -- if this may cause you problems you can safely
|
/* ---------------------------------------------------------------------
|
||||||
|
DROP FORUM TABLE -- if this may cause you problems you can safely
|
||||||
comment it out, remember to manually remove the IDENTITY setting on
|
comment it out, remember to manually remove the IDENTITY setting on
|
||||||
the forum_id column */
|
the forum_id column
|
||||||
|
--------------------------------------------------------------------- */
|
||||||
$sql [] = "ALTER TABLE " . FORUMS_TABLE . " DROP
|
$sql [] = "ALTER TABLE " . FORUMS_TABLE . " DROP
|
||||||
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts],
|
CONSTRAINT [DF_" . $table_prefix . "forums_forum_posts],
|
||||||
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics],
|
CONSTRAINT [DF_" . $table_prefix . "forums_forum_topics],
|
||||||
|
@ -278,7 +275,9 @@ switch ( SQL_LAYER )
|
||||||
CONSTRAINT [PK_" . $table_prefix . "forums] PRIMARY KEY CLUSTERED (forum_id) ON [PRIMARY]";
|
CONSTRAINT [PK_" . $table_prefix . "forums] PRIMARY KEY CLUSTERED (forum_id) ON [PRIMARY]";
|
||||||
$sql[] = "CREATE NONCLUSTERED INDEX [IX_" . $table_prefix . "forums]
|
$sql[] = "CREATE NONCLUSTERED INDEX [IX_" . $table_prefix . "forums]
|
||||||
ON " . FORUMS_TABLE . " (cat_id, forum_order, forum_last_post_id) ON [PRIMARY]";
|
ON " . FORUMS_TABLE . " (cat_id, forum_order, forum_last_post_id) ON [PRIMARY]";
|
||||||
/* END OF DROP FORUM -- don't remove anything after this point! */
|
/* --------------------------------------------------------------
|
||||||
|
END OF DROP FORUM -- don't remove anything after this point!
|
||||||
|
-------------------------------------------------------------- */
|
||||||
|
|
||||||
$sql[] = "DROP INDEX " . RANKS_TABLE . ".IX_" . $table_prefix . "ranks";
|
$sql[] = "DROP INDEX " . RANKS_TABLE . ".IX_" . $table_prefix . "ranks";
|
||||||
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
|
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
|
||||||
|
@ -353,37 +352,88 @@ switch ( SQL_LAYER )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$errored = false;
|
case 'RC-3':
|
||||||
for($i = 0; $i < count($sql); $i++)
|
case 'RC-4':
|
||||||
|
case '.0.0':
|
||||||
|
switch ( SQL_LAYER )
|
||||||
{
|
{
|
||||||
echo "Running :: " . $sql[$i];
|
case 'mysql':
|
||||||
|
case 'mysql4':
|
||||||
|
$sql[] = "ALTER TABLE " . USERS_TABLE . "
|
||||||
|
MODIFY COLUMN user_id mediumint(8) NOT NULL,
|
||||||
|
MODIFY COLUMN user_timezone decimal(4,2) DEFAULT '0' NOT NULL";
|
||||||
|
$sql[] = "ALTER TABLE " . GROUPS_TABLE . "
|
||||||
|
MODIFY COLUMN group_id mediumint(8) NOT NULL";
|
||||||
|
break;
|
||||||
|
case 'postgresql':
|
||||||
|
// $sql[] = "ALTER TABLE " . USERS_TABLE . "
|
||||||
|
// RENAME COLUMN user_timezone TO user_timezone_old";
|
||||||
|
// $sql[] = "ALTER TABLE " . USERS_TABLE . "
|
||||||
|
// ADD COLUMN user_timezone decimal(4)";
|
||||||
|
break;
|
||||||
|
case 'mssql':
|
||||||
|
case 'mssql-odbc':
|
||||||
|
$sql[] = "ALTER TABLE " . USERS_TABLE . "
|
||||||
|
ALTER COLUMN [user_timezone] [decimal] (4,2) NOT NULL";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<h2>Updating database schema</h2>\n";
|
||||||
|
echo "<p>Progress :: <b>";
|
||||||
flush();
|
flush();
|
||||||
|
|
||||||
if ( !($result = $db->sql_query($sql[$i])) )
|
$error_ary = array();
|
||||||
|
$errored = false;
|
||||||
|
if ( count($sql) )
|
||||||
{
|
{
|
||||||
$errored = true;
|
for($i = 0; $i < count($sql); $i++)
|
||||||
$error = $db->sql_error();
|
|
||||||
echo " -> <b>FAILED (Ignoring)</b> ---> <u>" . $error['message'] . "</u><br /><br />\n\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
echo " -> <b>COMPLETED</b><br /><br />\n\n";
|
_sql($sql[$i], $errored, $error_ary);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "</b> <b class=\"ok\">Done</b><br />Result :: \n";
|
||||||
|
|
||||||
if ( $errored )
|
if ( $errored )
|
||||||
{
|
{
|
||||||
echo "\n<br /><b>Some queries failed! This is probably nothing to worry about, update will attempt to continue. Should this fail you may need to seek help at our development board (see README)</b><br /><br />\n\n";
|
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
|
||||||
flush();
|
|
||||||
|
for($i = 0; $i < count($error_ary['sql']); $i++)
|
||||||
|
{
|
||||||
|
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
|
||||||
|
echo "SQL :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "<b>No errors</b>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo " No updates required</b></p>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
unset($sql);
|
||||||
|
$error_ary = array();
|
||||||
|
$errored = false;
|
||||||
|
|
||||||
|
echo "<h2>Updating data</h2>\n";
|
||||||
|
echo "<p>Progress :: <b>";
|
||||||
|
flush();
|
||||||
|
|
||||||
|
switch ( $row['config_value'] )
|
||||||
|
{
|
||||||
|
case '':
|
||||||
$sql = "SELECT themes_id
|
$sql = "SELECT themes_id
|
||||||
FROM " . THEMES_TABLE . "
|
FROM " . THEMES_TABLE . "
|
||||||
WHERE template_name = 'subSilver'";
|
WHERE template_name = 'subSilver'";
|
||||||
if( !($result = $db->sql_query($sql)) )
|
_sql($sql, $errored, $error_ary);
|
||||||
{
|
|
||||||
die("Couldn't obtain subSilver id");
|
|
||||||
}
|
|
||||||
|
|
||||||
if( $row = $db->sql_fetchrow($result) )
|
if( $row = $db->sql_fetchrow($result) )
|
||||||
{
|
{
|
||||||
|
@ -392,69 +442,42 @@ if( $row = $db->sql_fetchrow($result) )
|
||||||
$sql = "UPDATE " . THEMES_TABLE . "
|
$sql = "UPDATE " . THEMES_TABLE . "
|
||||||
SET head_stylesheet = 'subSilver.css', body_background = '', body_bgcolor = 'E5E5E5', body_text = '000000', body_link = '006699', body_vlink = '5493B4', body_alink = '', body_hlink = 'DD6900', tr_color1 = 'EFEFEF', tr_color2 = 'DEE3E7', tr_color3 = 'D1D7DC', tr_class1 = '', tr_class2 = '', tr_class3 = '', th_color1 = '98AAB1', th_color2 = '006699', th_color3 = 'FFFFFF', th_class1 = 'cellpic1.gif', th_class2 = 'cellpic3.gif', th_class3 = 'cellpic2.jpg', td_color1 = 'FAFAFA', td_color2 = 'FFFFFF', td_color3 = '', td_class1 = 'row1', td_class2 = 'row2', td_class3 = '', fontface1 = 'Verdana, Arial, Helvetica, sans-serif', fontface2 = 'Trebuchet MS', fontface3 = 'Courier, ''Courier New'', sans-serif', fontsize1 = 10, fontsize2 = 11, fontsize3 = 12, fontcolor1 = '444444', fontcolor2 = '006600', fontcolor3 = 'FFA34F', span_class1 = '', span_class2 = '', span_class3 = ''
|
SET head_stylesheet = 'subSilver.css', body_background = '', body_bgcolor = 'E5E5E5', body_text = '000000', body_link = '006699', body_vlink = '5493B4', body_alink = '', body_hlink = 'DD6900', tr_color1 = 'EFEFEF', tr_color2 = 'DEE3E7', tr_color3 = 'D1D7DC', tr_class1 = '', tr_class2 = '', tr_class3 = '', th_color1 = '98AAB1', th_color2 = '006699', th_color3 = 'FFFFFF', th_class1 = 'cellpic1.gif', th_class2 = 'cellpic3.gif', th_class3 = 'cellpic2.jpg', td_color1 = 'FAFAFA', td_color2 = 'FFFFFF', td_color3 = '', td_class1 = 'row1', td_class2 = 'row2', td_class3 = '', fontface1 = 'Verdana, Arial, Helvetica, sans-serif', fontface2 = 'Trebuchet MS', fontface3 = 'Courier, ''Courier New'', sans-serif', fontsize1 = 10, fontsize2 = 11, fontsize3 = 12, fontcolor1 = '444444', fontcolor2 = '006600', fontcolor3 = 'FFA34F', span_class1 = '', span_class2 = '', span_class3 = ''
|
||||||
WHERE themes_id = $theme_id";
|
WHERE themes_id = $theme_id";
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
_sql($sql, $errored, $error_ary);
|
||||||
{
|
|
||||||
die("Couldn't update subSilver theme");
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "DELETE FROM " . THEMES_NAME_TABLE . "
|
$sql = "DELETE FROM " . THEMES_NAME_TABLE . "
|
||||||
WHERE themes_id = $theme_id";
|
WHERE themes_id = $theme_id";
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
_sql($sql, $errored, $error_ary);
|
||||||
{
|
|
||||||
die("Couldn't delete subSilver theme names");
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name)
|
$sql = "INSERT INTO " . THEMES_NAME_TABLE . " (themes_id, tr_color1_name, tr_color2_name, tr_color3_name, tr_class1_name, tr_class2_name, tr_class3_name, th_color1_name, th_color2_name, th_color3_name, th_class1_name, th_class2_name, th_class3_name, td_color1_name, td_color2_name, td_color3_name, td_class1_name, td_class2_name, td_class3_name, fontface1_name, fontface2_name, fontface3_name, fontsize1_name, fontsize2_name, fontsize3_name, fontcolor1_name, fontcolor2_name, fontcolor3_name, span_class1_name, span_class2_name, span_class3_name)
|
||||||
VALUES ($theme_id, 'The lightest row colour', 'The medium row color', 'The darkest row colour', '', '', '', 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', '', 'Background for topic posts', '2nd background for topic posts', '', 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', '', '', '')";
|
VALUES ($theme_id, 'The lightest row colour', 'The medium row color', 'The darkest row colour', '', '', '', 'Border round the whole page', 'Outer table border', 'Inner table border', 'Silver gradient picture', 'Blue gradient picture', 'Fade-out gradient on index', 'Background for quote boxes', 'All white areas', '', 'Background for topic posts', '2nd background for topic posts', '', 'Main fonts', 'Additional topic title font', 'Form fonts', 'Smallest font size', 'Medium font size', 'Normal font size (post body etc)', 'Quote & copyright text', 'Code text colour', 'Main table header text colour', '', '', '')";
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
_sql($sql, $errored, $error_ary);
|
||||||
{
|
|
||||||
echo "WARNING >> Couldn't insert subSilver name info<br />\n";
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
print "<br />Updating topic first post info<br />\n";
|
|
||||||
flush();
|
|
||||||
|
|
||||||
$sql = "SELECT MIN(post_id) AS first_post_id, topic_id
|
$sql = "SELECT MIN(post_id) AS first_post_id, topic_id
|
||||||
FROM " . POSTS_TABLE . "
|
FROM " . POSTS_TABLE . "
|
||||||
GROUP BY topic_id
|
GROUP BY topic_id
|
||||||
ORDER BY topic_id ASC";
|
ORDER BY topic_id ASC";
|
||||||
if ( !($result = $db->sql_query($sql)) )
|
_sql($sql, $errored, $error_ary);
|
||||||
{
|
|
||||||
die("Couldn't obtain first post id list");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $row = $db->sql_fetchrow($result) )
|
if ( $row = $db->sql_fetchrow($result) )
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
$post_id = $row['first_post_id'];
|
|
||||||
$topic_id = $row['topic_id'];
|
|
||||||
|
|
||||||
$sql = "UPDATE " . TOPICS_TABLE . "
|
$sql = "UPDATE " . TOPICS_TABLE . "
|
||||||
SET topic_first_post_id = $post_id
|
SET topic_first_post_id = " . $row['first_post_id'] . "
|
||||||
WHERE topic_id = $topic_id";
|
WHERE topic_id = " . $row['topic_id'];
|
||||||
if ( !$db->sql_query($sql) )
|
_sql($sql, $errored, $error_ary);
|
||||||
{
|
|
||||||
die("Couldn't update topic first post id in topic :: $topic_id");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
while ( $row = $db->sql_fetchrow($result) );
|
while ( $row = $db->sql_fetchrow($result) );
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<br />Updating moderator user_level<br />\n";
|
|
||||||
flush();
|
|
||||||
|
|
||||||
$sql = "SELECT DISTINCT u.user_id
|
$sql = "SELECT DISTINCT u.user_id
|
||||||
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa
|
FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa
|
||||||
WHERE aa.auth_mod = 1
|
WHERE aa.auth_mod = 1
|
||||||
AND ug.group_id = aa.group_id
|
AND ug.group_id = aa.group_id
|
||||||
AND u.user_id = ug.user_id
|
AND u.user_id = ug.user_id
|
||||||
AND u.user_level <> " . ADMIN;
|
AND u.user_level <> " . ADMIN;
|
||||||
if ( !$db->sql_query($sql) )
|
_sql($sql, $errored, $error_ary);
|
||||||
{
|
|
||||||
die("Couldn't obtain moderator user ids");
|
|
||||||
}
|
|
||||||
|
|
||||||
$mod_user = array();
|
$mod_user = array();
|
||||||
while ( $row = $db->sql_fetchrow($result) )
|
while ( $row = $db->sql_fetchrow($result) )
|
||||||
|
@ -467,60 +490,95 @@ if ( count($mod_user) )
|
||||||
$sql = "UPDATE " . USERS_TABLE . "
|
$sql = "UPDATE " . USERS_TABLE . "
|
||||||
SET user_level = " . MOD . "
|
SET user_level = " . MOD . "
|
||||||
WHERE user_id IN (" . implode(', ', $mod_user) . ")";
|
WHERE user_id IN (" . implode(', ', $mod_user) . ")";
|
||||||
if ( !$db->sql_query($sql) )
|
_sql($sql, $errored, $error_ary);
|
||||||
{
|
|
||||||
die("Couldn't update user level");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
print "<br />Updating config settings<br />\n";
|
|
||||||
flush();
|
|
||||||
|
|
||||||
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
||||||
VALUES ('server_name', 'www.myserver.tld')";
|
VALUES ('server_name', 'www.myserver.tld')";
|
||||||
if( !$db->sql_query($sql) )
|
_sql($sql, $errored, $error_ary);
|
||||||
{
|
|
||||||
print "Failed inserting server_name config ... probably exists already<br />\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
||||||
VALUES ('script_path', '/phpBB2/')";
|
VALUES ('script_path', '/phpBB2/')";
|
||||||
if( !$db->sql_query($sql) )
|
_sql($sql, $errored, $error_ary);
|
||||||
{
|
|
||||||
print "Failed inserting script_path config ... probably exists already<br />\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
||||||
VALUES ('server_port', '80')";
|
VALUES ('server_port', '80')";
|
||||||
if( !$db->sql_query($sql) )
|
_sql($sql, $errored, $error_ary);
|
||||||
{
|
|
||||||
print "Failed inserting server_port config ... probably exists already<br />\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
|
||||||
VALUES ('version', '.0.0')";
|
|
||||||
if ( !$db->sql_query($sql) )
|
|
||||||
{
|
|
||||||
print "Failed inserting version config ... probably exists already<br />\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
||||||
VALUES ('record_online_users', '1')";
|
VALUES ('record_online_users', '1')";
|
||||||
if( !$db->sql_query($sql) )
|
_sql($sql, $errored, $error_ary);
|
||||||
{
|
|
||||||
print "Failed inserting record_online_users config ... probably exists already<br />\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value)
|
||||||
VALUES ('record_online_date', '" . time() . "')";
|
VALUES ('record_online_date', '" . time() . "')";
|
||||||
if( !$db->sql_query($sql) )
|
_sql($sql, $errored, $error_ary);
|
||||||
|
|
||||||
|
case 'RC-3':
|
||||||
|
case 'RC-4':
|
||||||
|
case '.0.0':
|
||||||
|
$sql = "SELECT topic_id, topic_moved_id
|
||||||
|
FROM " . TOPICS_TABLE . "
|
||||||
|
WHERE topic_moved_id <> 0";
|
||||||
|
_sql($sql, $errored, $error_ary);
|
||||||
|
|
||||||
|
$topic_ary = array();
|
||||||
|
while ( $row = $db->sql_fetchrow($result) )
|
||||||
{
|
{
|
||||||
print "Failed inserting record_online_date config ... probably exists already<br />\n";
|
$topic_ary[$row['topic_id']] = $row['topic_moved_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while ( list($topic_id, $topic_moved_id) = each($topic_ary) )
|
||||||
|
{
|
||||||
|
$sql = "SELECT MAX(post_id) AS last_post, MIN(post_id) AS first_post, COUNT(post_id) AS total_posts
|
||||||
|
FROM " . POSTS_TABLE . "
|
||||||
|
WHERE topic_id = $topic_moved_id";
|
||||||
|
_sql($sql, $errored, $error_ary);
|
||||||
|
|
||||||
|
$sql = ( $row = $db->sql_fetchrow($result) ) ? "UPDATE " . TOPICS_TABLE . " SET topic_replies = " . ( $row['total_posts'] - 1 ) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . " WHERE topic_id = $topic_id" : "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = " . $row['topic_id'];
|
||||||
|
_sql($sql, $errored, $error_ary);
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($sql);
|
||||||
|
|
||||||
|
$sql = "UPDATE " . CONFIG_TABLE . "
|
||||||
|
SET config_value = '$updates_to_version'
|
||||||
|
WHERE config_name = 'version'";
|
||||||
|
_sql($sql, $errored, $error_ary);
|
||||||
|
|
||||||
|
sync('all forums');
|
||||||
|
|
||||||
|
echo "</b> <b class=\"ok\">Done</b><br />Result :: \n";
|
||||||
|
|
||||||
|
if ( $errored )
|
||||||
|
{
|
||||||
|
echo " <b>Some queries failed, the statements and errors are listing below</b>\n<ul>";
|
||||||
|
|
||||||
|
for($i = 0; $i < count($error_ary['sql']); $i++)
|
||||||
|
{
|
||||||
|
echo "<li>Error :: <b>" . $error_ary['error_code'][$i]['message'] . "</b><br />";
|
||||||
|
echo "SQL :: <b>" . $error_ary['sql'][$i] . "</b><br /><br /></li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</ul>\n<p>This is probably nothing to worry about, update will continue. Should this fail to complete you may need to seek help at our development board. See <a href=\"docs\README.html\">README</a> for details on how to obtain advice.</p>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "<b>No errors</b>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
echo " No updates where required</b></p>\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<h2>Update completed</h2>\n";
|
||||||
|
echo "\n<p>You should now visit the General Configuration settings page in the <a href=\"admin/\">Administration Panel</a> and check the General Configuration of the board. If you updated from versions prior to RC-3 you <b>must</b> update some entries. If you do not do this emails sent from the board will contain incorrect information. Don't forget to delete this file!</p>\n";
|
||||||
|
|
||||||
echo "\n<br />\n<b>COMPLETE!</b><br />\n";
|
|
||||||
echo "\n<p>You should now visit the General Configuration settings page in the <a href=\"admin/\">Administration Panel</a> and update the 'Server' settings. If you do not do this emails sent from the board will contain incorrect information. Don't forget to delete this file!</p>\n";
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<br clear="all" />
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Add table
Reference in a new issue