Hi, I downloaded JForum and started changing it to my needs. First was making urls more friendly, now they contain info about post/topic title but it's not important. When I tested friendly urls with pagination, I saw results on subsequent pages do not appear. I looked at code and my question is, what sense is in this method:
public static List<Topic> topicsByForum(int forumId, int start)
{
TopicDAO tm = DataAccessDriver.getInstance().newTopicDAO();
int topicsPerPage = SystemGlobals.getIntValue(ConfigKeys.TOPICS_PER_PAGE);
List<Topic> topics;
// Try to get the first's page of topics from the cache
if (SystemGlobals.getBoolValue(ConfigKeys.TOPIC_CACHE_ENABLED)) {
topics = TopicRepository.getTopics(forumId);
if (topics.isEmpty() || !TopicRepository.isLoaded(forumId)) {
synchronized (MUTEXT) {
if (topics.isEmpty() || !TopicRepository.isLoaded(forumId)) {
topics = tm.selectAllByForum(forumId);
TopicRepository.addAll(forumId, topics);
}
}
}
}
else {
topics = tm.selectAllByForumByLimit(forumId, start, topicsPerPage);
}
int size = topics.size();
while (size < start) {
start -= topicsPerPage;
}
if (start < 0) {
start = 0;
}
return topics.subList(start, (size < start + topicsPerPage) ? size : start + topicsPerPage);
}
in TopicsCommon class. What if in cache I have 20 results and go to records on 30th page? What is the subListing for, if I would not use cache and get exact list from database?
Thanks.