[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Search: handle hyphenated database names when creating MySQL full-text indexes
"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]> Thu, 16 Jul 2026 23:18:07 +0000
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a5966af7871b_3711551fc2602f@gitlab-sidekiq-low-urgency-cpu-bound-v2-77c895df49-sbwmr.mail> |
ushindi bienvenu pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
14a67181 by MAGENE Sem Joel at 2026-07-16T23:03:31+00:00
[FIX] Search: handle hyphenated database names when creating MySQL full-text indexes
---
* [FIX] Search: handle hyphenated database names when creating MySQL full-text indexes
See merge request tikiwiki/tiki!10742
- - - - -
1 changed file:
- lib/core/Search/MySql/Table.php
Changes:
=====================================
lib/core/Search/MySql/Table.php
=====================================
@@ -456,11 +456,32 @@ class Search_MySql_Table extends TikiDb_Table
return $stopwordTableName;
}
+ /**
+ * Encode Tiki-supported identifiers for InnoDB's filename character set.
+ *
+ * Tiki-created database names are limited to ASCII letters, digits, dollar
+ * signs, underscores, and hyphens. MySQL preserves letters, digits, and
+ * underscores in filenames, so only the remaining two characters require
+ * encoding. Search index names use a subset of the same character set.
+ */
+ private static function encodeInnoDBIdentifier(string $identifier): string
+ {
+ return strtr($identifier, [
+ '$' => '@0024',
+ '-' => '@002d',
+ ]);
+ }
+
private function addFullText($fieldName)
{
$stopwordTableName = $this->setupStopwordTable();
$dbName = $this->db->getOne("SELECT DATABASE()");
- $this->db->query("SET SESSION innodb_ft_user_stopword_table = ?", ["{$dbName}/{$stopwordTableName}"]);
+ $innodbStopwordTableName = sprintf(
+ '%s/%s',
+ self::encodeInnoDBIdentifier($dbName),
+ self::encodeInnoDBIdentifier($stopwordTableName)
+ );
+ $this->db->query("SET SESSION innodb_ft_user_stopword_table = ?", [$innodbStopwordTableName]);
$table = $this->escapeIdentifier($this->definition[$fieldName]['table']);
$this->schemaBuffer->setPrefix("ALTER TABLE $table ");
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/14a671814adef177b15a790c881d2a88341c47bf
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/14a671814adef177b15a790c881d2a88341c47bf
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs