diff options
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/DatabaseDAO.php | 16 | ||||
| -rw-r--r-- | app/Models/EntryDAO.php | 16 | ||||
| -rw-r--r-- | app/Models/FeedDAO.php | 2 |
3 files changed, 13 insertions, 21 deletions
diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php index 45fc1967c..1f31f161a 100644 --- a/app/Models/DatabaseDAO.php +++ b/app/Models/DatabaseDAO.php @@ -214,22 +214,14 @@ SQL; return $ok; } - private function ensureYear2038Compatible(): bool { - if ($this->pdo->dbType() !== 'sqlite') { - include_once(APP_PATH . '/SQL/install.sql.' . $this->pdo->dbType() . '.php'); - if ($this->pdo->exec($GLOBALS['SQL_UPDATE_YEAR_2038']) === false) { //FreshRSS 1.23 - Minz_Log::error('SQL error ' . __METHOD__ . json_encode($this->pdo->errorInfo())); - return false; - } - } - return true; - } - public function minorDbMaintenance(): void { $catDAO = FreshRSS_Factory::createCategoryDao(); $catDAO->resetDefaultCategoryName(); - $this->ensureYear2038Compatible(); + include_once(APP_PATH . '/SQL/install.sql.' . $this->pdo->dbType() . '.php'); + if (!empty($GLOBALS['SQL_UPDATE_MINOR']) && $this->pdo->exec($GLOBALS['SQL_UPDATE_MINOR']) === false) { + Minz_Log::error('SQL error ' . __METHOD__ . json_encode($this->pdo->errorInfo())); + } } private static function stdError(string $error): bool { 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'])) { diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 127702765..474780981 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -61,7 +61,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { sanitizeHTML($valuesTmp['description'], ''), $valuesTmp['lastUpdate'], isset($valuesTmp['priority']) ? (int)$valuesTmp['priority'] : FreshRSS_Feed::PRIORITY_MAIN_STREAM, - mb_strcut($valuesTmp['pathEntries'], 0, 65535, 'UTF-8'), + mb_strcut($valuesTmp['pathEntries'], 0, 4096, 'UTF-8'), base64_encode($valuesTmp['httpAuth']), isset($valuesTmp['error']) ? (int)$valuesTmp['error'] : 0, isset($valuesTmp['ttl']) ? (int)$valuesTmp['ttl'] : FreshRSS_Feed::TTL_DEFAULT, |
