Vergleich install/upgrade.php - 1.2.1 - 1.2.12

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 3
 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html

 *

 *

 * $Id: upgrade.php 2282 2006-09-27 13:34:37Z chris $

 * $Id: upgrade.php 3531 2007-12-02 01:21:43Z chris $

 */
error_reporting(E_ALL & ~E_NOTICE);


 */
error_reporting(E_ALL & ~E_NOTICE);


define("MYBB_ROOT", dirname(dirname(__FILE__)));

define('MYBB_ROOT', dirname(dirname(__FILE__))."/");

define("INSTALL_ROOT", dirname(__FILE__));

define("INSTALL_ROOT", dirname(__FILE__));

 
define('IN_MYBB', 1);





require_once MYBB_ROOT."/inc/class_core.php";

require_once MYBB_ROOT."inc/class_core.php";

$mybb = new MyBB;

// Include the files necessary for installation

$mybb = new MyBB;

// Include the files necessary for installation

require_once MYBB_ROOT."/inc/class_timers.php";
require_once MYBB_ROOT."/inc/functions.php";
require_once MYBB_ROOT."/inc/class_xml.php";
require_once MYBB_ROOT."/inc/config.php";
require_once MYBB_ROOT."/inc/db_".$config['dbtype'].".php";
require_once MYBB_ROOT.'/inc/class_language.php';

require_once MYBB_ROOT."inc/class_timers.php";
require_once MYBB_ROOT."inc/functions.php";
require_once MYBB_ROOT."inc/class_xml.php";
require_once MYBB_ROOT."inc/config.php";
require_once MYBB_ROOT."inc/db_".$config['dbtype'].".php";
require_once MYBB_ROOT.'inc/class_language.php';

$lang = new MyLanguage();

$lang = new MyLanguage();

$lang->set_path('resources/');

$lang->set_path(MYBB_ROOT.'install/resources/');

$lang->load('language');

// If there's a custom admin dir, use it.

$lang->load('language');

// If there's a custom admin dir, use it.

Zeile 32Zeile 33
// Legacy for those boards trying to upgrade from an older version
if(isset($config['admindir']))
{

// Legacy for those boards trying to upgrade from an older version
if(isset($config['admindir']))
{

	require_once MYBB_ROOT."/".$config['admindir']."/adminfunctions.php";

	require_once MYBB_ROOT.$config['admindir']."/adminfunctions.php";

}
// Current
else if(isset($config['admin_dir']))
{

}
// Current
else if(isset($config['admin_dir']))
{

	require_once MYBB_ROOT."/".$config['admin_dir']."/adminfunctions.php";

	require_once MYBB_ROOT.$config['admin_dir']."/adminfunctions.php";

}
// No custom set
else
{

}
// No custom set
else
{

	require_once MYBB_ROOT."/admin/adminfunctions.php";

	require_once MYBB_ROOT."admin/adminfunctions.php";

}

// Include the necessary contants for installation

}

// Include the necessary contants for installation

Zeile 55Zeile 56
require_once INSTALL_ROOT."/resources/output.php";
$output = new installerOutput;
$output->script = "upgrade.php";

require_once INSTALL_ROOT."/resources/output.php";
$output = new installerOutput;
$output->script = "upgrade.php";

 
$output->title = "MyBB Upgrade Wizard";


$db = new databaseEngine;
// Connect to Database


$db = new databaseEngine;
// Connect to Database

Zeile 76Zeile 78
	{
if($db->table_exists(TABLE_PREFIX."datacache"))
{

	{
if($db->table_exists(TABLE_PREFIX."datacache"))
{

			require_once MYBB_ROOT."/inc/class_datacache.php";

			require_once MYBB_ROOT."inc/class_datacache.php";

			$cache = new datacache;
$plugins = $cache->read('plugins', true);
if(!empty($plugins['active']))

			$cache = new datacache;
$plugins = $cache->read('plugins', true);
if(!empty($plugins['active']))

Zeile 119Zeile 121
					$vers .= "<option value=\"$keynum[1]\">$verinfo[1]</option>\n";
}
}

					$vers .= "<option value=\"$keynum[1]\">$verinfo[1]</option>\n";
}
}

 


		}
