Track usage of binaryblacklist.

This commit is contained in:
DariusIII
2015-09-12 23:59:40 +02:00
parent 12bf537884
commit 534f6eda51
3 changed files with 20 additions and 2 deletions
+2 -2
View File
@@ -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>
+17
View File
@@ -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;