diff options
| author | 2018-10-25 22:43:13 +0200 | |
|---|---|---|
| committer | 2018-10-25 22:43:13 +0200 | |
| commit | 307e6995fec51d368beeada9e1b69c40c3e7d065 (patch) | |
| tree | 6b957ef160882351af9c65c1d7e337e123c65110 /app/Models | |
| parent | 3eae8bd3b7b5f82f71aef341e6bf519483903867 (diff) | |
MySQL GUID case sensitive (#2078)
* MySQL GUID case sensitive
latin1_bin
https://github.com/FreshRSS/FreshRSS/issues/2077
* Prepare update for existing bases
* Perform DB update during actualize
* Reduce frequency slightly
* No optimize at the same time
* Take advantage of the SQL modifications in 1.12
* Move higher up
* Move to purge, which all users can manually call
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/DatabaseDAO.php | 19 | ||||
| -rw-r--r-- | app/Models/TagDAO.php | 5 |
2 files changed, 24 insertions, 0 deletions
diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php index 54076d7a9..dbd328bf7 100644 --- a/app/Models/DatabaseDAO.php +++ b/app/Models/DatabaseDAO.php @@ -141,4 +141,23 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo { } return $ok; } + + public function ensureCaseInsensitiveGuids() { + $ok = true; + $db = FreshRSS_Context::$system_conf->db; + if ($db['type'] === 'mysql') { + include_once(APP_PATH . '/SQL/install.sql.mysql.php'); + if (defined('SQL_UPDATE_GUID_LATIN1_BIN')) { //FreshRSS 1.12 + try { + $sql = sprintf(SQL_UPDATE_GUID_LATIN1_BIN, $this->prefix); + $stm = $this->bd->prepare($sql); + $ok = $stm->execute(); + } catch (Exception $e) { + $ok = false; + Minz_Log::error('FreshRSS_DatabaseDAO::ensureCaseInsensitiveGuids error: ' . $e->getMessage()); + } + } + } + return $ok; + } } diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.php index ad67c1abe..1b59c8971 100644 --- a/app/Models/TagDAO.php +++ b/app/Models/TagDAO.php @@ -15,6 +15,11 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable { try { $db = FreshRSS_Context::$system_conf->db; require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); + + Minz_Log::warning('SQL ALTER GUID case sensitivity...'); + $databaseDAO = FreshRSS_Factory::createDatabaseDAO(); + $databaseDAO->ensureCaseInsensitiveGuids(); + Minz_Log::warning('SQL CREATE TABLE tag...'); if (defined('SQL_CREATE_TABLE_TAGS')) { $sql = sprintf(SQL_CREATE_TABLE_TAGS, $this->prefix); |