unset($upgradescripts);
unset($upgradescript);

		}
unset($upgradescripts);
unset($upgradescript);

Zeile 135Zeile 138
	$system_upgrade_detail = get_upgrade_store("upgradedetail");

if($mybb->input['action'] == "templates")

	$system_upgrade_detail = get_upgrade_store("upgradedetail");

if($mybb->input['action'] == "templates")

	{

	{

		$runfunction = "upgradethemes";

		$runfunction = "upgradethemes";

	}

	}

	elseif($mybb->input['action'] == "rebuildsettings")
{
$runfunction = "buildsettings";

	elseif($mybb->input['action'] == "rebuildsettings")
{
$runfunction = "buildsettings";

	}

	}

	elseif($mybb->input['action'] == "buildcaches")

	elseif($mybb->input['action'] == "buildcaches")

	{

	{

		$runfunction = "buildcaches";
}
elseif($mybb->input['action'] == "finished")

		$runfunction = "buildcaches";
}
elseif($mybb->input['action'] == "finished")

	{

	{

		$runfunction = "upgradedone";
}
else // Busy running modules, come back later

		$runfunction = "upgradedone";
}
else // Busy running modules, come back later

Zeile 159Zeile 162
			$runfunction = next_function($bits[0], $bits[1]);

}

			$runfunction = next_function($bits[0], $bits[1]);

}

	}

	}

	// Fetch current script we're in

	// Fetch current script we're in





	if(function_exists($runfunction))
{
$runfunction();

	if(function_exists($runfunction))
{
$runfunction();

	}
}


	}
}


function upgradethemes()
{
global $output, $db, $system_upgrade_detail, $lang;

function upgradethemes()
{
global $output, $db, $system_upgrade_detail, $lang;





	$output->print_header($lang->upgrade_templates_reverted);

if($system_upgrade_detail['revert_all_templates'] > 0)

	$output->print_header($lang->upgrade_templates_reverted);

if($system_upgrade_detail['revert_all_templates'] > 0)

	{

	{

		$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."templates;");
$db->query("CREATE TABLE ".TABLE_PREFIX."templates (
tid int unsigned NOT NULL auto_increment,
title varchar(120) NOT NULL default '',
template text NOT NULL,
sid int(10) NOT NULL default '0',

		$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."templates;");
$db->query("CREATE TABLE ".TABLE_PREFIX."templates (
tid int unsigned NOT NULL auto_increment,
title varchar(120) NOT NULL default '',
template text NOT NULL,
sid int(10) NOT NULL default '0',

		  version varchar(20) NOT NULL default '0',

		  version int unsigned NOT NULL default '0',

		  status varchar(10) NOT NULL default '',
dateline int(10) NOT NULL default '0',
PRIMARY KEY (tid)
) TYPE=MyISAM;");
}

		  status varchar(10) NOT NULL default '',
dateline int(10) NOT NULL default '0',
PRIMARY KEY (tid)
) TYPE=MyISAM;");
}





	if($system_upgrade_detail['revert_all_themes'] > 0)
{
$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."themes");

	if($system_upgrade_detail['revert_all_themes'] > 0)
{
$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."themes");

Zeile 197Zeile 200
		  name varchar(100) NOT NULL default '',
pid smallint unsigned NOT NULL default '0',
def smallint(1) NOT NULL default '0',

		  name varchar(100) NOT NULL default '',
pid smallint unsigned NOT NULL default '0',
def smallint(1) NOT NULL default '0',

		  css text NOT NULL default '',
cssbits text NOT NULL default '',
themebits text NOT NULL default '',
extracss text NOT NULL default '',
allowedgroups text NOT NULL default '',

		  css text NOT NULL,
cssbits text NOT NULL,
themebits text NOT NULL,
extracss text NOT NULL,
allowedgroups text NOT NULL,

		  csscached bigint(30) NOT NULL default '0',
