mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 03:54:10 +01:00
git-svn-id: file:///svn/phpbb/trunk@7839 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
f88d8bf526
commit
6aeedc4507
@ -632,36 +632,44 @@ if (version_compare($current_version, '3.0.RC1', '<='))
|
||||
|
||||
if (version_compare($current_version, '3.0.RC2', '<='))
|
||||
{
|
||||
$smileys = array();
|
||||
$sql = 'SELECT smiley_id, code
|
||||
FROM ' . SMILIES_TABLE;
|
||||
|
||||
$smileys = array();
|
||||
$sql = 'SELECT smiley_id, code
|
||||
FROM ' . SMILIES_TABLE;
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$smileys[$row['smiley_id']] = $row['code'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
foreach($smileys as $id => $code)
|
||||
{
|
||||
// 2.0 only entitized lt and gt; We need to do something about double quotes.
|
||||
if (strchr($code, '"') === false)
|
||||
{
|
||||
$smileys[$row['smiley_id']] = $row['code'];
|
||||
continue;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
foreach($smileys as $id => $code)
|
||||
{
|
||||
// 2.0 only entitized lt and gt; We need to do something about double quotes.
|
||||
if (strchr($code, '"') === false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$new_code = str_replace('&', '&', $code);
|
||||
$new_code = str_replace('<', '<', $new_code);
|
||||
$new_code = str_replace('>', '>', $new_code);
|
||||
$new_code = utf8_htmlspecialchars($new_code);
|
||||
$sql = 'UPDATE ' . SMILIES_TABLE . '
|
||||
SET code = \'' . $db->sql_escape($new_code) . '\'
|
||||
WHERE smiley_id = ' . (int)$id;
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
$no_updates = false;
|
||||
$new_code = str_replace('&', '&', $code);
|
||||
$new_code = str_replace('<', '<', $new_code);
|
||||
$new_code = str_replace('>', '>', $new_code);
|
||||
$new_code = utf8_htmlspecialchars($new_code);
|
||||
$sql = 'UPDATE ' . SMILIES_TABLE . '
|
||||
SET code = \'' . $db->sql_escape($new_code) . '\'
|
||||
WHERE smiley_id = ' . (int)$id;
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$index_list = sql_list_index($map_dbms, ACL_ROLES_DATA_TABLE);
|
||||
|
||||
if (in_array('ath_opt_id', $index))
|
||||
{
|
||||
sql_index_drop($map_dbms, 'ath_opt_id', ACL_ROLES_DATA_TABLE);
|
||||
sql_create_index($map_dbms, 'ath_op_id', ACL_ROLES_DATA_TABLE, array('auth_option_id'));
|
||||
}
|
||||
|
||||
$no_updates = false;
|
||||
}
|
||||
|
||||
_write_result($no_updates, $errored, $error_ary);
|
||||
@ -1381,6 +1389,86 @@ function sql_create_index($dbms, $index_name, $table_name, $column)
|
||||
}
|
||||
}
|
||||
|
||||
// List all of the indices that belong to a table,
|
||||
// does not count:
|
||||
// * UNIQUE indices
|
||||
// * PRIMARY keys
|
||||
function sql_list_index($dbms, $table_name)
|
||||
{
|
||||
global $dbms_type_map, $db;
|
||||
global $errored, $error_ary;
|
||||
|
||||
$index_array = array();
|
||||
|
||||
if ($dbms == 'mssql')
|
||||
{
|
||||
$sql = "EXEC sp_statistics '$table_name'";
|
||||
$result = $db->sql_query($sql);
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if ($row['TYPE'] == 3)
|
||||
{
|
||||
$index_array[] = $row['INDEX_NAME'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ($dbms)
|
||||
{
|
||||
case 'firebird':
|
||||
$sql = "SELECT LOWER(RDB$INDEX_NAME) as index_name
|
||||
FROM RDB$INDICES
|
||||
WHERE RDB$RELATION_NAME = " . strtoupper($table_name) . "
|
||||
AND RDB$UNIQUE_FLAG IS NULL
|
||||
AND RDB$FOREIGN_KEY IS NULL";
|
||||
$col = 'index_name';
|
||||
break;
|
||||
|
||||
case 'postgres':
|
||||
$sql = "SELECT ic.relname as index_name
|
||||
FROM pg_class bc, pg_class ic, pg_index i
|
||||
WHERE (bc.oid = i.indrelid)
|
||||
AND (ic.oid = i.indexrelid)
|
||||
AND (bc.relname = '" . $table_name . "')
|
||||
AND (i.indisunique != 't')
|
||||
AND (i.indisprimary != 't')";
|
||||
$col = 'index_name';
|
||||
break;
|
||||
|
||||
case 'mysql_40':
|
||||
case 'mysql_41':
|
||||
$sql = 'SHOW KEYS
|
||||
FROM ' . $table_name .'
|
||||
WHERE Non_unique = 1';
|
||||
$col = 'Key_name';
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$sql = "SELECT index_name
|
||||
FROM user_indexes
|
||||
WHERE table_name = '" . $table_name . "'
|
||||
AND generated = 'N'";
|
||||
break;
|
||||
|
||||
case 'sqlite':
|
||||
$sql = "PRAGMA index_info('" . $table_name . "');";
|
||||
$col = 'name';
|
||||
break;
|
||||
}
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$index_array[] = $row[$col];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
return array_map('strtolower', $index_array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change column type (not name!)
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user