PDA

View Full Version : Style Chooser Shows Up On One Server But NOT The Other??


SnapOff Racing
01-10-2011, 09:08 AM
*** PROBLEM SOLVED IN POST#11 ***

Ok this the most bizarre thing I have seen in awhile so I had to post up and ask on this one.

My style chooser at the bottom of my forum will work when I have my forum/database hosted on my local server here at home. However when I take the EXACT SAME FORUM (complete database dump and all forum directory files) and move it over to my dedicated server online the Style Chooser stops working :confused: It's the most bizarre thing ever and I can't figure out WHY it does it. The ONLY file that I have to change is my config.php because obviously there are a few settings that are different.

Can anyone think of ANYTHING that would cause this? This happens with the DEFAULT style and my CUSTOM style. They both do the exact same thing when moved from server to server. Any ideas? :confused:

metalguy639
01-10-2011, 02:56 PM
When you moved it did you recheck those settings in the vb admincp? maybe they were disabled and need to be re-enabled.

SnapOff Racing
01-11-2011, 01:43 AM
Nope I used the EXACT SAME database dump from one server to another as well as the EXACT SAME file system dump as well. The ONLY file that is different is the config.php file but I seriously can't find ANYTHING in that file that would cause this.

kh99
01-11-2011, 01:56 AM
Maybe try going to "Maintenance->Update Counters" and rebuild styles, maybe the problem is that the cache isn't there.

SnapOff Racing
01-11-2011, 02:37 AM
Still nothing :erm:

Gotta be one of the most bizarre things I have seen in awhile that's for sure. I've been in awe all day lol

metalguy639
01-11-2011, 03:48 AM
Did you move the board to a new domain or a different domain from the original domain it was installed on? If so you will need to change your URL settings in the admincp. Not sure if that would solve it or not though.

SnapOff Racing
01-11-2011, 05:23 AM
Nope same domain just different servers.

I have tried...
- Rebuilding the styles
- Tried with the Default Style and even made sure that all templates were reverted to stock
- Importing a new style
- Cruised thru the entire config.php file and checked everything
- Enabled/Disabled AdminCP -> vB Options -> Store CSS Stylesheets as Files?
- Disabled all plugins via the config.php file

I dunno what the deal is but it just will NOT work on the hosted server. Everything works just fine on the local server. I haven't found any other features that aren't functioning properly either just the damn Style Chooser lol. I could understand if this was a custom skin issue but even the Default Skin is doing the same thing.

kh99
01-11-2011, 06:07 AM
In global.php there's this code:

// ################################################## ###########################
// Generate Style Chooser Dropdown
if ($vbulletin->options['allowchangestyles'] AND empty($_POST['do']))
{
$stylecount = 0;
$quickchooserbits = construct_style_options(-1, '--', true, true);
$show['quickchooser'] = ($stylecount > 1 ? true : false);
unset($stylecount);
}
else
{
$show['quickchooser'] = false;
}


So you could temporarily change that first line like this:

// if ($vbulletin->options['allowchangestyles'] AND empty($_POST['do']))
if (true)

and see if anything shows up (that line starting with 'if' shold really be all on one line but the CODE tag seems to be wrapping it).

Then if that doesn't change anything try this:

// $show['quickchooser'] = ($stylecount > 1 ? true : false);
$show['quickchooser'] = true;

anyway, you probably get the idea.

SnapOff Racing
01-11-2011, 06:38 AM
Ok so when I tried the first suggestion you made commenting out the line and adding the if (true) it didn't work.

Then I tried changing
$show['quickchooser'] = false; -> $show['quickchooser'] = true;

// Generate Style Chooser Dropdown
//if ($vbulletin->options['allowchangestyles'] AND empty($_POST['do']))
//{
// $stylecount = 0;
// $quickchooserbits = construct_style_options(-1, '--', true, true);
// $show['quickchooser'] = ($stylecount > 1 ? true : false);
// unset($stylecount);

//}
//else
{
$show['quickchooser'] = true;
}

Which FINALLY got the dropdown box to show up but unfortunately no styles :mad:


I also tried changing $stylecount = 0; -> $stylecount = 3;

// Generate Style Chooser Dropdown
if ($vbulletin->options['allowchangestyles'] AND empty($_POST['do']))

