Location: PHPKode > projects > WB News > install/upgrades/upgrade_2.0.0.php
<?php

/*========================================================*\
||########################################################||
||#                                                      #||
||#     WB News v2.0.0                                   #||
||# ---------------------------------------------------- #||
||#     Copyright (c) 2004-2008                          #||
||#     Created: 14th Jul 2008                           #||
||#     Filename: upgrade_2.0.0.php                      #||
||#                                                      #||
||########################################################||
/*========================================================*/

/**
 *  @author $Author: pmcilwaine $
 *  @version $Id: upgrade_2.0.0.php,v 1.1.2.1 2008/07/14 12:11:40 pmcilwaine Exp $
 */

if ( $_SERVER["SCRIPT_FILENAME"] == __FILE__ )
{
	echo "You cannot upgrade this way. Please <a href=\"../upgrade.php\">upgrade using this</a>.";
	exit;
}

require_once( "../global.php" );


$sql = array();
require_once( "sql/upgrade-" . $config["version"] . ".php" );

foreach ( $sql as $s )
{
	$DB->query( $s ) or die( "Error in SQL \"$s\" please run again" );
}

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

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

if ( CLI_UPGRADE )
{
	echo "Upgrade was successful\n";
	exit;
}

$tmpl->SetOutput( TRUE );
$tmpl->SetFilename( "templates/upgrade-complete.ihtml" );
$tmpl->AddParam( "admin_url", htmlspecialchars( "../admin/" ) );
$tmpl->GetHTML();

?>
Return current item: WB News