aboutsummaryrefslogtreecommitdiff
path: root/app/Models/EntryDAO.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-10-31 02:01:50 +0100
committerGravatar GitHub <noreply@github.com> 2023-10-31 02:01:50 +0100
commitad8bae5acadcda0291c3a6ca579303dbd4053f04 (patch)
treeab6a7ce2bca239a18e50ff027613bf0116135614 /app/Models/EntryDAO.php
parent4207f2a5b2d84dbbc18ef6b277345e7e723f35c1 (diff)
Rework SQL field length (#5788)
* SQL auto-update field length Follow-up of https://github.com/FreshRSS/FreshRSS/pull/5756 Only for PostgreSQL and MySQL / MariaDB. Not possible for SQLite * Account for MySQL 65535 Partial revert of https://github.com/FreshRSS/FreshRSS/pull/5756 > The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead.
Diffstat (limited to 'app/Models/EntryDAO.php')
-rw-r--r--app/Models/EntryDAO.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index 741886520..82fb27903 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -112,15 +112,15 @@ SQL;
$valuesTmp['guid'] = substr($valuesTmp['guid'], 0, 767);
$valuesTmp['guid'] = safe_ascii($valuesTmp['guid']);
$this->addEntryPrepared->bindParam(':guid', $valuesTmp['guid']);
- $valuesTmp['title'] = mb_strcut($valuesTmp['title'], 0, 65535, 'UTF-8');
+ $valuesTmp['title'] = mb_strcut($valuesTmp['title'], 0, 8192, 'UTF-8');
$valuesTmp['title'] = safe_utf8($valuesTmp['title']);
$this->addEntryPrepared->bindParam(':title', $valuesTmp['title']);
- $valuesTmp['author'] = mb_strcut($valuesTmp['author'], 0, 65535, 'UTF-8');
+ $valuesTmp['author'] = mb_strcut($valuesTmp['author'], 0, 1024, 'UTF-8');
$valuesTmp['author'] = safe_utf8($valuesTmp['author']);
$this->addEntryPrepared->bindParam(':author', $valuesTmp['author']);
$valuesTmp['content'] = safe_utf8($valuesTmp['content']);
$this->addEntryPrepared->bindParam(':content', $valuesTmp['content']);
- $valuesTmp['link'] = substr($valuesTmp['link'], 0, 32768);
+ $valuesTmp['link'] = substr($valuesTmp['link'], 0, 16383);
$valuesTmp['link'] = safe_ascii($valuesTmp['link']);
$this->addEntryPrepared->bindParam(':link', $valuesTmp['link']);
$this->addEntryPrepared->bindParam(':date', $valuesTmp['date'], PDO::PARAM_INT);
@@ -133,7 +133,7 @@ SQL;
$valuesTmp['is_favorite'] = $valuesTmp['is_favorite'] ? 1 : 0;
$this->addEntryPrepared->bindParam(':is_favorite', $valuesTmp['is_favorite'], PDO::PARAM_INT);
$this->addEntryPrepared->bindParam(':id_feed', $valuesTmp['id_feed'], PDO::PARAM_INT);
- $valuesTmp['tags'] = mb_strcut($valuesTmp['tags'], 0, 65535, 'UTF-8');
+ $valuesTmp['tags'] = mb_strcut($valuesTmp['tags'], 0, 2048, 'UTF-8');
$valuesTmp['tags'] = safe_utf8($valuesTmp['tags']);
$this->addEntryPrepared->bindParam(':tags', $valuesTmp['tags']);
if (!isset($valuesTmp['attributes'])) {
@@ -217,15 +217,15 @@ SQL;
$valuesTmp['guid'] = substr($valuesTmp['guid'], 0, 767);
$valuesTmp['guid'] = safe_ascii($valuesTmp['guid']);
$this->updateEntryPrepared->bindParam(':guid', $valuesTmp['guid']);
- $valuesTmp['title'] = mb_strcut($valuesTmp['title'], 0, 65535, 'UTF-8');
+ $valuesTmp['title'] = mb_strcut($valuesTmp['title'], 0, 8192, 'UTF-8');
$valuesTmp['title'] = safe_utf8($valuesTmp['title']);
$this->updateEntryPrepared->bindParam(':title', $valuesTmp['title']);
- $valuesTmp['author'] = mb_strcut($valuesTmp['author'], 0, 65535, 'UTF-8');
+ $valuesTmp['author'] = mb_strcut($valuesTmp['author'], 0, 1024, 'UTF-8');
$valuesTmp['author'] = safe_utf8($valuesTmp['author']);
$this->updateEntryPrepared->bindParam(':author', $valuesTmp['author']);
$valuesTmp['content'] = safe_utf8($valuesTmp['content']);
$this->updateEntryPrepared->bindParam(':content', $valuesTmp['content']);
- $valuesTmp['link'] = substr($valuesTmp['link'], 0, 32768);
+ $valuesTmp['link'] = substr($valuesTmp['link'], 0, 16383);
$valuesTmp['link'] = safe_ascii($valuesTmp['link']);
$this->updateEntryPrepared->bindParam(':link', $valuesTmp['link']);
$this->updateEntryPrepared->bindParam(':date', $valuesTmp['date'], PDO::PARAM_INT);
@@ -241,7 +241,7 @@ SQL;
$this->updateEntryPrepared->bindValue(':is_favorite', $valuesTmp['is_favorite'] ? 1 : 0, PDO::PARAM_INT);
}
$this->updateEntryPrepared->bindParam(':id_feed', $valuesTmp['id_feed'], PDO::PARAM_INT);
- $valuesTmp['tags'] = mb_strcut($valuesTmp['tags'], 0, 65535, 'UTF-8');
+ $valuesTmp['tags'] = mb_strcut($valuesTmp['tags'], 0, 2048, 'UTF-8');
$valuesTmp['tags'] = safe_utf8($valuesTmp['tags']);
$this->updateEntryPrepared->bindParam(':tags', $valuesTmp['tags']);
if (!isset($valuesTmp['attributes'])) {