268 lines
8.6 KiB
PHP
268 lines
8.6 KiB
PHP
<?php
|
|
|
|
/*
|
|
+--------------------------------------------------------------------------
|
|
| Invision Power Board v<{%dyn.down.var.human.version%}>
|
|
| ========================================
|
|
| by Matthew Mecham
|
|
| (c) 2001 - 2004 Invision Power Services
|
|
| http://www.invisionpower.com
|
|
| ========================================
|
|
| Web: http://www.invisionboard.com
|
|
| Time: <{%dyn.down.var.time%}>
|
|
| Release: <{%dyn.down.var.md5%}>
|
|
| Email: matt@invisionpower.com
|
|
| Licence Info: http://www.invisionboard.com/?license
|
|
+---------------------------------------------------------------------------
|
|
|
|
|
| > IPB UPGRADE MODULE:: IPB 2.1.2 -> 2.1.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 "<h1>Incorrect access</h1>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 = '21009';
|
|
var $upgrade_from = '21008';
|
|
var $first_step = 'update your database to include the new schematic';
|
|
var $md5_check = '';
|
|
var $base_url = '';
|
|
var $mod_to_run = '';
|
|
var $error = array();
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// 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;
|
|
case 'cal':
|
|
$this->upgrade_cal();
|
|
break;
|
|
case 'helpfiles':
|
|
$this->upgrade_helpfiles();
|
|
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 );
|
|
|
|
$this->ipsclass->DB->return_die = 1;
|
|
|
|
foreach( $SQL as $q )
|
|
{
|
|
$q = str_replace( "<%time%>", time(), $q );
|
|
|
|
$this->ipsclass->DB->query( $q );
|
|
|
|
if ( $this->ipsclass->DB->error )
|
|
{
|
|
$this->error[] = $this->ipsclass->DB->error;
|
|
}
|
|
else
|
|
{
|
|
$cnt++;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( count($this->error) )
|
|
{
|
|
$this->ipsclass->core->show_error( implode( "<br />", $this->error ), "work&workact=cal" );
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->core->redirect( "{$this->base_url}&workact=cal",
|
|
"$cnt queries run...." );
|
|
}
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Update Old Calendar Events
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function upgrade_cal()
|
|
{
|
|
$cnt = 0;
|
|
$outer = $this->ipsclass->DB->query( "SELECT * FROM ibf_cal_events ORDER BY event_id ASC" );
|
|
if( $this->ipsclass->DB->get_num_rows($outer) )
|
|
{
|
|
while( $event = $this->ipsclass->DB->fetch_row( $outer ) )
|
|
{
|
|
if( $event['event_tz'] )
|
|
{
|
|
$this->ipsclass->DB->do_update( "cal_events", array( 'event_tz' => 0 ), "event_id='{$event['event_id']}'" );
|
|
$cnt++;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->ipsclass->core->redirect( "{$this->base_url}&workact=helpfiles",
|
|
"$cnt calendar events updated...." );
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Update help files
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function upgrade_helpfiles()
|
|
{
|
|
if(! $this->ipsclass->input['do_update'] )
|
|
{
|
|
$this->ipsclass->template->content .= "
|
|
<div class='tableborder'>
|
|
<div class='maintitle'>Do you wish to update your help files?</div>
|
|
<div class='tdrow1' style='padding:6px'>Some of the help files have changed from previous versions. If you are running a board that has been upgraded from a version prior to 2.1.0, you may optionally wish
|
|
to update your help files to reflect changes in the location of certain configuration settings and board features. If you have customized your help files, proceeding with this step WILL overwrite
|
|
those changes. This step will update the first 16 help files in your database, and the changes can not be undone. If you have not customized the default help files and/or you would like to update them now,
|
|
proceed with this step. Otherwise skip this step.
|
|
<br /><br /><b>Do you wish to update your help files at this time?</b>
|
|
<div align='left'><blockquote><span style='font-weight:bold;font-size:14px'>» <a href='{$this->base_url}&workact=helpfiles&do_update=1'>Upgrade Help Files ...</a><br />
|
|
» <a href='index.php?act=done&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}'>Skip This Step ...</a></span></blockquote></div>
|
|
";
|
|
$this->ipsclass->template->output();
|
|
}
|
|
else
|
|
{
|
|
$man = intval( $this->ipsclass->input['man'] );
|
|
$UPDATES = 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 );
|
|
|
|
$this->ipsclass->DB->return_die = 1;
|
|
|
|
foreach( $UPDATES as $q )
|
|
{
|
|
$this->ipsclass->DB->query( $q );
|
|
|
|
if ( $this->ipsclass->DB->error )
|
|
{
|
|
$this->error[] = $this->ipsclass->DB->error;
|
|
}
|
|
else
|
|
{
|
|
$cnt++;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ( count($this->error) )
|
|
{
|
|
$this->ipsclass->core->show_error( implode( "<br />", $this->error ), "done" );
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->core->redirect( "index.php?act=done&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}",
|
|
"$cnt help files updated...." );
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// INTRO
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function upgrade_intro()
|
|
{
|
|
$this->ipsclass->template->content .= "
|
|
<div class='tableborder'>
|
|
<div class='maintitle'>Welcome to the IPB Upgrade System</div>
|
|
<div class='tdrow1' style='padding:6px'>This upgrade module will upgrade you from <b>{$this->ipsclass->versions[$this->upgrade_from]}</b> to <b>{$this->ipsclass->versions[$this->this_version]}</b>
|
|
<br /><br />This first step will {$this->first_step}
|
|
<br />
|
|
";
|
|
|
|
if ( ! is_writeable( CACHE_PATH . 'cache/skin_cache' ) )
|
|
{
|
|
$this->ipsclass->template->content .= "<div class='warnbox'><strong>WARNING: cache/skin_cache is not writeable</strong><br />
|
|
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.</div>";
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->template->content .= "<div align='center'><span style='font-weight:bold;font-size:14px'>» <a href='{$this->base_url}&workact=sql'>Proceed ...</a></span></div>
|
|
</div>
|
|
</div>
|
|
<br />
|
|
<div align='center'>Modules to run after this module: {$this->mod_to_run}</div>";
|
|
}
|
|
|
|
$this->ipsclass->template->output();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
?>
|