IPB UPGRADE MODULE:: IPB 2.0.2 -> IPB 2.0.3
| > Script written by Matt Mecham
| > Date started: 23rd April 2004
| > "So what, pop is dead - it's no great loss.
So many facelifts, it's face flew off"
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_IPB' ) )
{
print "
Incorrect access
You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class version_upgrade
{
var $this_version = '21007';
var $upgrade_from = '21006';
var $first_step = 'update your database to include the new schematic';
var $md5_check = '';
var $base_url = '';
var $mod_to_run = '';
/*-------------------------------------------------------------------------*/
// CONSTRUCTOR
/*-------------------------------------------------------------------------*/
function version_upgrade()
{
}
function version_process()
{
$this->md5_check = $this->ipsclass->return_md5_check();
$this->base_url = "index.php?act=work&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}";
if ( is_array( $this->ipsclass->modules_to_run ) and count( $this->ipsclass->modules_to_run ) )
{
$tmp = array_shift( $this->ipsclass->modules_to_run );
$this->mod_to_run = implode( ', ', $this->ipsclass->modules_to_run );
}
if ( ! $this->mod_to_run )
{
$this->mod_to_run = 'None';
}
}
/*-------------------------------------------------------------------------*/
// Auto run..
/*-------------------------------------------------------------------------*/
function auto_run()
{
//--------------------------------
// What are we doing?
// sql => DONE
//--------------------------------
switch( $this->ipsclass->input['workact'] )
{
case 'sql':
$this->upgrade_sql();
break;
default:
$this->upgrade_intro();
break;
}
}
/*-------------------------------------------------------------------------*/
// SQL: 0
/*-------------------------------------------------------------------------*/
function upgrade_sql()
{
$man = intval( $this->ipsclass->input['man'] );
$SQL = array();
$file = '_updates.php';
$cnt = 0;
if ( file_exists( THIS_PATH . 'upg_' . $this->ipsclass->current_upgrade . '/' . strtolower($this->ipsclass->vars['sql_driver']) . $file ) )
{
require_once( THIS_PATH . 'upg_' . $this->ipsclass->current_upgrade . '/' . strtolower($this->ipsclass->vars['sql_driver']) . $file );
foreach( $SQL as $q )
{
$q = str_replace( "<%time%>", time(), $q );
$this->ipsclass->DB->query( $q );
$cnt++;
}
}
//-----------------------------------------
// Remove dupe categories
//-----------------------------------------
$title_id_to_keep = array();
$title_id_to_delete = array();
$title_deleted_count = 0;
$msg = '';
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'conf_settings_titles', 'order' => 'conf_title_id DESC' ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
if ( $title_id_to_keep[ $r['conf_title_title'] ] )
{
$title_id_to_delete[ $r['conf_title_id'] ] = $r['conf_title_id'];
}
else
{
$title_id_to_keep[ $r['conf_title_title'] ] = $r['conf_title_id'];
}
}
if ( count( $title_id_to_delete ) )
{
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'conf_settings_titles', 'where' => 'conf_title_id IN ('.implode( ',', $title_id_to_delete ).')' ) );
}
$title_deleted_count = intval( count($title_id_to_delete) );
//-----------------------------------------
// Update this parachat component
//-----------------------------------------
if ( $this->ipsclass->vars['chat04_account_no'] )
{
require_once( ROOT_PATH . 'sources/api/api_core.php' );
require_once( ROOT_PATH . 'sources/api/api_components.php' );
$api = new api_components();
$api->ipsclass =& $this->ipsclass;
$fields = array( 'com_enabled' => 1,
'com_menu_data' => array( 0 => array( 'menu_text' => 'Chat Settings',
'menu_url' => 'code=chatsettings',
'menu_permbit' => 'edit' ) ) );
$api->acp_component_update( 'chatpara', $fields );
}
$this->ipsclass->core->redirect( "index.php?act=done&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}",
"$title_deleted_count duplicate setting groups removed and $cnt queries run...." );
}
/*-------------------------------------------------------------------------*/
// INTRO
/*-------------------------------------------------------------------------*/
function upgrade_intro()
{
$this->ipsclass->template->content .= "
Welcome to the IPB Upgrade System
This upgrade module will upgrade you from
{$this->ipsclass->versions[$this->upgrade_from]} to
{$this->ipsclass->versions[$this->this_version]}
This first step will {$this->first_step}
Modules to run after this module: {$this->mod_to_run}
";
if ( ! is_writeable( CACHE_PATH . 'cache/skin_cache' ) )
{
$this->ipsclass->template->content .= "WARNING: cache/skin_cache is not writeable
Please check the CHMOD value on this folder before continuing. Failure to do so could mean that
your skin files will not be installed correctly.
";
}
$this->ipsclass->template->output();
}
}
?>