re-add 10 * batch size limit in filesystem purge and support v1 dates for sorting mixed versioned comments
This commit is contained in:
parent
38574f0196
commit
e54277f014
1 changed files with 13 additions and 3 deletions
|
@ -228,7 +228,13 @@ class Filesystem extends AbstractData
|
||||||
$comment['parentid'] = $items[2];
|
$comment['parentid'] = $items[2];
|
||||||
|
|
||||||
// Store in array
|
// Store in array
|
||||||
$key = $this->getOpenSlot($comments, (int) $comment['meta']['created']);
|
$key = $this->getOpenSlot(
|
||||||
|
$comments, (
|
||||||
|
(int) array_key_exists('created', $comment['meta']) ?
|
||||||
|
$comment['meta']['created'] : // v2 comments
|
||||||
|
$comment['meta']['postdate'] // v1 comments
|
||||||
|
)
|
||||||
|
);
|
||||||
$comments[$key] = $comment;
|
$comments[$key] = $comment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -358,6 +364,8 @@ class Filesystem extends AbstractData
|
||||||
{
|
{
|
||||||
$pastes = array();
|
$pastes = array();
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
$opened = 0;
|
||||||
|
$limit = $batchsize * 10; // try at most 10 times $batchsize pastes before giving up
|
||||||
$time = time();
|
$time = time();
|
||||||
foreach ($this->_getPasteIterator() as $file) {
|
foreach ($this->_getPasteIterator() as $file) {
|
||||||
if ($file->isDir()) {
|
if ($file->isDir()) {
|
||||||
|
@ -371,11 +379,13 @@ class Filesystem extends AbstractData
|
||||||
$data['meta']['expire_date'] < $time
|
$data['meta']['expire_date'] < $time
|
||||||
) {
|
) {
|
||||||
$pastes[] = $pasteid;
|
$pastes[] = $pasteid;
|
||||||
++$count;
|
if (++$count >= $batchsize) {
|
||||||
if ($count >= $batchsize) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (++$opened >= $limit) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $pastes;
|
return $pastes;
|
||||||
|
|
Loading…
Reference in a new issue