+2 votes
in CMS Tips by (40.5k points)
I am using Gallery3 CMS for my photo gallery. Lately, I discovered one big problem with the "sessions" table. Its size increases by 100-150MB daily. Although I clean it daily, is there any way to stop it from growing so quickly?

Since this CMS is now managed by a different group, there is almost zero support.

1 Answer

+2 votes
by (71.8k points)
selected by
 
Best answer

I looked at the old discussion forum of Gallery3 CMS and found that the "sessions" table stores all visits of good or bad bots and web crawlers. Good bots, such as Google, Bing, and Yahoo, do not access 1000s of pages on your website every day, but bad bots do not care about anything. They do not even respect robots.txt. The "sessions" table grows so fast due to those bad bots. However, if you want to stop their visits from being inserted into the "sessions" table, you need to update the "system/config/user_agents.php" file. To identify good/bad bots, you need to analyze your access.log file. Based on my access.log file, I decided to block the following bots (good and bad both) so that their visits are not inserted into the "sessions" table.

  • Open the "system/config/user_agents.php" file in an editor, look for "$config['robot'] = array" and add the following lines:
/**
 * There are hundreds of bots but these are the most common.
 */
$config['robot'] = array
(
'googlebot'   => 'Googlebot',
'msnbot'      => 'MSNBot',
'slurp'       => 'Inktomi Slurp',
'yahoo'       => 'Yahoo',
'askjeeves'   => 'AskJeeves',
'fastcrawler' => 'FastCrawler',
'infoseek'    => 'InfoSeek Robot 1.0',
'lycos'       => 'Lycos',
'ahrefsBot'   => 'AhrefsBot',
'semrushBot'  => 'SemrushBot',
'semrush'     => 'Semrush',
'hetrixtools' => 'HetrixTools',
'java'       => 'Java',
'duckduckbot' => 'DuckDuckBot',
'pinterest'   => 'Pinterest',
'bingbot'     => 'Bingbot',
'yandexbot'   => 'YandexBot',
'baiduspider' => 'Baiduspider',
'duckduckbot' => 'DuckDuckBot',
'sogou'       => 'Sogou',
'exabot'      => 'Exabot',
'facebot'     => 'facebook bot',
'applebot'    => 'Applebot',
'dotbot'      => 'DotBot'
); 

These are the most common bots that crawl a website. 


...