PRIMARY KEY (tid)
) TYPE=MyISAM;");

		  csscached bigint(30) NOT NULL default '0',
PRIMARY KEY (tid)
) TYPE=MyISAM;");

		$db->query("INSERT INTO ".TABLE_PREFIX."themes (name,pid) VALUES ('MyBB Master Style','0')");
$db->query("INSERT INTO ".TABLE_PREFIX."themes (name,pid,def) VALUES ('MyBB Default','1','1')");
























$insert_array = array(
'name' => 'MyBB Master Style',
'pid' => 0,
'css' => '',
'cssbits' => '',
'themebits' => '',
'extracss' => '',
'allowedgroups' => ''
);
$db->insert_query(TABLE_PREFIX."themes", $insert_array);

$insert_array = array(
'name' => 'MyBB Default',
'pid' => 1,
'def' => 1,
'css' => '',
'cssbits' => '',
'themebits' => '',
'extracss' => '',
'allowedgroups' => ''
);
$db->insert_query(TABLE_PREFIX."themes", $insert_array);


		$sid = $db->insert_id();
$db->query("UPDATE ".TABLE_PREFIX."users SET style='$sid'");
$db->query("UPDATE ".TABLE_PREFIX."forums SET style='0'");

		$sid = $db->insert_id();
$db->query("UPDATE ".TABLE_PREFIX."users SET style='$sid'");
$db->query("UPDATE ".TABLE_PREFIX."forums SET style='0'");

