mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Track usage of binaryblacklist.
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
<newznab>
|
||||
<versions>
|
||||
<sql>
|
||||
<db>186</db>
|
||||
<file>186</file>
|
||||
<db>187</db>
|
||||
<file>187</file>
|
||||
</sql>
|
||||
<git>
|
||||
<tag>0.4.1</tag>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE binaryblacklist ADD COLUMN last_activity DATE DEFAULT NULL;
|
||||
Reference in New Issue
Block a user