mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Fix checking of foreign table index on install "contentcontainer_tag" (#5416)
This commit is contained in:
parent
7327b375fe
commit
713c7bc2be
@ -4,6 +4,7 @@ HumHub Changelog
|
||||
1.9.3 (Unreleased)
|
||||
------------------
|
||||
- Fix #5372: Text shortening in Japanese broken - Fix truncating of multi-byte strings
|
||||
- Fix #5398: Fix checking of foreign table index
|
||||
|
||||
|
||||
1.9.2 (October 15, 2021)
|
||||
|
@ -104,12 +104,12 @@ class Migration extends \yii\db\Migration
|
||||
* @param string $table
|
||||
* @return bool
|
||||
*/
|
||||
protected function foreignIndexExists($index, $table): bool
|
||||
protected function foreignIndexExists(string $index, string $table): bool
|
||||
{
|
||||
return (bool) $this->db->createCommand('SELECT * FROM information_schema.key_column_usage
|
||||
WHERE REFERENCED_TABLE_NAME IS NOT NULL
|
||||
AND TABLE_NAME = ' . $this->db->quoteValue($table) . '
|
||||
AND TABLE_SCHEMA = "humhub_develop"
|
||||
AND TABLE_SCHEMA = ' . $this->db->quoteValue($this->getDsnAttribute('dbname')). '
|
||||
AND CONSTRAINT_NAME = ' . $this->db->quoteValue($index))
|
||||
->queryOne();
|
||||
}
|
||||
@ -320,4 +320,18 @@ class Migration extends \yii\db\Migration
|
||||
{
|
||||
return (!Setting::isInstalled());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data from database dsn config
|
||||
*
|
||||
* @since 1.9.3
|
||||
* @param string $name 'host', 'port', 'dbname'
|
||||
* @return string|null
|
||||
*/
|
||||
private function getDsnAttribute(string $name): ?string
|
||||
{
|
||||
return preg_match('/' . preg_quote($name) . '=([^;]*)/', $this->db->dsn, $match)
|
||||
? $match[1]
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user