Zeile 235Zeile 260
	foreach($templates as $template)
{
$templatename = $template['attributes']['name'];

	foreach($templates as $template)
{
$templatename = $template['attributes']['name'];

		$templateversion = $template['attributes']['version'];

		$templateversion = intval($template['attributes']['version']);

		$templatevalue = $db->escape_string($template['value']);
$time = time();
$query = $db->query("SELECT tid FROM ".TABLE_PREFIX."templates WHERE sid='-2' AND title='$templatename'");

		$templatevalue = $db->escape_string($template['value']);
$time = time();
$query = $db->query("SELECT tid FROM ".TABLE_PREFIX."templates WHERE sid='-2' AND title='$templatename'");

Zeile 259Zeile 284
{
global $db, $output, $system_upgrade_detail, $lang;


{
global $db, $output, $system_upgrade_detail, $lang;


	if(!is_writable(MYBB_ROOT."/inc/settings.php"))

	if(!is_writable(MYBB_ROOT."inc/settings.php"))

	{
$output->print_header("Rebuilding Settings");
echo "<p><div class=\"error\"><span style=\"color: red; font-weight: bold;\">Error: Unable to open inc/settings.php</span><h3>Before the upgrade process can continue, you need to changes the permissions of inc/settings.php so it is writable.</h3></div></p>";

	{
$output->print_header("Rebuilding Settings");
echo "<p><div class=\"error\"><span style=\"color: red; font-weight: bold;\">Error: Unable to open inc/settings.php</span><h3>Before the upgrade process can continue, you need to changes the permissions of inc/settings.php so it is writable.</h3></div></p>";

Zeile 280Zeile 305
	$output->print_header($lang->upgrade_datacache_building);

$contents .= $lang->upgrade_building_datacache;

	$output->print_header($lang->upgrade_datacache_building);

$contents .= $lang->upgrade_building_datacache;

	require_once MYBB_ROOT."/inc/class_datacache.php";

	require_once MYBB_ROOT."inc/class_datacache.php";

	$cache = new datacache;
$cache->updateversion();
$cache->updateattachtypes();

	$cache = new datacache;
$cache->updateversion();
$cache->updateattachtypes();

Zeile 321Zeile 346
	{
$lock_note = "<p><b><span style=\"color: red;\">".$lang->upgrade_removedir."</span></b></p>";
}

	{
$lock_note = "<p><b><span style=\"color: red;\">".$lang->upgrade_removedir."</span></b></p>";
}

 


	$output->print_contents(sprintf($lang->upgrade_congrats, $mybb->version, $lock_note));
$output->print_footer();
}

	$output->print_contents(sprintf($lang->upgrade_congrats, $mybb->version, $lock_note));
$output->print_footer();
}

Zeile 371Zeile 397
	global $system_upgrade_detail, $currentscript;
require_once INSTALL_ROOT."/resources/".$module;
if($currentscript != $module)

	global $system_upgrade_detail, $currentscript;
require_once INSTALL_ROOT."/resources/".$module;
if($currentscript != $module)

	{

	{

		foreach($upgrade_detail as $key => $val)
{
if(!$system_upgrade_detail[$key] || $val > $system_upgrade_detail[$key])

		foreach($upgrade_detail as $key => $val)
{
if(!$system_upgrade_detail[$key] || $val > $system_upgrade_detail[$key])

Zeile 385Zeile 411
}

function get_upgrade_store($title)

}

function get_upgrade_store($title)

{
global $db;

{
global $db;

	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."upgrade_data WHERE title='".$db->escape_string($title)."'");
$data = $db->fetch_array($query);
return unserialize($data['contents']);

	$query = $db->query("SELECT * FROM ".TABLE_PREFIX."upgrade_data WHERE title='".$db->escape_string($title)."'");
$data = $db->fetch_array($query);
return unserialize($data['contents']);

}

}


function add_upgrade_store($title, $contents)
{


function add_upgrade_store($title, $contents)
{

Zeile 410Zeile 436
		  gid smallint unsigned NOT NULL auto_increment,
name varchar(100) NOT NULL default '',
title varchar(220) NOT NULL default '',

		  gid smallint unsigned NOT NULL auto_increment,
name varchar(100) NOT NULL default '',
title varchar(220) NOT NULL default '',

		  description text NOT NULL default '',

		  description text NOT NULL,

		  disporder smallint unsigned NOT NULL default '0',
isdefault char(3) NOT NULL default '',
PRIMARY KEY (gid)

		  disporder smallint unsigned NOT NULL default '0',
isdefault char(3) NOT NULL default '',
PRIMARY KEY (gid)

Zeile 497Zeile 523
	}
if($redo >= 1)
{

	}
if($redo >= 1)
{

		require MYBB_ROOT."/inc/settings.php";

		require MYBB_ROOT."inc/settings.php";

		foreach($settings as $key => $val)
{
$db->update_query(TABLE_PREFIX."settings", array('value' => $db->escape_string($val)), "name='$key'");

		foreach($settings as $key => $val)
{
$db->update_query(TABLE_PREFIX."settings", array('value' => $db->escape_string($val)), "name='$key'");

Zeile 511Zeile 537
		$settings .= "\$settings['{$setting['name']}'] = \"".$setting['value']."\";\n";
}
$settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?>";

		$settings .= "\$settings['{$setting['name']}'] = \"".$setting['value']."\";\n";
}
$settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?>";

	$file = fopen(MYBB_ROOT."/inc/settings.php", "w");

	$file = fopen(MYBB_ROOT."inc/settings.php", "w");

	fwrite($file, $settings);
fclose($file);
return array($groupcount, $settingcount);

	fwrite($file, $settings);
fclose($file);
return array($groupcount, $settingcount);

Zeile 519Zeile 545

function write_settings()
{


function write_settings()
{

	global $db, $cwd;

	global $db;

	$query = $db->query('SELECT * FROM '.TABLE_PREFIX.'settings ORDER BY title ASC');
while($setting = $db->fetch_array($query))
{

	$query = $db->query('SELECT * FROM '.TABLE_PREFIX.'settings ORDER BY title ASC');
while($setting = $db->fetch_array($query))
{

Zeile 529Zeile 555
	if(!empty($settings))
{
$settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n{$settings}\n?>";

	if(!empty($settings))
{
$settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n{$settings}\n?>";

		$file = fopen(MYBB_ROOT."/inc/settings.php", "w");

		$file = fopen(MYBB_ROOT."inc/settings.php", "w");

		fwrite($file, $settings);
fclose($file);
}

		fwrite($file, $settings);
fclose($file);
}