Created
December 6, 2010 21:33
-
-
Save webmozart/730993 to your computer and use it in GitHub Desktop.
ProjectConfiguration adaptation to prevent sessions starting for bots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// avoid session starting for bots | |
$agents = array( | |
'googlebot', | |
'yahoo! slurp', | |
'baiduspider', | |
'sosospider', | |
'bingbot', | |
'nagios-plugins', | |
); | |
foreach ($agents as $i => $agent) | |
{ | |
$agents[$i] = preg_quote($agent, '/'); | |
} | |
if (preg_match('/' . implode('|', $agents) . '/i', $_SERVER['HTTP_USER_AGENT'])) | |
{ | |
sfConfig::set('sf_factory_storage', 'sfNoStorage'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment