aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-12-03 17:30:02 +0100
committerGravatar GitHub <noreply@github.com> 2017-12-03 17:30:02 +0100
commit4f06b17e005456515768f46b3cc3130428f579bf (patch)
tree6afb503a5dffdc60a1a3c2760a94e9ac86067690
parentac73ba3accd8f5638b330002d002460067c4e012 (diff)
Extension function to override entry hash (#1707)
Extension function to override entry hash https://github.com/FreshRSS/FreshRSS/issues/1706
-rw-r--r--CHANGELOG.md2
-rw-r--r--app/Models/Entry.php8
2 files changed, 10 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f5b3b06b4..c7fec5334 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,8 @@
* Perform `VACUUM` on SQLite and PostgreSQL databases when optimisation is requested [#918](https://github.com/FreshRSS/FreshRSS/issues/918)
* I18n
* Improved German [#1698](https://github.com/FreshRSS/FreshRSS/pull/1698)
+* Extensions
+ * New function `$entry->_hash($hex)` for extensios that change the content of entries [#1707](https://github.com/FreshRSS/FreshRSS/pull/1707)
* Misc.
* Translation validation tool [#1653](https://github.com/FreshRSS/FreshRSS/pull/1653)
* Translation manipulation tool [#1658](https://github.com/FreshRSS/FreshRSS/pull/1658)
diff --git a/app/Models/Entry.php b/app/Models/Entry.php
index df3d59bea..0ad3781e5 100644
--- a/app/Models/Entry.php
+++ b/app/Models/Entry.php
@@ -97,6 +97,14 @@ class FreshRSS_Entry extends Minz_Model {
return $this->hash;
}
+ public function _hash($value) {
+ $value = trim($value);
+ if (ctype_xdigit($value)) {
+ $this->hash = substr($value, 0, 32);
+ }
+ return $this->hash;
+ }
+
public function _id($value) {
$this->id = $value;
}