SMF'te yardımcı yazarı olduğum bir modifikasyon için bir script yazıyorum, daha doğrusu yazmaya çalışıyorum . Script ID_MEMBER, ID_COMMENT vb. sütun isimlerini küçültüyor, yani id_member, id_comment vs. yapıyor. Herşey harika çalışıyor, tek sorun MySQL komutunu çalıştırmıyor :/
Kodlar:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Handle running this file by using SSI.php
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) 
	require_once(dirname(__FILE__) . '/SSI.php');
// Hmm... no SSI.php and no SMF?
elseif (!defined('SMF'))
	die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');

// Make sure that we have the package database functions.
if (!array_key_exists('db_add_column', $smcFunc))
	db_extend('Packages');

// The array holding all the changes.
$nameChanges = array(
	'profile_comments' => array(
		'ID_COMMENT' => '`ID_COMMENT` `id_comment` int(11) NOT NULL auto_increment',
		'ID_MEMBER' => '`ID_MEMBER` `id_member` mediumint(8) unsigned NOT NULL default `0`',
		'COMMENT_MEMBER_ID' => '`COMMENT_MEMBER_ID` `comment_member_id` mediumint(8) unsigned NOT NULL default `0`',
	),
	'profile_pictures' => array(
		'ID_PICTURE' => '`ID_PICTURE` `id_picture` int(11) NOT NULL auto_increment',
		'ID_MEMBER' => '`ID_MEMBER` `id_member` mediumint(8) NOT NULL default `0`',
		'ID_ALBUM' => '`ID_ALBUM` `id_album` int(11) NOT NULL default `0`',
	),
	'picture_comments' => array(
		'ID_COMMENT' => '`ID_COMMENT` `id_comment` int(11) NOT NULL auto_increment',
		'ID_MEMBER' => '`ID_MEMBER` `id_member` mediumint(8) NOT NULL default `0`',
		'COMMENT_PICTURE_ID' => '`COMMENT_PICTURE_ID` `comment_picture_id mediumint(8) NOT NULL default `0`',
	),
	'profile_albums' => array(
		'ID_ALBUM' => '`ID_ALBUM` `id_album` int(11) NOT NULL auto_increment',
		'ID_MEMBER' => '`ID_MEMBER` `id_member` mediumint(8) NOT NULL default `0`',
		'PARENT_ID' => '`PARENT_ID` `parent_id` int(11) NOT NULL default `0`',
	),
	'buddies' => array(
		'ID_MEMBER' => '`ID_MEMBER` `id_member` mediumint(8) NOT NULL default `0`',
		'BUDDY_ID' => '`BUDDY_ID` `buddy_id` mediumint(8) NOT NULL default `0`',
	),
);

$changes = array();
$changes[] = '
	<h1>Updating tables:</h1>
	<ul>';
foreach ($nameChanges as $table_name => $table)
{
	$table_name = $db_prefix . $table_name;
	$changes[] = '
		<li>Updating table: ' .$table_name . '
			<ul>';

	foreach ($table as $colname => $coldef)
	{
		$request = $smcFunc['db_query']('', '
			ALTER TABLE ' . $table_name . '
			CHANGE COLUMN ' . $coldef);
		$changes[] = '
				<li>' . $colname . ' updated</li>';
	}
	
	$changes[] = '
			</ul>';
	$changes[] = '
		</li>';
}
$changes[] = '
	</ul>';
	echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head><title>Ultimate Profile</title></head>
	<body>';
/* 	echo '<pre>';
	print_r($changes);
	echo '</pre>'; */
	foreach ($changes as $change)
		echo $change;
	echo '
	</body>
	</html>';
?>