Vergleich install/upgrade.php - 1.8.38 - 1.8.39

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 287Zeile 287
		$upgradescripts = array();
while(($file = readdir($dh)) !== false)
{

		$upgradescripts = array();
while(($file = readdir($dh)) !== false)
{

			if(preg_match("#upgrade([0-9]+).php$#i", $file, $match))

			if(preg_match("#upgrade(\d+(p\d+)*).php$#i", $file, $match))

			{
$upgradescripts[$match[1]] = $file;
$key_order[] = $match[1];

			{
$upgradescripts[$match[1]] = $file;
$key_order[] = $match[1];

Zeile 303Zeile 303
		// If array is empty then we must be upgrading to 1.6 since that's when this feature was added
if(empty($version_history))
{

		// If array is empty then we must be upgrading to 1.6 since that's when this feature was added
if(empty($version_history))
{

			$next_update_version = 17; // 16+1



			$candidates = array(
17, // 16+1
);

		}
else
{

		}
else
{

			$next_update_version = (int)(end($version_history)+1);

















			$latest_installed = end($version_history);

// Check for standard migrations and old branch patches (1 < 1p1 < 1p2 < 2)
$parts = explode('p', $latest_installed);

$candidates = array(
(string)((int)$parts[0] + 1),
);

if(isset($parts[1]))
{
$candidates[] = $parts[0].'p'.((int)$parts[1] + 1);
}
else
{
$candidates[] = $parts[0].'p1';
}

		}

		}

 



$vers = '';
foreach($key_order as $k => $key)


$vers = '';
foreach($key_order as $k => $key)

		{

		{

			$file = $upgradescripts[$key];
$upgradescript = file_get_contents(INSTALL_ROOT."resources/$file");
preg_match("#Upgrade Script:(.*)#i", $upgradescript, $verinfo);

			$file = $upgradescripts[$key];
$upgradescript = file_get_contents(INSTALL_ROOT."resources/$file");
preg_match("#Upgrade Script:(.*)#i", $upgradescript, $verinfo);

			preg_match("#upgrade([0-9]+).php$#i", $file, $keynum);

			preg_match("#upgrade(\d+(p\d+)*).php$#i", $file, $keynum);

			if(trim($verinfo[1]))
{

			if(trim($verinfo[1]))
{

				if($keynum[1] == $next_update_version)

				if(in_array($keynum[1], $candidates))

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

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

 

$candidates = array();

				}
else
{

				}
else
{

Zeile 331Zeile 352
		}
unset($upgradescripts);
unset($upgradescript);

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





		if(end($version_history) == reset($key_order) && empty($mybb->input['force']))
{
$output->print_contents($lang->upgrade_not_needed);
$output->print_footer("finished");

		if(end($version_history) == reset($key_order) && empty($mybb->input['force']))
{
$output->print_contents($lang->upgrade_not_needed);
$output->print_footer("finished");

		}

		}

		else
{
$output->print_contents($lang->sprintf($lang->upgrade_welcome, $mybb->version)."<p><select name=\"from\">$vers</select>".$lang->upgrade_send_stats);

		else
{
$output->print_contents($lang->sprintf($lang->upgrade_welcome, $mybb->version)."<p><select name=\"from\">$vers</select>".$lang->upgrade_send_stats);

Zeile 345Zeile 366
	}
elseif($mybb->input['action'] == "doupgrade")
{

	}
elseif($mybb->input['action'] == "doupgrade")
{

 
		if(ctype_alnum($mybb->get_input('from')))
{
$from = $mybb->get_input('from');
}
else{
$from = 0;
}


		add_upgrade_store("allow_anonymous_info", $mybb->get_input('allow_anonymous_info', MyBB::INPUT_INT));

		add_upgrade_store("allow_anonymous_info", $mybb->get_input('allow_anonymous_info', MyBB::INPUT_INT));

		require_once INSTALL_ROOT."resources/upgrade".$mybb->get_input('from', MyBB::INPUT_INT).".php";

		require_once INSTALL_ROOT."resources/upgrade".$from.".php";

		if($db->table_exists("datacache") && !empty($upgrade_detail['requires_deactivated_plugins']) && $mybb->get_input('donewarning') != "true")
{
$plugins = $cache->read('plugins', true);
if(!empty($plugins['active']))
{
$output->print_header();

		if($db->table_exists("datacache") && !empty($upgrade_detail['requires_deactivated_plugins']) && $mybb->get_input('donewarning') != "true")
{
$plugins = $cache->read('plugins', true);
if(!empty($plugins['active']))
{
$output->print_header();

				$lang->plugin_warning = "<input type=\"hidden\" name=\"from\" value=\"".$mybb->get_input('from', MyBB::INPUT_INT)."\" />\n<input type=\"hidden\" name=\"donewarning\" value=\"true\" />\n<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 or may break your forum afterward. It is <strong>strongly</strong> reccommended that you deactivate your plugins before continuing.</p></div> <br />";

				$lang->plugin_warning = "<input type=\"hidden\" name=\"from\" value=\"".$from."\" />\n<input type=\"hidden\" name=\"donewarning\" value=\"true\" />\n<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 or may break your forum afterward. It is <strong>strongly</strong> reccommended that you deactivate your plugins before continuing.</p></div> <br />";

				$output->print_contents($lang->sprintf($lang->plugin_warning, $mybb->version));
$output->print_footer("doupgrade");
}
else
{

				$output->print_contents($lang->sprintf($lang->plugin_warning, $mybb->version));
$output->print_footer("doupgrade");
}
else
{

				add_upgrade_store("startscript", $mybb->get_input('from', MyBB::INPUT_INT));
$runfunction = next_function($mybb->get_input('from', MyBB::INPUT_INT));

				add_upgrade_store("startscript", $from);
$runfunction = next_function($from);

			}
}
else
{

			}
}
else
{

			add_upgrade_store("startscript", $mybb->get_input('from', MyBB::INPUT_INT));
$runfunction = next_function($mybb->get_input('from', MyBB::INPUT_INT));

			add_upgrade_store("startscript", $from);
$runfunction = next_function($from);

		}
}
$currentscript = get_upgrade_store("currentscript");

		}
}
$currentscript = get_upgrade_store("currentscript");

Zeile 393Zeile 422
		$bits = explode("_", $mybb->input['action'], 2);
if(!empty($bits[1])) // We're still running a module
{

		$bits = explode("_", $mybb->input['action'], 2);
if(!empty($bits[1])) // We're still running a module
{

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









			if(ctype_alnum($bits[0]))
{
$from = $bits[0];
}
else
{
$from = 0;
}

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


}
}


}
}

Zeile 476Zeile 513

$db->update_query("themes", array("def" => 1), "tid='{$tid}'");
$db->update_query("users", array('style' => $tid));


$db->update_query("themes", array("def" => 1), "tid='{$tid}'");
$db->update_query("users", array('style' => $tid));

		$db->update_query("forums", array('style' => 0));


		$db->update_query("forums", array('style' => 0));


		$db->drop_table("templatesets");
$db->write_query("CREATE TABLE ".TABLE_PREFIX."templatesets (
sid smallint unsigned NOT NULL auto_increment,

		$db->drop_table("templatesets");
$db->write_query("CREATE TABLE ".TABLE_PREFIX."templatesets (
sid smallint unsigned NOT NULL auto_increment,

Zeile 722Zeile 759
/**
* Determine the next function we need to call
*

/**
* Determine the next function we need to call
*

 * @param int $from

 * @param string $from

 * @param string $func
*
* @return string

 * @param string $func
*
* @return string

Zeile 730Zeile 767
function next_function($from, $func="dbchanges")
{
global $oldvers, $system_upgrade_detail, $currentscript, $cache;

function next_function($from, $func="dbchanges")
{
global $oldvers, $system_upgrade_detail, $currentscript, $cache;

 

if(!ctype_alnum($from))
{
$from = 0;
}


load_module("upgrade".$from.".php");
if(function_exists("upgrade".$from."_".$func))


load_module("upgrade".$from.".php");
if(function_exists("upgrade".$from."_".$func))

Zeile 739Zeile 781
	else
{
// We're done with our last upgrade script, so add it to the upgrade scripts we've already completed.

	else
{
// We're done with our last upgrade script, so add it to the upgrade scripts we've already completed.

 
		if (ctype_digit($from)) {
$from = (int)$from;
}


		$version_history = $cache->read("version_history");
$version_history[$from] = $from;
$cache->update("version_history", $version_history);


		$version_history = $cache->read("version_history");
$version_history[$from] = $from;
$cache->update("version_history", $version_history);


		$from = $from+1;
if(file_exists(INSTALL_ROOT."resources/upgrade".$from.".php"))
















		// Check for standard migrations and old branch patches (1 < 1p1 < 1p2 < 2)
$parts = explode('p', $from);

$candidates = array(
(string)((int)$parts[0] + 1),
);

if(isset($parts[1]))
{
$candidates[] = $parts[0].'p'.((int)$parts[1] + 1);
}
else
{
$candidates[] = $parts[0].'p1';
}

foreach($candidates as $candidate)

		{

		{

			$function = next_function($from);





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

		}
}


		}
}