[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [BP][FIX] Search: handle hyphenated database names when creating MySQL full-text indexes
"luci \(@luciash\) via TikiWiki-cvs" <[email protected]> Fri, 17 Jul 2026 12:24:25 +0000
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a5a1ef930d42_3819cfa820694@gitlab-sidekiq-low-urgency-cpu-bound-v2-645fbf585-m7clj.mail> |
luci pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki
Commits:
3e3991be by MAGENE Sem Joel at 2026-07-17T12:15:54+00:00
[BP][FIX] Search: handle hyphenated database names when creating MySQL full-text indexes
---
* [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
(cherry picked from commit 14a671814adef177b15a790c881d2a88341c47bf)
See merge request tikiwiki/tiki!10748
- - - - -
1 changed file:
- lib/core/Search/MySql/Table.php
Changes:
=====================================
lib/core/Search/MySql/Table.php
=====================================
@@ -452,11 +452,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/3e3991be5ba8aac70acf6c8121596634b087bc72
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/3e3991be5ba8aac70acf6c8121596634b087bc72
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