From: Marcel Werk Date: Tue, 26 Oct 2021 14:09:20 +0000 (+0200) Subject: Do not increase article view counter for unpublished articles X-Git-Tag: 5.5.0_Alpha_1~348 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=16dba23b013b8317a97dbd165b7b7a91c54700e7;p=GitHub%2FWoltLab%2FWCF.git Do not increase article view counter for unpublished articles Closes #4374 --- diff --git a/wcfsetup/install/files/lib/page/AbstractArticlePage.class.php b/wcfsetup/install/files/lib/page/AbstractArticlePage.class.php index 1c5645e5c3..c14c1bc113 100644 --- a/wcfsetup/install/files/lib/page/AbstractArticlePage.class.php +++ b/wcfsetup/install/files/lib/page/AbstractArticlePage.class.php @@ -120,10 +120,12 @@ abstract class AbstractArticlePage extends AbstractPage parent::readData(); // update view count - $articleEditor = new ArticleEditor($this->article->getDecoratedObject()); - $articleEditor->updateCounters([ - 'views' => 1, - ]); + if ($this->article->isPublished()) { + $articleEditor = new ArticleEditor($this->article->getDecoratedObject()); + $articleEditor->updateCounters([ + 'views' => 1, + ]); + } // update article visit if (ARTICLE_ENABLE_VISIT_TRACKING && $this->article->isNew()) {