{
$stylecount = 3;
$quickchooserbits = construct_style_options(-1, '--', true, true);
$show['quickchooser'] = ($stylecount > 1 ? true : false);
unset($stylecount);

}


Which did the same thing as above where it displayed a style chooser box with nothing in it.

Any other ideas? Sounds like we are on the right track now even though this seems completely retarded having to FORCE ENABLE this when it's working perfectly fine on the local server :rolleyes: I don't really care as long as I can get it working again.

I wonder if it could be a server side issue? Like maybe the host's version of MySQL or PHP is causing the issue. I don't see how in the hell that this is the ONLY THING that isn't working properly. I would think that I would be having issues somewhere else as well but nothing.

kh99
01-11-2011, 07:17 AM
Well, the idea isn't to try to force it to work, we just want to figure out why it's not working. I think we've figured out that it's something in the function construct_style_options that isn't working right.

So now I'd say put the global.php code back to the original and go to includes/functions.php and find construct_style_options, and try to figure out why that isn't working (because it not only figures out what goes in the dropdown, it also sets $stylecount). There's this part:

// check to see that the current styleid exists
// and workaround a very very odd bug (#2079)
if (is_array($vbulletin->stylecache["$styleid"]))
{
$cache =& $vbulletin->stylecache["$styleid"];
}
else if (is_array($vbulletin->stylecache[$styleid]))
{
$cache =& $vbulletin->stylecache[$styleid];
}
else
{
return;
}

which could return nothing, that's what made me think that it might be the style cache. There's also the possibility that one of the foreach loops under that isn't executing. So I guess either way, there's probably something wrong with $vbulletin->stylecache. (ETA: it's actually a little more complicated than that since the function calls itself to build the lower levels of the style "tree").

Unfortuantely it'll probably be harder to understand why it's failing than to narrow down which line of code is responsible. I don't understand the format of the stylecache - I would have guessed that it was just an array of styles, but looking at this code, that doesn't make sense.

SnapOff Racing
01-11-2011, 09:11 AM
OMG I figured it out!!! Thanks to your pushing in the right direction I discovered something...

When you said to check the functions.php file I looked thru it at the part you specified and didn't really see anything that I could change. HOWEVER, below that section I noticed

// ################################################## ###########################
/**
* Saves the specified data into the datastore
*
* @param string The name of the datastore item to save


Which made a light bulb light up in my head! It made me think about the datastore file that is referenced in the config.php Remember how I was saying earlier that I had been moving the ENTIRE SITE including database AND filesystem and that the ONLY FILE that was different was the config.php. Well so I commented out the
//$config['Datastore']['class'] = 'vB_Datastore_Filecache';
in the config.php file and VOILA!! Style chooser is now working again!!!

BUT unfortunately the fun doesn't stop there.

- I go back into the config.php and uncomment $config['Datastore']['class'] = 'vB_Datastore_Filecache';
- Delete the datastore_cache.php file and replace it with a stock vB datastore_cache.php
- Then I go into the AdminCP -> Maintenance -> Update Counters -> Rebuild Styles

But then the problem is now back again, missing style chooser. So apparently clearing out the datastore_cache.php file is still causing it to rebuild the style cache with whatever issue is in there. I was thinking ok maybe there is something wrong with one of the styles but as I stated before it does this to the Default style as well. Also as I mentioned when I comment out the datastore line in the config.php file to disabled datastore caching the style chooser starts working fine again.

I even tried going into the config.php and disabling all my plugins, and then retrying the procedure I listed above. Still did the same thing. So I don't think it's a plugin issue.

Any ideas?

Thanks again for your help though, if you hadn't shoved me into the right direction I wouldn't have seen that line in the functions.php file referencing datastore cache and that damn light bulb would have never gone off in my head lol :D

--------------- Added 1294745431 at 1294745431 ---------------

Ok after some more research now that I had some more ammo to search with via Google I have found that this is apparently a bug in PHP v5.2 which is what my HOST uses on their servers. The reason that this wasn't happening when I was putting the forum on my local server is because I am running PHP v5.3

The solution that worked for me to fix the issue is referenced in the last post on this page...

http://tracker.vbulletin.com/browse/VBIV-9235

Thanks again for all your help everyone, and especially kh99 :up: