[OJS 3.1.2.1] Problem with article cache

Hello,
I have a strange problem with a couple of articles of OJS 3.1.2.1. The articles are present on the database and are displayed in the admin part, but when I try to reach them on the frontend (eg.: https:///index.php//article/view/3) I have a 404 error.
I’ve made some debugging and I’ve found that if I change the file ‘pages/article/ArticleHandler.inc.php’ at line 66:

$publishedArticle = $publishedArticleDao->getPublishedArticleByBestArticleId((int) $journal->getId(), $articleId, true);

to

$publishedArticle = $publishedArticleDao->getPublishedArticleByBestArticleId((int) $journal->getId(), $articleId, false);

The articles are visible again. The last parameter is the ‘$useCache’.
I’ve checked the file ‘classes/article/PublishedArticleDAO.inc.php’ and found that if ‘$useCache’ is ‘true’, the ‘getPublishedArticleByPubId’ method can perform the following query to build its cache, without using the ‘$journalId’:

SELECT
ps.*, s.*, COALESCE(stl.setting_value, stpl.setting_value) AS section_title, COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
FROM
published_submissions ps
JOIN submissions s ON ps.submission_id = s.submission_id
JOIN sections se ON se.section_id = s.section_id
LEFT JOIN section_settings stpl ON (se.section_id = stpl.section_id AND stpl.setting_name = 'title' AND stpl.locale = 'it_IT')
LEFT JOIN section_settings stl ON (se.section_id = stl.section_id AND stl.setting_name = 'title' AND stl.locale = 'it_IT')
LEFT JOIN section_settings sapl ON (se.section_id = sapl.section_id AND sapl.setting_name = 'abbrev' AND sapl.locale = 'it_IT')
LEFT JOIN section_settings sal ON (se.section_id = sal.section_id AND sal.setting_name = 'abbrev' AND sal.locale = 'it_IT')
INNER JOIN submission_settings sst ON s.submission_id = sst.submission_id
WHERE
sst.setting_name = 'pub-id::publisher-id' AND sst.setting_value = '3'
ORDER BY ps.issue_id, s.submission_id;

that returns the wrong article and leading to the 404 error.
When ‘$useCache’ is ‘false’ the ‘getBySetting’ method is used and the right article is found. The performed query is the following:

SELECT
ps.*, s.*, COALESCE(stl.setting_value, stpl.setting_value) AS section_title, COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
FROM
published_submissions ps
JOIN submissions s ON ps.submission_id = s.submission_id
JOIN sections se ON se.section_id = s.section_id
LEFT JOIN section_settings stpl ON (se.section_id = stpl.section_id AND stpl.setting_name = 'title' AND stpl.locale = 'it_IT')
LEFT JOIN section_settings stl ON (se.section_id = stl.section_id AND stl.setting_name = 'title' AND stl.locale = 'it_IT')
LEFT JOIN section_settings sapl ON (se.section_id = sapl.section_id AND sapl.setting_name = 'abbrev' AND sapl.locale = 'it_IT')
LEFT JOIN section_settings sal ON (se.section_id = sal.section_id AND sal.setting_name = 'abbrev' AND sal.locale = 'it_IT')
INNER JOIN submission_settings sst ON s.submission_id = sst.submission_id
WHERE
sst.setting_name = 'pub-id::publisher-id' AND sst.setting_value = '3' AND s.context_id = 53
ORDER BY ps.issue_id, s.submission_id;

with the ‘context_id’ the result is correct. Can someone tell me if I have problems in my data or this is a bug?

Thank you very much

Seems like we are facing the same problem. Did you find a sulution?

Hi @Jovan_Shopovski,

Have you enabled the object_cache setting in config.inc.php? If so, I’d suggest disabling it.

Regards,
Alec Smecher
Public Knowledge Project Team

Hello @asmecher,
I have the object_cache = none, so I think it’s disabled.

Thanks

Hi all,

Have you assigned public identifiers to the articles, and if so, are they numeric?

Regards,
Alec Smecher
Public Knowledge Project Team