【php开源代码栏目提醒】:本文主要为网学会员提供update_to_latest.php,希望对需要update_to_latest.php网友有所帮助,学习一下!
<?php
/***************************************************************************
* update_to_xxx.php
* -------------------
* begin : Wednesday, May 16, 2002
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: update_to_latest.php,v 1.1.2.14 2006/05/20 14:01:48 grahamje Exp $
*
***************************************************************************/
/***************************************************************************
*
* 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 (!($result = $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 ". \n";
flush();
}
return $result;
}
@set_time_limit(120);
define('IN_
PHPBB', 1);
$phpbb_root_path = './../';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
if(!isset($dbms))
{
die("Please read: <a href='../docs/INSTALL.html'>INSTALL.html</a> before attempting to update.");
}
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
//
//
$updates_to_version = '.0.21';
//
//
//
?>
<!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
FROM " . CONFIG_TABLE . "
WHERE config_name = 'version'";
if (!($result = $db->sql_query($sql)))
{
die("Couldn't obtain version info");
}
$row = $db->sql_fetchrow($result);
$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";
//
// Schema updates
//
switch ($row['config_value'])
{
case '':
switch (SQL_LAYER)
{
case 'mysql':
case '
mysql4':
$sql[] = "ALTER TABLE " . USERS_TABLE . " DROP
COLUMN user_autologin_key";
$sql[] = "ALTER TABLE " . RANKS_TABLE . " DROP
COLUMN rank_max";
$sql[] = "ALTER TABLE " . USERS_TABLE . "
ADD COLUMN user_session_time int(11) DEFAULT '0' NOT NULL,
ADD COLUMN user_session_page smallint(5) DEFAULT '0' NOT NULL,
ADD INDEX (user_session_time)";
$sql[] = "ALTER TABLE " . SEARCH_TABLE . "
MODIFY search_id int(11) NOT NULL";
$sql[] = "ALTER TABLE " . TOPICS_TABLE . "
MODIFY topic_moved_id mediumint(8) UNSI