View Full Version : SQl Error missing $ppg_options[gallery_catsorderby] and [gallery_catsdirection]
November 15th, 2010, 04:43 AM
I have an error on two separate installs of gallery on two VB4.0.8 sites. This happens in the admin when I try to edit categories and when viewing the gallery. The error shows as an SQL-Error and always the error is a missing in the ORDER BY field in a category query, so:
Database error in vBulletin 4.0.8:
SELECT catid, title, parent, hasimages, displayorder FROM vb_ppgal_categories ORDER BY , hasimages;
MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' hasimages' at line 1
Error Number : 1064
Request Date : Monday, November 15th 2010 @ 10:34:07 AM
Error Date : Monday, November 15th 2010 @ 10:34:07 AM
Script : http://www.rearparty.co.uk/admincp/vba_gallery_admin.php?do=dirmanager
Referrer : http://www.rearparty.co.uk/admincp/index.php?do=nav
IP Address : 192.168.168.2
Username : Good_CO
Classname : vB_Database
MySQL Version : 5.1.34-log
The temporary cure for this is to edit the settings and adjust the order by options, save and all is OK again for a seemingly random before the same problem reappears and the gallery goes offline.
Any help appreciated!
November 15th, 2010, 04:28 PM
hmm this error was present in beta 2 or beta 3, but i am positive it was fixed in RC1..
are you sure when you updated to gold, you copied ALL the files in ALL subdirectories (forums/includes and forums/admincp) ?
(it could also come from a hack killing ppg_options - stopping the settings from being fetched in datastore)
November 16th, 2010, 12:46 AM
Hi, thanks for the reply,
I have only just bought the galleries - within the last two weeks so I assume they are bang up to date? I definitely copied all files as the packages were unzipped directly on to the server and simply 'mv'd into place. They were also downloaded and installed separately as I bought, installed and imported on to one before buying the other.
Both vb installs are on the same server, although it's pretty standard up-to-date CentOS. The caching enhancements are x-cache (correctly with different prefixes) and vboptimize. Could either of those be the problem?
I can of course hard code in the two variables if necessary, although is it likely that other less obvious problems are also happening?
November 16th, 2010, 01:17 AM
We had problems with xcache in the past, but only on the front end, (gallery tab disappearing at some moments) but there shouldnt be any problems on the back end..
Do the following.. disable vboptimize and see if the error persists..
If yes, there is a workaround that will fix the front end..
somehow... I dont know why, x-cache, sometimes sets the vbgallery datastore to empty (allthough it is fetched like all the rest)
it is then regenerated at the moment when you save any options..
hard coding those 2 options will probably work on the backend..(as they are the only 2 needed) but certainly not on the front-end..
There is a very clumsy workaround for the front end.. (it adds a query, but only on the moment where the settings are gone.)
I will install xcache on my localhost and see if i can reproduce the problem.
For the moment do this:
1. check if vboptimize is the issue.
Disable the product, and see if it happens again..
do the following:
$ppg_vars = array();
and right below add:
/* START::NEW CODE ADDED */
$ppg_vars['fetch_options'] =( !is_array($vbulletin->adv_gallery_opt)
) ? true : false;
$ppg_vars['fetch_catc'] =( !is_array($vbulletin->gallery_c_cache)
) ? true : false;
$ppg_vars['fetch_modc'] =( !is_array($vbulletin->gal_mod_cache) ) ? true : false;
$ppg_vars['fetch_ugroups'] =( !is_array($vbulletin->gallery_ugroups)
) ? true : false;
$ppg_vars['fetch_stats'] =( !is_array($vbulletin->ppg_stats)
) ? true : false;
if($ppg_vars['fetch_options'] OR $ppg_vars['fetch_catc'] OR $ppg_vars['fetch_modc'] OR $ppg_vars['fetch_ugroups'] OR $ppg_vars['fetch_stats'])
$itemlist = "'adv_gallery_opt', 'gallery_c_cache', 'gal_mod_cache', 'gallery_ugroups', 'ppg_stats'";
$dataitems = $vbulletin->db->query_read("
FROM " . TABLE_PREFIX . "datastore
WHERE title IN ($itemlist)
while ($dataitem = $vbulletin->db->fetch_array($dataitems))
if($dataitem['title'] == 'adv_gallery_opt')
$vbulletin->adv_gallery_opt = unserialize($dataitem['data']);
else if($dataitem['title'] == 'gallery_c_cache')
$vbulletin->gallery_c_cache = unserialize($dataitem['data']);
else if($dataitem['title'] == 'gal_mod_cache')
$vbulletin->gal_mod_cache = unserialize($dataitem['data']);
else if($dataitem['title'] == 'gallery_ugroups')
$vbulletin->gallery_ugroups = unserialize($dataitem['data']);
else if($dataitem['title'] == 'ppg_stats')
$vbulletin->ppg_stats = unserialize($dataitem['data']);
/* END::NEW CODE ADDED */
Keep the start and end rems, so you can remove it when a definite fix is found.
Let me know if this removes the front-end error.
November 16th, 2010, 02:58 PM
Hi Luciano, thanks very much for the detailed reply. Since I wrote I disabled vboptimize and the problem didn't appear again, but... it's been enabled again for the last 6 hours and the problem hasn't happened again either! I will just have to wait and test the disable solution if it happens again.
If it is a problem with vboptimize and it happens again then I will go with your modification above as vboptimize makes such a big difference on one of my sites that I consider it just about essential.
By the way, the tab did disappear and going to the gallery front end, I'm pretty sure, produced a very similar error SQL error; category related and missing the sort by variables. I didn't note this down though so couldn't confirm that unless it happens again.
I apologise for that vague reply, and thanks again for your input.
November 16th, 2010, 03:13 PM
No problem, just as info.. when the sort by vars a missing, that means that ALL the vbgallery options (ie ppg_options) are missing.
This happens if datastore variables are not fetched. (they should be fetched as serialized array and placed in array $vbulletin->adv_gallery_opt.
this is then assigned to $ppg_options:
$ppg_options =& $vbulletin->adv_gallery_opt;
(so if you check xcache these are the vars to look for)
I would though not be 100% sure that vboptimize is faulty alone, because i've seen this happen with xcache alone. So I think that it might be some xcache setting that makes vboptimize behave that way.
November 24th, 2010, 10:26 AM
Hi Luciano, after a bit of reading and playing, I've decided to use this solution as xcache basically is essential for me: http://www.photopost.com/forum/bugs-vbulletin-3-6x/134670-vb_datastore_xcache-2.html
Thanks for the pointer about the Flash uploader and for a great mod.
December 23rd, 2010, 10:31 AM
I did need to use your fix after all. The xcaxhe work around is incomplete because pages other than the gallery use the gallery, eg. User profile and the menu. These were disappearing as unpredictably as before on one of my sites. Your fix above seems to have done the trick though. Thanks.
vBulletin® v3.8.1, Copyright ©2000-2014, Jelsoft Enterprises Ltd.