will it create any issue further or old orders/customer details will be changed.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Can I ask which part of the code handles this hourly clearance? OR is there a setting in Admin? The number of records in my OC3 session table is over 100,000 and I get only three or four visitors per day and this is over a span of just 3 months.
The site is really slow with just OC3, Journal, Openstock and vqmod installed.
Thanks.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Thanks for the response. If I know which code to search for, I would have. I do not know which part of code within OC manages the session data database to search and hence the question. Apologies if this seems obvious, just a newbie here.
I am presuming that some part of php code within OC will go through the session table in the database and clear all the old ones. Correct me if wrong. I want to know which file within OC, Or part of the code within OC handles this os that I can check if that bit is correct in my setup.
I use use GrepWin for searching within OC, is textcrawler better than this? Will give it a go anyway.
Regards,
KG
fairmount wrote: ↑Mon Feb 19, 2018 6:32 amHi Straightlight,
Thanks for the response. If I know which code to search for, I would have. I do not know which part of code within OC manages the session data database to search and hence the question. Apologies if this seems obvious, just a newbie here.
I am presuming that some part of php code within OC will go through the session table in the database and clear all the old ones. Correct me if wrong. I want to know which file within OC, Or part of the code within OC handles this os that I can check if that bit is correct in my setup.
I use use GrepWin for searching within OC, is textcrawler better than this? Will give it a go anyway.
Regards,
KG
Mike Little
Director / Developer / Makes the coffee
Creative Digital Limited
http://www.creativedigital.co.nz
Hi, did you ever find a solution for this? I'm experiencing this right now :-(fairmount wrote: ↑Sun Feb 18, 2018 12:18 pmHi,
Can I ask which part of the code handles this hourly clearance? OR is there a setting in Admin? The number of records in my OC3 session table is over 100,000 and I get only three or four visitors per day and this is over a span of just 3 months.
The site is really slow with just OC3, Journal, Openstock and vqmod installed.
Thanks.
Hi did you find a solution for this?exit15 wrote: ↑Thu Jun 28, 2018 11:44 pmRunning 3.0.2.0 I had 450,000 records in one website and 1 MM lines in another. So I made a copy and truncated the table just to see what happens . Everything is working just fine. The question is weather the hourly cleanup process is in fact working. Clearly there are expired session records in the table. Any Idea??
"delete from `session` where `session`.expire < DATE_SUB(NOW(), INTERVAL 1 DAY);" (Removes everything older than 1 DAY, you can write '3 HOURS' if you prefer)
Daniel suggested a few fixes when alerted to the issue, but they did not work for me because the code on github is very different than the official distribution and every-time I copied a file that he changed to resolve this problem, it created a new problem. I am not a programmer, but i wish we could just plug the above query somewhere and simply delete old sessions
Thanks for this. I used the sql query you posted and used it to create a php script out of the public_html directory and then set a cron job to run it daily removing old sessions. Seemed to be the easiest automated way to prune the sessions.exit15 wrote: ↑Sun Dec 30, 2018 3:51 amI did not. If fact it is a bug (check github). The system simply does not delete old session and as a result there are thousands of OC databases inflated with millions of expired records in the 'session' table. For the time being every week or so I manually delete an avg of 150,000 records with this query:
"delete from `session` where `session`.expire < DATE_SUB(NOW(), INTERVAL 1 DAY);" (Removes everything older than 1 DAY, you can write '3 HOURS' if you prefer)
Daniel suggested a few fixes when alerted to the issue, but they did not work for me because the code on github is very different than the official distribution and every-time I copied a file that he changed to resolve this problem, it created a new problem. I am not a programmer, but i wish we could just plug the above query somewhere and simply delete old sessions
opencart 3.0.2.0
Would you mind share the script? I'm in the same situation and it would be nice solving it with cron.rpmb wrote: ↑Sun Jan 13, 2019 6:56 pmThanks for this. I used the sql query you posted and used it to create a php script out of the public_html directory and then set a cron job to run it daily removing old sessions. Seemed to be the easiest automated way to prune the sessions.exit15 wrote: ↑Sun Dec 30, 2018 3:51 amI did not. If fact it is a bug (check github). The system simply does not delete old session and as a result there are thousands of OC databases inflated with millions of expired records in the 'session' table. For the time being every week or so I manually delete an avg of 150,000 records with this query:
"delete from `session` where `session`.expire < DATE_SUB(NOW(), INTERVAL 1 DAY);" (Removes everything older than 1 DAY, you can write '3 HOURS' if you prefer)
Daniel suggested a few fixes when alerted to the issue, but they did not work for me because the code on github is very different than the official distribution and every-time I copied a file that he changed to resolve this problem, it created a new problem. I am not a programmer, but i wish we could just plug the above query somewhere and simply delete old sessions
My friend was 2.5 million lines in table over two years. Very few online retailers have the skill to use cron.
This should be set on the admin page where you can set the duration of the session.
-peku-
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
File system/config/default.php:
Code: Select all
$_['session_engine'] = 'db';
That is how most functionality in OC, already working perfectly, is implemented again just in a different way.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
This is triggered always when a new session is established (first call of website from anyone)
...
if (isset($_COOKIE[$this->config->get('session_name')])) {
$session_id = $_COOKIE[$this->config->get('session_name')];
} else {
$session_id = '';
}
$this->db->query("DELETE FROM `" . DB_PREFIX . "session` WHERE TIMESTAMPADD(DAY, 1, expire) < NOW()");
$this->session->start($session_id);
...
This deletes all session records which are expired since one DAY (replace DAY by HOUR, if you like)
A side effect for me is that I am now able to BACKUP my database without the OUT OF MEMORY issue
Comment: There may exist better solutions - but it just works for me....
That is triggered on every page request.This is triggered always when a new session is established (first call of website from anyone)
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Get a secure, fast, and reliable web hosting service from https://turnuphosting.com.
Code: Select all
public function __destruct() {
if (ini_get('session.gc_divisor')) $gc_divisor = ini_get('session.gc_divisor');
else $gc_divisor = 1;
if (ini_get('session.gc_probability')) $gc_probability = ini_get('session.gc_probability');
else $gc_probability = 1;
if ((rand() % $gc_divisor) < $gc_probability) {
$expire_dt = date('Y-m-d H:i:s', time() - ini_get('session.gc_maxlifetime'));
$this->db->query("DELETE FROM `" . DB_PREFIX . "session` WHERE expire < '".$expire_dt."'");
}
}
we store sessions in files and in addition identify bots (public and covert) and delete the session assigned to them immediately after script end as bots do not retain sessions and as such a new session is generated for bots on each page request which are subsequently useless, use space and make session clashes more likely.
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Users browsing this forum: No registered users and 8 guests