|
From: OryNider <ory...@us...> - 2007-09-17 07:22:27
|
Update of /cvsroot/mxbb/mx_radiocast In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2753 Added Files: db_upgrade.php Log Message: db upgrade file added. --- NEW FILE: db_upgrade.php --- <?php /** * * @package mxBB Portal Module - mx_radiocast * @version $Id: db_upgrade.php,v 1.1 2007/09/17 07:22:18 orynider Exp $ * @copyright (c) 2002-2006 [Markus, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ define( 'IN_PORTAL', true ); if ( !defined( 'IN_ADMIN' ) ) { $mx_root_path = './../../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include( $mx_root_path . 'common.' . $phpEx ); // Start session management $mx_user->init($user_ip, PAGE_INDEX); if ( !$userdata['session_logged_in'] ) { die( "Hacking attempt(1)" ); } if ( $userdata['user_level'] != ADMIN ) { die( "Hacking attempt(2)" ); } // End session management } $mx_module_version = '1.0.1'; $mx_module_copy = 'mxBB <i> - Radio Cast</i> module by <a href="http://www.mxbb.net/" target="_blank">OryNider</a>'; $sql = array(); // // Precheck // if ( $result = $db->sql_query( "SELECT config_name from " . $mx_table_prefix . "radiocast_config" ) ) { // // Upgrade checks // $upgrade_101 = 0; // // validate before 1.01 // $result = $db->sql_query( "SELECT config_value from " . $mx_table_prefix . "radiocast_config WHERE config_name = 'show_index_subcats'" ); if ( $db->sql_numrows( $result ) == 0 ) { $upgrade_101 = 1; } $message = "<b>Upgrading!</b><br/><br/>"; if ( $upgrade_101 == 1 ) { $message .= "<b>Upgrading to v. 1.0.1...</b><br/><br/>"; $sql[] = "INSERT INTO " . $mx_table_prefix . "radiocast_config VALUES ('show_index_subcats', '1')"; $sql[] = "ALTER TABLE " . $mx_table_prefix . "radiocast_cat ADD cat_parent mediumint(8) UNSIGNED NOT NULL DEFAULT '0' AFTER cat_id"; $sql[] = "ALTER TABLE " . $mx_table_prefix . "radiocast_cat ADD cat_type tinyint NOT NULL DEFAULT '0' AFTER cat_parent"; $sql[] = "UPDATE ". $mx_table_prefix ."radiocast_config SET config_value = '0.1' WHERE config_name = 'radiocast_version'"; } else { $message .= "<b>Nothing to upgrade...</b><br/><br/>"; } $sql[] = "UPDATE " . $mx_table_prefix . "module" . " SET module_version = '" . $mx_module_version . "', module_copy = '" . $mx_module_copy . "' WHERE module_id = '" . $mx_module_id . "'"; $message .= mx_do_install_upgrade( $sql ); } else { // // If not installed // $message = "<b>Module is not installed...and thus cannot be upgraded ;)</b><br/><br/>"; } echo "<br /><br />"; echo "<table width=\"90%\" align=\"center\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" class=\"forumline\">"; echo "<tr><th class=\"thHead\" align=\"center\">Module Installation/Upgrading/Uninstalling Information - module specific db tables</th></tr>"; echo "<tr><td class=\"row1\" align=\"left\"><span class=\"gen\">" . $message . "</span></td></tr>"; echo "</table><br />"; ?> |