Hi All
Just wanted to run this by some on the list. Been scratching my head on how to deal with file caching and using the MobileFrontend extension on one domain. I know the preferred method is a mobile domain and a desktop domain. I have no way of installing AMF and the manual page is a little vague on the rest of what to do, .htaccess, etc. Dealing with two domains and not being able to create symlinks is another hurdle, I'd have to maintain two instances of Mediawiki(as best as I can tell). A couple of references to how Wikimedia does it are dead links so I started brainstorming.
I came across an old post about dealing with file caching using the $wgRenderHashAppend(thanks Platonides!) to set file caching dynamically. Here is what I came up with using a script to detect mobile devices by inserting this at the top of my LocalSettings.php. I know it won't handle them all.
//Mobile detect if (!defined('REQUEST_MOBILE_UA')) { define('REQUEST_MOBILE_UA', '(iPhone|Android|MIDP|AvantGo|BlackBerry|J2ME|Opera Mini|DoCoMo|NetFront|Nokia|PalmOS|PalmSource|portalmmm|Plucker|ReqwirelessWeb|SonyEricsson|Symbian|UP.Browser|Windows CE|Xiino)'); } preg_match('/' . REQUEST_MOBILE_UA . '/i', $_SERVER['HTTP_USER_AGENT'], $match); if (!empty($match)) { $wgRenderHashAppend = 'mobile'; } else { $wgRenderHashAppend = 'desktop'; } //End Mobile detect
Then I set my file cache to append the result.
$wgFileCacheDirectory = "$IP/cache/html/$wgRenderHashAppend";
It seems to work as far as I can tell and you are able to switch back and forth between desktop and mobile. Once you make the switch, you stay in desktop until you request mobile again. Even creates the file cache pages in the correct directory, /desktop if they don't exist while on mobile. Switch back to mobile view and you will be served cache pages from the mobile directory it they exist, otherwise they are created in the mobile directory.
Am I missing anything? Advice welcome.
Thanks Tom
mediawiki-l@lists.wikimedia.org