Status
Not open for further replies.

iPhoneclub

Customer
I think I'm running into a bug with vB Optimise Pro 2.0.1 and a custom plugin for mobile style redirection in combination with vB Optimise's setting 'Guest Full Page Caching'. In some occurrences guest users (on desktop-browsers) get the mobile style instead of the normal style. I think this is because some mobile guest user visited the page at the exact instant when the cache was ready for a refresh. I already have Cache Styles set to 'Off', but that hasn't helped anything. My opcode cache is set to 'memcached'.

The custom plugin I'm using runs at hook 'style_fetch' with an execution order of 5.
Code:
// BROWSER DETECT  

$safari = array( 
"iPod",  
"iPhone"  
);  

$browsers = array( 
"Windows CE", 
"WebTV", 
"AvantGo", 
"Blazer", 
"PalmOS", 
"lynx", 
"Go.Web", 
"Opera Mini", 
"Elaine", 
"ProxiNet", 
"ChaiFarer", 
"Digital Paths", 
"UP.Browser", 
"Mazingo", 
"T68", 
"Syncalot", 
"NetFront", 
"Danger", 
"Symbian", 
"Nokia", 
"Xiino", 
"AU-MIC", 
"EPOC", 
"BlackBerry", 
"Wireless", 
"Handheld" 
); 

if(preg_match('/('.implode('|', $safari).')/i', $_SERVER['HTTP_USER_AGENT'], $match)) { 
$mobile=2; 
} else if(preg_match('/('.implode('|', $browsers).')/i', $_SERVER['HTTP_USER_AGENT'], $match)) { 
$mobile=1; 
} else if (isset($_SERVER['HTTP_UA_OS'])) { 
if (strstr($_SERVER['HTTP_UA_OS'],"POCKET PC") !== false) { 
$mobile=1; 
} 
} else { 
$mobile=0; 
} 
if ($_GET['no_mobile'] == 3) { 
$styleid=2; 
$vbulletin->options['styleid'] = 2;//Terug naar normale view 
//} else if ($vbulletin->userinfo['userid']==1) { 
//$styleid=9; 
//$vbulletin->options['styleid'] = 9;//Test-skin 
} else if ($mobile==2) { 
$styleid=5; 
$vbulletin->options['styleid'] = 5; // iPhone/iPod - vB default 
} else if ($mobile==1) { 
$styleid=3; 
$vbulletin->options['styleid'] = 3;// PDA/Smartphone - mobile template
 
Hi there,

I'll look into this when I'm back from vacation, it's possibly a style-issue cache with Guest Cache completely as opposed to just with this specific mod, but I'll be able to tell when I look further info it :)
 
I'm still seeing problems with vbOptimise 2.3.0 :( With 2.3.0 (cache: Memcached) guests sometimes see the forum (forumhome/forumdisplay/showthread) without any style applied, as shown in the attachment (previously they would get the mobile template, as posted in this thread). I've disabled vbOptimise for now, but would really love to have this permanently fixed.
 

Attachments

  • no-style.webp
    no-style.webp
    9.9 KB · Views: 15
Hi iPhoneclub,

The fix was confirmed for stock styles and vBulletins standard way of switching styles (for guests it's via cookies). Is there any chance you can PM me your product to switch styles for mobiles (or is the entire code in that first post?). I won't need the mobile style, just the code which invokes the styles for users :)

Thanks.
 
The entire code is in the first post and it's just a small plugin at style_fetch :) Please note: previously vbO would show the mobile style for guest users, in 2.3.0 guest users see no style at all.
 
Thanks. This should resolve your issue with the custom modification, once confirmed I'll take the patch live :)

Open: ./vboptimise/core/class_vboptimise.php
Find:
Code:
	private static function key_guestcache()
	{
		static $key;

		if (!$key)
		{
			$key = md5(implode('', @array_merge(array(
				THIS_SCRIPT,
				$_COOKIE[COOKIE_PREFIX . 'userstyleid'],
				$_COOKIE[COOKIE_PREFIX . 'languageid'],
			), $_REQUEST)));
		}

		return $key;
	}

Replace with:
Code:
	private static function key_guestcache()
	{
		global $vbulletin;
		static $key;

		if (!$key)
		{
			$key = md5(implode('', @array_merge(array(
				THIS_SCRIPT,
				$_COOKIE[COOKIE_PREFIX . 'userstyleid'],
				$_COOKIE[COOKIE_PREFIX . 'languageid'],
				$vbulletin->options['styleid'],
			), $_REQUEST)));
		}

		return $key;
	}

Save/upload :)
 
Bad news, still got a page without any styling applied, although the CSS and JS is there in the <head> section. I noticed something interesting: we use vbSEO (3.5, latest) and the page title was not parsed correct. Instead, I see this:
Code:
<title><!--VBSEO_RR_2_NOHTML--></title>
Since vbSEO also does some caching and I have enabled Memcached for vbSEO as well (but, different prefix ofcourse), could there be some kind of tripping up between vbSEO and vbOptimise?

I can send you the no-styling-applied page source code if you want, but preferably through PM (or through MSN, I added you some days ago)
 
I'll upgrade my vBSEO install on my local to try reproduce this error, there shouldn't be any conflicts but it looks like the guest data is being cached -before- vBSEO runs (which only should happen during cache output). It might be silly but you should try flushing cache too - what you saw might have been from a previous cached page (depends how many minutes you cache guest content for).
 
Resolved, looks like there was an execution order issue between vBSEO/vB Optimise, this only affected vB3 users. If you're experiencing the same issue re-downloading/re-importing the vb3 xml product for vB Optimise will resolve the error.
 
Status
Not open for further replies.

Legacy vB Optimise

vBulletin 3.8.x vBulletin 4.x.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
1,980
Customer rating
0.00 star(s) 0 ratings
Back
Top