From 16dba23b013b8317a97dbd165b7b7a91c54700e7 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Tue, 26 Oct 2021 16:09:20 +0200 Subject: [PATCH] Do not increase article view counter for unpublished articles Closes #4374 --- .../files/lib/page/AbstractArticlePage.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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()) { -- 2.20.1