Location: PHPKode > projects > Online Fantasy Football League > offl-0.2.6/www/upgrade/upgrade-024.php
<?php
/**
 * Upgrade script for OFFL 0.2.x
 *
 * This patch upgrades an OFFL 0.2.x installation to allow importing of games
 * for the 2006 NFL Regular Season.  The upgrade adds a record to the control
 * table.
 *
 * @author Stephen Rochelle <hide@address.com>
 * @version OFFL v0.2
 * @copyright Copyright (c) 2004 Stephen Rochelle.  Some rights reserved.
 * @package offl-ui
 */

$pageTitle = "";
require_once("../offlconfig.php");
require_once($DOC_ROOT . "/lib/classes/offl_dbobject.php"); // gets database object for upgrading the DB.

$fix = new OFFL_DBObject();

echo "<p>Updating database structure for MySQL 5.x compatibility.</p>";
$fix->SQLQuery("ALTER TABLE users MODIFY admin tinyint(1);");
$fix->SQLQuery("ALTER TABLE users MODIFY league_admin tinyint(1);");
$fix->SQLQuery("ALTER TABLE games MODIFY final tinyint(1);");
$fix->SQLQuery("ALTER TABLE games MODIFY playoff tinyint(1);");
$fix->SQLQuery("ALTER TABLE rosterplayers MODIFY starter tinyint(1);");
$fix->SQLQuery("ALTER TABLE tradeplayers MODIFY tradelock tinyint(1);");
echo "<p>Database structure now compatible.</p>";

$fix->SQLQuery("ALTER TABLE players DROP COLUMN picture_loc;");
$fix->SQLQuery("ALTER TABLE players MODIFY nfl_profile varchar(100);");
$fix->SQLQuery("UPDATE players SET picture_loc = nfl_profile;");
$fix->SQLQuery("UPDATE players SET picture_loc='ARI' WHERE lname='Cardinals';");
$fix->SQLQuery("UPDATE players SET picture_loc='ATL' WHERE lname='Falcons';");
$fix->SQLQuery("UPDATE players SET picture_loc='BAL' WHERE lname='Ravens';");
$fix->SQLQuery("UPDATE players SET picture_loc='BUF' WHERE lname='Bills';");
$fix->SQLQuery("UPDATE players SET picture_loc='CAR' WHERE lname='Panthers';");
$fix->SQLQuery("UPDATE players SET picture_loc='CHI' WHERE lname='Bears';");
$fix->SQLQuery("UPDATE players SET picture_loc='CIN' WHERE lname='Bengals';");
$fix->SQLQuery("UPDATE players SET picture_loc='CLE' WHERE lname='Browns';");
$fix->SQLQuery("UPDATE players SET picture_loc='DAL' WHERE lname='Cowboys';");
$fix->SQLQuery("UPDATE players SET picture_loc='DEN' WHERE lname='Broncos';");
$fix->SQLQuery("UPDATE players SET picture_loc='DET' WHERE lname='Lions';");
$fix->SQLQuery("UPDATE players SET picture_loc='GB' WHERE lname='Packers';");
$fix->SQLQuery("UPDATE players SET picture_loc='HOU' WHERE lname='Texans';");
$fix->SQLQuery("UPDATE players SET picture_loc='IND' WHERE lname='Colts';");
$fix->SQLQuery("UPDATE players SET picture_loc='JAC' WHERE lname='Jaguars';");
$fix->SQLQuery("UPDATE players SET picture_loc='KC' WHERE lname='Chiefs';");
$fix->SQLQuery("UPDATE players SET picture_loc='MIA' WHERE lname='Dolphins';");
$fix->SQLQuery("UPDATE players SET picture_loc='MIN' WHERE lname='Vikings';");
$fix->SQLQuery("UPDATE players SET picture_loc='NE' WHERE lname='Patriots';");
$fix->SQLQuery("UPDATE players SET picture_loc='NO' WHERE lname='Saints';");
$fix->SQLQuery("UPDATE players SET picture_loc='NYG' WHERE lname='Giants';");
$fix->SQLQuery("UPDATE players SET picture_loc='NYJ' WHERE lname='Jets';");
$fix->SQLQuery("UPDATE players SET picture_loc='OAK' WHERE lname='Raiders';");
$fix->SQLQuery("UPDATE players SET picture_loc='PHI' WHERE lname='Eagles';");
$fix->SQLQuery("UPDATE players SET picture_loc='PIT' WHERE lname='Steelers';");
$fix->SQLQuery("UPDATE players SET picture_loc='SD' WHERE lname='Chargers';");
$fix->SQLQuery("UPDATE players SET picture_loc='SF' WHERE lname='49ers';");
$fix->SQLQuery("UPDATE players SET picture_loc='SEA' WHERE lname='Seahawks';");
$fix->SQLQuery("UPDATE players SET picture_loc='STL' WHERE lname='Rams';");
$fix->SQLQuery("UPDATE players SET picture_loc='TB' WHERE lname='Buccaneers';");
$fix->SQLQuery("UPDATE players SET picture_loc='TEN' WHERE lname='Titans';");
$fix->SQLQuery("UPDATE players SET picture_loc='WAS' WHERE lname='Redskins';");
echo "<p>Database structure updated to show player pictures.</p>";

echo "<p>Upgrade to OFFL v";
include($DOC_ROOT . "/lib/VERSION");
echo " successful.</p>\n";


echo "<p>You may now delete this file.</p>\n";



exit();
?>
Return current item: Online Fantasy Football League