diff --git a/newznab/build/newznab.xml b/newznab/build/newznab.xml index 6f7252430..a4248009d 100644 --- a/newznab/build/newznab.xml +++ b/newznab/build/newznab.xml @@ -2,8 +2,8 @@ - 186 - 186 + 187 + 187 0.4.1 diff --git a/newznab/controllers/Binaries.php b/newznab/controllers/Binaries.php index c53e20589..1e77fe71e 100644 --- a/newznab/controllers/Binaries.php +++ b/newznab/controllers/Binaries.php @@ -141,6 +141,12 @@ class Binaries */ protected $_partRepairMaxTries; + /** + * An array of binaryblacklist IDs that should have their activity date updated + * @var array(int) + */ + protected $_binaryBlacklistIdsToUpdate = []; + /** * Constructor. * @@ -839,6 +845,15 @@ class Binaries ); } + if (!empty($this->_binaryBlacklistIdsToUpdate)) { + $this->_pdo->queryExec( + sprintf('UPDATE binaryblacklist SET last_activity = NOW() WHERE id IN (%s)', + implode(',', $this->_binaryBlacklistIdsToUpdate) + ) + ); + $this->_binaryBlacklistIdsToUpdate = []; + } + // Start of part repair. $startPR = microtime(true); @@ -1361,6 +1376,7 @@ class Binaries if (preg_match('/' . $whiteList['regex'] . '/i', $field[$whiteList['msgcol']])) { // This field matched a white list, so it might not be black listed. $blackListed = false; + $this->_binaryBlacklistIdsToUpdate[$whiteList['id']] = $whiteList['id']; break; } } @@ -1371,6 +1387,7 @@ class Binaries foreach ($this->blackList[$groupName] as $blackList) { if (preg_match('/' . $blackList['regex'] . '/i', $field[$blackList['msgcol']])) { $blackListed = true; + $this->_binaryBlacklistIdsToUpdate[$blackList['id']] = $blackList['id']; break; } } diff --git a/resources/db/patches/0187~binaryblacklist.sql b/resources/db/patches/0187~binaryblacklist.sql new file mode 100644 index 000000000..7150cb9cb --- /dev/null +++ b/resources/db/patches/0187~binaryblacklist.sql @@ -0,0 +1 @@ +ALTER TABLE binaryblacklist ADD COLUMN last_activity DATE DEFAULT NULL; \ No newline at end of file