Page 1 of 1

New message not appearing on portal 2.1.0

Posted: 21. November 2015 16:21
by mahugin
Your Portal Version: 2.1.0
Your phpBB Type: Standard phpBB3
MODs installed: Yes
Your knowledge: Basic Knowledge

What have you done before the problem was there?


What have you already tryed to solve the problem?


Description and Message
Hello,

I also installed the 2.1.0 portal over 3.1.6 Phpbb. Everything works fine but the NEW messages do not appear in the modules New Posts and Recent topics . I must purge the cache each time in the administrator panel so that new messages appear. This problem only happens on the portal. The forum (Index) shows new messages correctly.

Thank you very much for your help :) !

Re: New message not appearing on portal 2.1.0

Posted: 23. November 2015 05:26
by mahugin
Is there any body that can help me, please?

Server is: Debian GMU/Linux
Running Php 5.4 with Mysql 5.5.38

Re: New message not appearing on portal 2.1.0

Posted: 23. November 2015 18:31
by Marc
The portal caches the data on the portal for 30 seconds. If you refresh the page after 30 seconds, the new messages should properly show.
This was added to reduce the database load on data that doesn't necessarily need to be instantly up to date.

Re: New message not appearing on portal 2.1.0

Posted: 24. November 2015 00:46
by mahugin
Hello Marc,

Thank you very much for your reply :). BTW, I love your portal, it is extremely well done!!

I did some testing and if I stay connected (logged in), then the message does not appear (even after 30 secondes). It is only when I log off that the new messages appear in the new post module on the portal. Would you know what might be causing that and how to fix this :)?

Also, if I prefer the messages to appear live, like on the index forum, can this be changed (file & sql script)?

Thank you very much for your help!

Re: New message not appearing on portal 2.1.0

Posted: 26. November 2015 20:31
by mahugin
Hello Marc,

Did you get a chance to look at my reply. I really would like to fix this, please :)

Re: New message not appearing on portal 2.1.0

Posted: 29. November 2015 15:53
by mahugin
Since I am not going anywhere with this issue, I did a temporary fix but I would need your help to tweak it.

I did a file call cache.php with the following script (where it clears the cache):
<?PHP
// Deletes everything but index.htm and .htaccess from the phpBB cache directory

$cachedir = "cache";

$dir = opendir($cachedir);

// Delete everything but index.htm and .htaccess

while( $file = readdir( $dir ) ) {
if ($file == "." or $file == ".." or $file == "index.htm" or $file == ".htaccess") {
continue;
}
echo "Deleting $cachedir/$file ... ";
if (unlink("$cachedir/$file")) {
echo "Done.<BR>";
} else {
echo "Not done.<BR>";
}
}

// Do not remove subdirectory because we want two files to remain.
//
// if (rmdir($cachedir)) {
// echo "<BR>Directory $cachedir was completely deleted.<BR>";
// } else {
// echo "<BR>Directory $cachedir could not be completely deleted. Check permissions.";
// }

?>
I then included this line in the app.php
exec( "php cache.php > /dev/null" );
This solve the problem that I had where the New Message block was not updating itself (showing new posts).

Now, I would like to implement a trigger that would clear the cache every refresh of the page but at an interval of 30 seconds. For example, the first user that refreshes the page would clear the cache but the cache would not be cleared for the next 30 seconds even if somebody else do a refresh within this 30 seconds. Therefore, what would I need to add to this script to get this feature?

Thank you!

Re: New message not appearing on portal 2.1.0

Posted: 1. December 2015 02:00
by mahugin
Anyone :)?

Re: New message not appearing on portal 2.1.0

Posted: 1. December 2015 17:22
by Kirk
Maybe it works so:
Open: root/ext/board3/portal/modules/news.php and root/ext/board3/portal/ portal/fetch_posts.php
Find:

Code: Select all

$result = $this->db->sql_query($sql, 30);
Change the value of 30 according to your wishes.

Re: New message not appearing on portal 2.1.0

Posted: 2. December 2015 03:27
by mahugin
Thank you very much for your hint but it is unfortunatly doing the same thing :(. Messages only appear if I clear the cache or when I log off. Don't know why it is working perfectly in the forum index and not on the portal. I only have this problem on the portal. I tried to uninstall and install again and I am getting the exact same problem.

Re: New message not appearing on portal 2.1.0

Posted: 7. December 2015 11:55
by Marc
Have you tried removing the occurences of the above code to look like this?

Code: Select all

$result = $this->db->sql_query($sql);
That will remove the caching of the queries.

Re: New message not appearing on portal 2.1.0

Posted: 8. December 2015 02:11
by mahugin
Hello Marc,

I tried but the problem is the same. Everytime I clear the cache, the mew message appears on the portal. Mystery! It only do this on the portal, I don't have this problem in the forum index.

Re: New message not appearing on portal 2.1.0

Posted: 8. December 2015 03:52
by mahugin
Ok Marc, I have a good one for you ;)

I did 1 post and refreshed the screen every 2-3 seconds (For a maximum of 10 minutes). At 9 minutes, the message appeared on the portal. I therefore did another message and same result!! The messages appear after +/- 9 minutes.

Do you understand this??

Re: New message not appearing on portal 2.1.0

Posted: 10. December 2015 10:38
by Marc
Seems like a part of the caching was missed earlier. You should take a look at this:
https://github.com/board3/Board3-Portal ... s.php#L269

The 600 at the end caches it for 10 minutes. Reduce that to a normal value like 30 for 30 seconds.

It should be solved by this PR: https://github.com/board3/Board3-Portal/pull/667

Re: New message not appearing on portal 2.1.0

Posted: 10. December 2015 14:45
by mahugin
Marc,

It works!!! I had to clear the cache in the admin panel after changing this setting and the posts are now showing :)

Case closed :)

Re: New message not appearing on portal 2.1.0

Posted: 28. July 2016 02:42
by HomeRacingWorld
Thanks for this code and clear instructions on performing the fix.

Was having the same issue. Now the Portal updates as it should.

Thank you again.