Prevent unnecessary increment of thread revision value

Fixes #149
This commit is contained in:
Fedor A. Fetisov 2016-12-29 17:35:58 +03:00
parent bc16b7c25f
commit f4ad0a2351

View File

@ -430,15 +430,17 @@ class Thread
);
// Perform the cleaning
$revision = self::nextRevision();
foreach ($rows as $row) {
$thread = Thread::createFromDbInfo($row);
$thread->lastRevision = $revision;
$thread->modified = $now;
$thread->closed = $now;
$thread->state = self::STATE_CLOSED;
$thread->save();
unset($thread);
if (count($rows) > 0) {
$revision = self::nextRevision();
foreach ($rows as $row) {
$thread = Thread::createFromDbInfo($row);
$thread->lastRevision = $revision;
$thread->modified = $now;
$thread->closed = $now;
$thread->state = self::STATE_CLOSED;
$thread->save(false);
unset($thread);
}
}
// Release the lock