Location: PHPKode > projects > WB News > install/upgrades/upgrade_1.2.0.php
<?php

/*========================================================*\
||########################################################||
||#                                                      #||
||#     WB News v1.3.0                                   #||
||# ---------------------------------------------------- #||
||#     Copyright (c) 2004-2006                          #||
||#     Created: 27th May 2006                           #||
||#     Filename: upgrade_1.2.0.php                      #||
||#                                                      #||
||########################################################||
/*========================================================*/

/**
 *  @author $Author: pmcilwaine $
 *	@version $Id: upgrade_1.2.0.php,v 1.1.2.1 2008/02/03 10:08:34 pmcilwaine Exp $
 */

/**
 *  Do Database Changes
 */
$dbChanges = array();
$dbChanges[] = "ALTER TABLE `" . $config["prefix"] . "news` ADD `summary` TEXT NOT NULL AFTER `title`";
$dbChanges[] = "UPDATE `" . $config["prefix"] . "menu` SET name = 'Users' WHERE name = 'Search Users'";

/**
 *  Upgrade config.php to newest version
 */
$configUpdate = file("../config.php");
$configUpdate[29] = "    \$config['version'] = '" . $newVersion . "';			//version\n";
$configUpdate = implode("", $configUpdate);

$fp = fopen("../config.php", "w");
$bytes = fwrite($fp, $configUpdate);
fclose($fp);

$configOK = ($bytes === false) ? "No" : "Yes";

?>

<html>
<head>
<title>WB News Upgrade <?php echo $newVersion; ?></title>
</head>
<body>

<img src="./imgs/wbnews.png" alt="WB News" title="WB News"/><br clear="all"/>

<strong>Database Changes:</strong> 
<?php 
if ( count($dbChanges) != 0 )
{
    include $config['installdir']."/includes/lib/db_mysql.php";
    $dbclass = new DB($config['dbhost'], base64_decode($config['dbname']), base64_decode($config['dbuser']), base64_decode($config['dbpass']));
    $dbclass->db_connect();

    $i = 0;
    foreach ( $dbChanges as $query )
    {
        $dbclass->db_query( $query );
        $i++;
    }

    echo ( $i == count($dbChanges) ) ? "All $i database changes made" : "Not all database changes were made, please report errors given.";
    
}
else
    echo "No DB Changes";
?>
<p />
<strong>Config.php Updated:</strong> <?php echo $configOK;?><p/>

<p>Make sure you have uploaded all files. If you have any errors please report them, if you have
no errors you have successfully upgraded to <?php echo $newVersion; ?>.</p>

</body>
</html>
Return current item: WB News