1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +02:00

[ticket/17525] Automatically handle index name prefixes

PHPBB-17525
This commit is contained in:
rxu
2025-07-01 21:01:09 +07:00
parent e9157f4d10
commit 8e0ec1edd2
3 changed files with 80 additions and 1 deletions

View File

@@ -233,4 +233,34 @@ interface tools_interface
* @return \Doctrine\DBAL\Connection
*/
public function get_connection(): \Doctrine\DBAL\Connection;
/**
* Adds short table name prefix to the index name if needed
*
* @param string $table_name Table name with tables prefix
* @param string $index_name Index name
* @param bool $remove_prefix Flag indicating to remove short table name prefix if exists
*
* @return string Prefixed index name
*/
public static function normalize_index_name(string $table_name, string $index_name, bool $remove_prefix = false): string;
/**
* Removes prefix from string if exists
*
* @param string $name String to remove the prefix from
*
* @return string Prefixless string
*/
public static function remove_prefix(string $name): string;
/**
* Tests if a string is prefixed with the prefix defined
*
* @param string $name String to test vs prefix
* @param string $prefix Prefix name
*
* @return bool True if a string id prefixed with the prefix defined, false otherwise
*/
public static function is_prefixed(string $name, string $prefix): bool;
}