Use ArticleAction instead ArticleEditor for article publication
authorMarcel Werk <burntime@woltlab.com>
Tue, 20 Sep 2016 15:43:41 +0000 (17:43 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 20 Sep 2016 15:43:48 +0000 (17:43 +0200)
wcfsetup/install/files/lib/system/cronjob/ArticlePublicationCronjob.class.php

index 38bc0889b94d52d13247cb8b483f3534ab327397..4d70c0bbf5188f08149b96ae5cc3117095c4352f 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace wcf\system\cronjob;
 use wcf\data\article\Article;
+use wcf\data\article\ArticleAction;
 use wcf\data\article\ArticleEditor;
 use wcf\data\article\ArticleList;
 use wcf\data\cronjob\Cronjob;
@@ -28,13 +29,15 @@ class ArticlePublicationCronjob extends AbstractCronjob {
                $articleList->decoratorClassName = ArticleEditor::class;
                $articleList->readObjects();
                
-               foreach ($articleList as $editor) {
-                       /** @var ArticleEditor $editor */
-                       $editor->update([
-                               'time' => $editor->publicationDate,
-                               'publicationStatus' => Article::PUBLISHED,
-                               'publicationDate' => 0
+               foreach ($articleList as $article) {
+                       $action = new ArticleAction(array($article), 'update', [
+                               'data' => [
+                                       'time' => $article->publicationDate,
+                                       'publicationStatus' => Article::PUBLISHED,
+                                       'publicationDate' => 0
+                               ]
                        ]);
+                       $action->executeAction();
                }
        }
 }