Vergleich install/resources/upgrade13.php - 1.4.2 - 1.4.7

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 31Zeile 31
	echo "<p>Performing necessary upgrade queries..</p>";
flush();


	echo "<p>Performing necessary upgrade queries..</p>";
flush();


	$db->write_query("ALTER TABLE ".TABLE_PREFIX."adminsessions ADD INDEX ( `uid` )");
$db->write_query("ALTER TABLE ".TABLE_PREFIX."adminsessions ADD INDEX ( `dateline` )");

$query = $db->query("SHOW INDEX FROM ".TABLE_PREFIX."users");
while($ukey = $db->fetch_array($query))
{
if($ukey['Key_name'] == "username")


















	if($db->type == "mysql" || $db->type == "mysqli")
{
$db->write_query("ALTER TABLE ".TABLE_PREFIX."adminsessions ADD INDEX ( `uid` )");
$db->write_query("ALTER TABLE ".TABLE_PREFIX."adminsessions ADD INDEX ( `dateline` )");
}

if($db->type != "sqlite2" && $db->type != "sqlite3")
{
if($db->index_exists("users", "username"))
{
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP KEY username");
}

$query = $db->simple_select("users", "username, uid", "1=1 GROUP BY username HAVING count(*) > 1");
while($user = $db->fetch_array($query))
{
$db->update_query("users", array('username' => $user['username']."_dup".$user['uid']), "uid='{$user['uid']}'", 1);
}

if($db->type == "pgsql")
{
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users ADD UNIQUE(username)");
}
else

		{

		{

			$index = $ukey;
break;

			$db->write_query("ALTER TABLE ".TABLE_PREFIX."users ADD UNIQUE KEY username (username)");


		}

		}

	}
if($index)









	}

if($db->type == "pgsql")
{
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users CHANGE longregip longregip int NOT NULL default '0'");
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users CHANGE longlastip longlastip int NOT NULL default '0'");

$db->write_query("ALTER TABLE ".TABLE_PREFIX."posts CHANGE longipaddress longipaddress int NOT NULL default '0'");
}
else

	{

	{

		$db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP KEY username");
}
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users ADD UNIQUE KEY username (username)");

		$db->write_query("ALTER TABLE ".TABLE_PREFIX."users CHANGE longregip longregip int(11) NOT NULL default '0'");
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users CHANGE longlastip longlastip int(11) NOT NULL default '0'");


	

	

	$db->write_query("ALTER TABLE ".TABLE_PREFIX."users CHANGE longregip longregip int(11) NOT NULL default '0'");
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users CHANGE longlastip longlastip int(11) NOT NULL default '0'");

$db->write_query("ALTER TABLE ".TABLE_PREFIX."posts CHANGE longipaddress longipaddress int(11) NOT NULL default '0'");

		$db->write_query("ALTER TABLE ".TABLE_PREFIX."posts CHANGE longipaddress longipaddress int(11) NOT NULL default '0'");
}




$contents .= "Click next to continue with the upgrade process.</p>";
$output->print_contents($contents);


$contents .= "Click next to continue with the upgrade process.</p>";
$output->print_contents($contents);