[Fix] D/L top rated files not working MySQL v5.0.12 & up

Support for IntegraMOD 141

Moderator: Integra Moderator

[Fix] D/L top rated files not working MySQL v5.0.12 & up

PostAuthor: melamkish » Wed Apr 30, 2008 7:15 pm

This applies to boards hosted on servers running MySQL v5.0.12 or higher.

In trying to get some quirks out of a new board I have been setting up, I ran into an issue where the download area top list, top rated files function was returning an sql error. The error returned was 1054, "Unknown column in f1.file_id as $file_ids"

This feature worked on my own board, but not the new one. Looking at the difference in the server software revealed that the new board was running under MySQL 5.0.25 and my own board was running under version 4.1.22. Figuring that the problem must be related to the database version, I dug into the version 5 MySQL manual and this is what I found.

At v5.0.1, the use of parenthesis for join operations was optional and the operation read from left to right. At v5.0.12, some operations required the use of parenthesis to bring MySQL into compliance with the sql standard. Think of it like a simple math equation. If you put the parenthesis in a different place, you can change the result.

So with this in mind, I came up with the following fix



#
#-----[ OPEN ]------------------------------------------
#
/pafiledb/modules/pa_toplist.php

#
#-----[ FIND ]------------------------------------------
#
FROM " . PA_FILES_TABLE . " AS f1, " . PA_CATEGORY_TABLE . " AS c
#
#-----[ REPLACE WITH ]------------------------------------------
#
FROM (" . PA_FILES_TABLE . " AS f1, " . PA_CATEGORY_TABLE . " AS c)
#
#-----[ SAVE & CLOSE ALL FILES ]--------------------------
#
#End

This fix must be applied twice as the [FIND] occurs twice, once at line 194 and again at line 406 in an unmodified file.

I ran the search function to ensure this line only occurred twice in the file
Last edited by melamkish on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Too many projects, too little time.
User avatar
melamkish
Newbie
Newbie
 
Posts: 28
Likes: 0 post
Liked in: 0 post
Joined: Fri Jul 21, 2006 4:46 pm
Cash on hand: 0.00

Re: [Fix] D/L top rated files not working MySQL v5.0.12 &

PostAuthor: Helter » Wed Apr 30, 2008 11:50 pm

nice work. I added it here to check php4 compatibility. Ill add it when I update 141
Last edited by Helter on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
"Success is getting what you want. Happiness is wanting what you get." - Dale Carnegie
User avatar
Helter
Administrator
Administrator
 
Posts: 4554
Likes: 40 posts
Liked in: 116 posts
Images: 0
Joined: Sat Mar 11, 2006 4:46 pm
Cash on hand: 1,959.15
Location: Seattle Wa
IntegraMOD version: phpBB2x

Re: [Fix] D/L top rated files not working MySQL v5.0.12 &

PostAuthor: DjPorkchop » Thu May 01, 2008 12:33 pm

The sad part is, I fixed mine way back when and never posted it here ;-) and Im running php4 and mysql 5 and it works just ifne with it fixed.
Last edited by DjPorkchop on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
"Don't gain the world and lose your soul, wisdom is better than silver and gold" -Bob Marley

If you build it, I can break it! ~ Whispered in the tone of the movie Field of Dreams.
User avatar
DjPorkchop
Administrator
Administrator
 
Posts: 1593
Likes: 136 posts
Liked in: 26 posts
Images: 12
Joined: Fri Apr 21, 2006 7:59 pm
Cash on hand: 1,575.25
Location: Illinois
IntegraMOD version: phpBB2x


Return to IntegraMOD 141

Who is online

Registered users: App360MonitorBot, Bing [Bot], Google [Bot]