[RC] SQL Cache (Cached Generation)

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
greatgamer
Registered User
Posts: 657
Joined: Wed Nov 27, 2002 8:47 pm

Post by greatgamer »

I recommend this mod to every phpBB webmaster, it really speeds things up a lot. I am curious, I looked at some of the sql cache files it creates in the /cache directory and most of the files only display the following code:

Code: Select all

<?php $set = array (
); ?>
Does this do that for you as well, or is it because if comes across one of my custom mods and since there is no sql cache code in place for it, it just generates that empty cache file? I also wonder how many files like that it would create because right now it is at around 850 cache files. Thanks.

User avatar
stevemagruder
Registered User
Posts: 210
Joined: Wed Jul 02, 2003 2:05 pm
Location: Louisville, KY
Contact:

Post by stevemagruder »

greatgamer wrote: I recommend this mod to every phpBB webmaster, it really speeds things up a lot. I am curious, I looked at some of the sql cache files it creates in the /cache directory and most of the files only display the following code:

Code: Select all

<?php $set = array (
); ?>
Does this do that for you as well, or is it because if comes across one of my custom mods and since there is no sql cache code in place for it, it just generates that empty cache file? Thanks.


Most? That doesn't sound right. That would suggest many queries that are returning zero results.
Steve Magruder - WebCommons :: Media
Administrator for the Louisville History & Issues discussion board

greatgamer
Registered User
Posts: 657
Joined: Wed Nov 27, 2002 8:47 pm

Post by greatgamer »

Hmm yeah. There are about 700 files like that. Do you know how many sql cache files you have? I can only assume it is due to the tons of mods I have installed on my forum and when it comes across those custom files it returns zero results. Is that a correct assumption?

User avatar
stevemagruder
Registered User
Posts: 210
Joined: Wed Jul 02, 2003 2:05 pm
Location: Louisville, KY
Contact:

Post by stevemagruder »

greatgamer wrote: Hmm yeah. There are about 700 files like that. Do you know how many sql cache files you have? I can only assume it is due to the tons of mods I have installed on my forum and when it comes across those custom files it returns zero results. Is that a correct assumption?


It's hard to say unless I knew what the mods were. Perhaps this mod is in conflict with another mod you installed, or more probable, this mod wasn't installed successfully.
Steve Magruder - WebCommons :: Media
Administrator for the Louisville History & Issues discussion board

Thoul
Registered User
Posts: 810
Joined: Sun Jun 23, 2002 1:25 am
Location: USA
Contact:

Post by Thoul »

I ran into a bug with this mod tonight. I'm using mysql4.php, and it seems that the changes to the sql_fetchrowset function do not create the cache correctly. All the rows returned are cached with a value of NULL. Take for example, this code:

Code: Select all

$images = $db->sql_fetchrowset($result);
The cache file created by this is:

Code: Select all

<?php $set = array (
  0 => NULL,
  1 => NULL,
  2 => NULL,
  3 => NULL,
  4 => NULL,

// I cut the rest out, but you get the idea! 19 lines of NULLs.

); ?>
I found two ways to fix this. The first is to rewrite the code to use sql_fetchrow, which works fine. That's not an extremely practical solution for me, as I use sql_fetchrowset in several of my mods and custom codings.

