Skip to content

Commit

Permalink
#132 Fix cache issue when unpublish an article
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy-1 committed Feb 21, 2022
1 parent 91542fa commit bb7e64a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion OldGreggThemePlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,12 @@ function _toCache($cache) {
$popularArticles = array();
foreach ($results as $result) {
$publishedArticle = Services::get('submission')->get($result['submission_id']);

// The submission likely was unpublished, see Vitaliy-1/oldGregg#132
if (!$publishedArticle) continue;

// Can't cache objects
$popularArticles[$result['submission_id']] = array(
'localized_title' => $publishedArticle->getLocalizedFullTitle(),
'views' => $result['metric'],
'date_published' => $publishedArticle->getDatePublished()
);
Expand Down

0 comments on commit bb7e64a

Please sign in to comment.