diff options
Diffstat (limited to 'app/Models/Entry.php')
| -rw-r--r-- | app/Models/Entry.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 296c3860f..ea124794a 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -28,6 +28,7 @@ class FreshRSS_Entry extends Minz_Model { /** In microseconds */ private string $date_added = '0'; private string $hash = ''; + private ?int $sqlContentLength = null; private ?bool $is_read; private ?bool $is_favorite; private bool $is_updated = false; @@ -56,7 +57,8 @@ class FreshRSS_Entry extends Minz_Model { /** @param array{id?:string,id_feed?:int,guid?:string,title?:string,author?:string,content?:string,link?:string, * date?:int|string,lastSeen?:int,lastUserModified?:int, - * hash?:string,is_read?:bool|int,is_favorite?:bool|int,tags?:string|array<string>,attributes?:?string,thumbnail?:string,timestamp?:string} $dao */ + * hash?:string,is_read?:bool|int,is_favorite?:bool|int,tags?:string|array<string>,attributes?:?string,thumbnail?:string,timestamp?:string, + * content_length?:int} $dao */ public static function fromArray(array $dao): FreshRSS_Entry { if (empty($dao['content']) || !is_string($dao['content'])) { $dao['content'] = ''; @@ -108,6 +110,9 @@ class FreshRSS_Entry extends Minz_Model { if (!empty($dao['hash'])) { $entry->_hash($dao['hash']); } + if (isset($dao['content_length']) && is_numeric($dao['content_length'])) { + $entry->_sqlContentLength((int)$dao['content_length']); + } return $entry; } @@ -500,6 +505,10 @@ HTML; return $this->hash; } + public function sqlContentLength(): ?int { + return $this->sqlContentLength; + } + public function _hash(string $value): string { $value = trim($value); if (ctype_xdigit($value)) { @@ -508,6 +517,10 @@ HTML; return $this->hash; } + public function _sqlContentLength(int $value): void { + $this->sqlContentLength = $value > 0 ? $value : null; + } + /** @param int|numeric-string $value String is for compatibility with 32-bit platforms */ public function _id(int|string $value): void { if (is_int($value)) { |
