{"action":"created","issue":{"url":"https://api.github.com/repos/kohana/database/issues/92","labels_url":"https://api.github.com/repos/kohana/database/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/kohana/database/issues/92/comments","events_url":"https://api.github.com/repos/kohana/database/issues/92/events","html_url":"https://github.com/kohana/database/issues/92","id":55899670,"number":92,"title":"Session trouble with searching-bots and Session::write() (more with Database_Session)","user":{"login":"coll3ctor","id":1884457,"avatar_url":"https://avatars.githubusercontent.com/u/1884457?v=3","gravatar_id":"","url":"https://api.github.com/users/coll3ctor","html_url":"https://github.com/coll3ctor","followers_url":"https://api.github.com/users/coll3ctor/followers","following_url":"https://api.github.com/users/coll3ctor/following{/other_user}","gists_url":"https://api.github.com/users/coll3ctor/gists{/gist_id}","starred_url":"https://api.github.com/users/coll3ctor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coll3ctor/subscriptions","organizations_url":"https://api.github.com/users/coll3ctor/orgs","repos_url":"https://api.github.com/users/coll3ctor/repos","events_url":"https://api.github.com/users/coll3ctor/events{/privacy}","received_events_url":"https://api.github.com/users/coll3ctor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-01-29T13:39:24Z","updated_at":"2015-01-31T18:12:57Z","closed_at":null,"body":"Two weeks ago i run new site and made some actions to populize him in Google, Yandex and other search-engines. But... After my good work, i saw, that in my \"sessions\" table are more than 100k nodes. That was sessions of bots (Google, Yandex, etc.). This happened, cuz bots not accepts cookies, so to each request kohana made another one node to sessions table. Ofc, thats not OK, and this cant solve by garbage collection cleaning. So i solved that by adding to \"modules/database/classes/Kohana/Session/Database.php (Kohana_session_Database class)\" next code in 138 line (in function _write):\r\n```\r\nif(Request::user_agent('robot') != '')\r\n{\r\n\treturn TRUE;\r\n}\r\n```\r\n(also i've added to user_agent.php a few new user_agents (of bots), you can see it on this link http://pastebin.com/kpJdKz1D);\r\n\r\nSo, that works! Buy, by science, making changes in system modules/files is very bad and i transfered it to my helper-module by this path: \"myhelpermodule/classes/Session.php\":\r\n```\r\nabstract class Session extends Kohana_Session\r\n{\r\n\r\n\tpublic function write()\r\n\t{\r\n\t\tif(Request::user_agent('robot') != '')\r\n\t\t{\r\n\t\t\treturn TRUE;\r\n\t\t}\r\n\r\n\t\treturn parent::write();\r\n\t}\r\n}  \r\n```\r\nSo, that works, but looks very strange. Can you, please, say something about my trouble, my solve and this situation ?\r\n\r\n(and, to more information my session config file: http://pastebin.com/rVBGTzgD)"},"comment":{"url":"https://api.github.com/repos/kohana/database/issues/comments/72328884","html_url":"https://github.com/kohana/database/issues/92#issuecomment-72328884","issue_url":"https://api.github.com/repos/kohana/database/issues/92","id":72328884,"user":{"login":"coll3ctor","id":1884457,"avatar_url":"https://avatars.githubusercontent.com/u/1884457?v=3","gravatar_id":"","url":"https://api.github.com/users/coll3ctor","html_url":"https://github.com/coll3ctor","followers_url":"https://api.github.com/users/coll3ctor/followers","following_url":"https://api.github.com/users/coll3ctor/following{/other_user}","gists_url":"https://api.github.com/users/coll3ctor/gists{/gist_id}","starred_url":"https://api.github.com/users/coll3ctor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coll3ctor/subscriptions","organizations_url":"https://api.github.com/users/coll3ctor/orgs","repos_url":"https://api.github.com/users/coll3ctor/repos","events_url":"https://api.github.com/users/coll3ctor/events{/privacy}","received_events_url":"https://api.github.com/users/coll3ctor/received_events","type":"User","site_admin":false},"created_at":"2015-01-31T18:12:56Z","updated_at":"2015-01-31T18:12:56Z","body":"Ok, very big thanks, i understand!\r\n\r\nYou mean, what i can also (may be) divide sessions by directories (if i use 'native' driver), and i will not touch a overloading (exception overloading of my hard disk, ofc)?\r\n\r\nAs i saw, Yandex, Google, Yahoo, MailRu, Rambler bots - everyone not accepts cookies, so everyone of them fills up my database :( I am totally sure, what we will not break anything, using my solution (only if someone uses bots 'useragent', but, this guy, i think, is very fishily for my site, and this will be good, if i don't give him cookie & session node & authorization on my site). And i am totally sure, that trying (and saving) to save sessions for bots is totally useless and harmful actions.\r\n\r\nAnother one question: Should i redeclare class Session_Database and not Session? Because, i am working with session just on \"database\" area (yep, i see your advices about native session)."}}