The second fix is to change this part added by the mod to sql_fetchrowset (be careful that you don't change the part in sql_fetchrow!):

Code: Select all

				if($this->caching)
				{
					if($this->row[$query_id] === false)
					{
						$this->write_cache();
					}
					$this->cache[] = $this->row[$query_id];
				}
I changed it to this, and then the cache was created correctly:

Code: Select all

				if($this->caching)
				{
					if($this->rowset[$query_id] === false)
					{
						$this->write_cache();
					}
					$this->cache[] = $this->rowset[$query_id];
				}
Last edited by Thoul on Thu Dec 28, 2006 4:18 pm, edited 1 time in total.

User avatar
stevemagruder
Registered User
Posts: 210
Joined: Wed Jul 02, 2003 2:05 pm
Location: Louisville, KY
Contact:

Post by stevemagruder »

I'm using this mod with mysql4, and I'm not seeing the results you were getting. Was this happening in specific uses of the cache, or overall?
Steve Magruder - WebCommons :: Media
Administrator for the Louisville History & Issues discussion board

Thoul
Registered User
Posts: 810
Joined: Sun Jun 23, 2002 1:25 am
Location: USA
Contact:

Post by Thoul »

It only happened with using $db->sqlfetchrowset(). It will happen every time that is used, though, because the mod uses the wrong variable name in that function. It uses $this->row there, but that variable is not set at that point. sql_fetchrow uses $this->row, but sql_fetchrowset uses $this->rowset instead.

User avatar
stevemagruder
Registered User
Posts: 210
Joined: Wed Jul 02, 2003 2:05 pm
Location: Louisville, KY
Contact:

Post by stevemagruder »

Thoul wrote: It only happened with using $db->sqlfetchrowset(). It will happen every time that is used, though, because the mod uses the wrong variable name in that function. It uses $this->row there, but that variable is not set at that point. sql_fetchrow uses $this->row, but sql_fetchrowset uses $this->rowset instead.


Thanks Thoul for bringing this to our attention. Everyone should update their code accordingly.
Steve Magruder - WebCommons :: Media
Administrator for the Louisville History & Issues discussion board

Amailer
Registered User
Posts: 105
Joined: Fri Aug 22, 2003 11:03 pm
Location: www.AaronDM.com
Contact:

Post by Amailer »

I just installed this mod and wow I almost got a heart attack- I was testing it out and suddenly I got this:

Code: Select all

This board has no forums
All my cache files have NULL and I have applied the fix above :(

Code: Select all

<?php $set = array (
  0 => NULL,
  1 => NULL,
  2 => NULL,
  3 => NULL,

...
); ?>

***EDIT***
No, im an idiot, that was the fix, I just applied it in fetchrow, totally killed the purpose (infact, did the total opposit XD). Nice mod, love it- some few minor errors in the install.txt only (I'll post later today)
>> New AaronDM - Help with phpBB Setups, Mods or more? Contact me!
>> Visit Compsci - For all students interested in computer science.

BabyLove
Registered User
Posts: 59
Joined: Tue May 20, 2003 1:19 pm
Location: slovenia / ljubljana
Contact:

Post by BabyLove »

hey guys :)

so ... is it save to install this mod?
does it really work? :roll:
Lana aka BabyLove
www.fu-student.com

Amailer
Registered User
Posts: 105
Joined: Fri Aug 22, 2003 11:03 pm
Location: www.AaronDM.com
Contact:

Post by Amailer »

It seems pretty safe to install and it definitely works :D

Though, what if someone added the cache to um the admin_board.php where the SMTP password or something was sent, like wise admin_user.php (even though yes, its totally useless of doing so), and that user had apache directory listing on, won't it um show the users details in one of the cache files?
>> New AaronDM - Help with phpBB Setups, Mods or more? Contact me!
>> Visit Compsci - For all students interested in computer science.

Peter77sx
Registered User
Posts: 3259
Joined: Wed Nov 09, 2005 2:51 pm

Post by Peter77sx »

It works and the support thread is here
http://www.phpbbstyles.com/viewtopic.php?p=51708#51708

Might find it useful to read before isntalling. :)

Thoul
Registered User
Posts: 810
Joined: Sun Jun 23, 2002 1:25 am
Location: USA
Contact:

Post by Thoul »

Though, what if someone added the cache to um the admin_board.php where the SMTP password or something was sent, like wise admin_user.php (even though yes, its totally useless of doing so), and that user had apache directory listing on, won't it um show the users details in one of the cache files?


No, because the cache files are .php files. They would just show a blank page.

stephen_a
Registered User
Posts: 103
Joined: Thu Mar 18, 2004 12:52 pm

Post by stephen_a »

Is it me or is this mod not EasyMod friendly?

The code changes in functions_post are not in line order - it does changes on towards the end of the file [ORDER BY smilies_id";] before doing changes earlier in the file [if (!$db->sql_query($sql, BEGIN_TRANSACTION))]

Thoul
Registered User
Posts: 810
Joined: Sun Jun 23, 2002 1:25 am
Location: USA
Contact:

Post by Thoul »

The code changes in functions_post are not in line order


I noticed that, too. I think it was true of another file or two as well.

Post Reply

Return to “[2.0.x] MODs in Development”