Vergleich install/upgrade.php - 1.2.0 - 1.2.7

  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 2191 2006-09-03 12:11:04Z chris $

 * $Id: upgrade.php 3005 2007-04-11 04:37:20Z Tikitiki $

 */
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 74Zeile 76

if(!$mybb->input['action'] || $mybb->input['action'] == "intro")
{


if(!$mybb->input['action'] || $mybb->input['action'] == "intro")
{

 
		if($db->table_exists(TABLE_PREFIX."datacache"))
{
require_once MYBB_ROOT."inc/class_datacache.php";
$cache = new datacache;
$plugins = $cache->read('plugins', true);
if(!empty($plugins['active']))
{
$lang->upgrade_welcome = "<div class=\"error\"><strong><span style=\"color: red\">Warning:</span></strong> <p>There are still ".count($plugins['active'])." plugin(s) active. Active plugins can sometimes cause problems during an upgrade procedure.</p></div> <br />".$lang->upgrade_welcome;
}
}


		$output->print_header();

$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."upgrade_data");

		$output->print_header();

$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."upgrade_data");

Zeile 82Zeile 95
			contents text NOT NULL,
PRIMARY KEY(title)
);");

			contents text NOT NULL,
PRIMARY KEY(title)
);");





		$dh = opendir(INSTALL_ROOT."/resources");
while(($file = readdir($dh)) !== false)
{

		$dh = opendir(INSTALL_ROOT."/resources");
while(($file = readdir($dh)) !== false)
{

Zeile 108Zeile 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 174Zeile 188
		  version varchar(20) NOT NULL default '0',
status varchar(10) NOT NULL default '',
dateline int(10) NOT NULL default '0',

		  version varchar(20) NOT NULL default '0',
status varchar(10) NOT NULL default '',
dateline int(10) NOT NULL default '0',

		  PRIMARY KEY  (tid)
) TYPE=MyISAM;");
}

		  PRIMARY KEY  (tid)
) TYPE=MyISAM;");
}


if($system_upgrade_detail['revert_all_themes'] > 0)
{


if($system_upgrade_detail['revert_all_themes'] > 0)
{

Zeile 186Zeile 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 232Zeile 268
		if($oldtemp['tid'])
{
$db->query("UPDATE ".TABLE_PREFIX."templates SET template='$templatevalue', version='$templateversion', dateline='$time' WHERE title='$templatename' AND sid='-2'");

		if($oldtemp['tid'])
{
$db->query("UPDATE ".TABLE_PREFIX."templates SET template='$templatevalue', version='$templateversion', dateline='$time' WHERE title='$templatename' AND sid='-2'");

		}
else
{

		}
else
{

			$db->query("INSERT INTO ".TABLE_PREFIX."templates (title,template,sid,version,status,dateline) VALUES ('$templatename','$templatevalue','$sid','$templateversion','','$time')");
$newcount++;
}
}
update_theme(1, 0, $themebits, $css, 0);

			$db->query("INSERT INTO ".TABLE_PREFIX."templates (title,template,sid,version,status,dateline) VALUES ('$templatename','$templatevalue','$sid','$templateversion','','$time')");
$newcount++;
}
}
update_theme(1, 0, $themebits, $css, 0);

	$output->print_contents(sprintf($lang->upgrade_template_reverted_success, $synccount[1], $synccount[0]));

	$output->print_contents($lang->upgrade_templates_reverted_success);

	$output->print_footer("rebuildsettings");

	$output->print_footer("rebuildsettings");

}


}


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


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


 
	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_footer("rebuildsettings");
exit;
}

	$synccount = sync_settings($system_upgrade_detail['revert_all_settings']);

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

	$synccount = sync_settings($system_upgrade_detail['revert_all_settings']);

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

Zeile 262Zeile 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 287Zeile 330
function upgradedone()
{
global $db, $output, $mybb, $lang, $config;

function upgradedone()
{
global $db, $output, $mybb, $lang, $config;





	$output->print_header("Upgrade Complete");
if(is_writable("./"))
{

	$output->print_header("Upgrade Complete");
if(is_writable("./"))
{

Zeile 300Zeile 343
		}
}
if(!$written)

		}
}
if(!$written)

	{

	{

		$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));

		$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));

Zeile 338Zeile 381
		if(file_exists(INSTALL_ROOT."/resources/upgrade".$from.".php"))
{
$function = next_function($from);

		if(file_exists(INSTALL_ROOT."/resources/upgrade".$from.".php"))
{
$function = next_function($from);

		}

		}

	}

if(!$function)

	}

if(!$function)

Zeile 383Zeile 426
function sync_settings($redo=0)
{
global $db;

function sync_settings($redo=0)
{
global $db;

 
	

	$settingcount = $groupcount = 0;
if($redo == 2)
{

	$settingcount = $groupcount = 0;
if($redo == 2)
{

		$db->query("DROP TABLE ".TABLE_PREFIX."settinggroups");

		$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."settinggroups");

		$db->query("CREATE TABLE ".TABLE_PREFIX."settinggroups (
gid smallint unsigned NOT NULL auto_increment,
name varchar(100) NOT NULL default '',
title varchar(220) NOT NULL default '',

		$db->query("CREATE TABLE ".TABLE_PREFIX."settinggroups (
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)
) TYPE=MyISAM;");


		  disporder smallint unsigned NOT NULL default '0',
isdefault char(3) NOT NULL default '',
PRIMARY KEY (gid)
) TYPE=MyISAM;");


		$db->query("DROP TABLE ".TABLE_PREFIX."settings");

		$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."settings");


$db->query("CREATE TABLE ".TABLE_PREFIX."settings (
sid smallint(6) NOT NULL auto_increment,


$db->query("CREATE TABLE ".TABLE_PREFIX."settings (
sid smallint(6) NOT NULL auto_increment,

Zeile 438Zeile 482
			"disporder" => intval($settinggroup['attributes']['disporder']),
"isdefault" => $settinggroup['attributes']['isdefault']
);

			"disporder" => intval($settinggroup['attributes']['disporder']),
"isdefault" => $settinggroup['attributes']['isdefault']
);

		if(!$settinggroups[$settinggroup['attributes']['key']] || $redo == 2)

		if(!$settinggroups[$settinggroup['attributes']['name']] || $redo == 2)

		{
$db->insert_query(TABLE_PREFIX."settinggroups", $groupdata);
$gid = $db->insert_id();

		{
$db->insert_query(TABLE_PREFIX."settinggroups", $groupdata);
$gid = $db->insert_id();

Zeile 447Zeile 491
		else
{
$gid = $settinggroups[$settinggroup['attributes']['name']];

		else
{
$gid = $settinggroups[$settinggroup['attributes']['name']];

			$db->insert_query(TABLE_PREFIX."settinggroups", $groupdata, "gid='{$gid}");

			$db->update_query(TABLE_PREFIX."settinggroups", $groupdata, "gid='{$gid}'");

		}
if(!$gid)
{

		}
if(!$gid)
{

Zeile 478Zeile 522
	}
if($redo >= 1)
{

	}
if($redo >= 1)
{

		require_once 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 489Zeile 533
	while($setting = $db->fetch_array($query))
{
$setting['value'] = str_replace("\"", "\\\"", $setting['value']);

	while($setting = $db->fetch_array($query))
{
$setting['value'] = str_replace("\"", "\\\"", $setting['value']);

		$settings .= "\$settings[".$setting['name']."] = \"".$setting['value']."\";\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?>";

	}
$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 500Zeile 544

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 510Zeile 554
	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);
}