Post by straightlight » Sun Nov 04, 2018 9:47 pm

Currently, in v3.1.0.0x releases on GitHub, the admin GDPR cron task file suggests to load all customers which their GDPR expiration date has reached its limit point. However, since it uses a loop to validate this, the methodology currently provided might be good for the first few hundreds of users but may not be suggested to be used for stores that handles several thousands of them as it may decreasingly optimize your stores.

In order to rectify this issue, in your admin/controller/cron/gdpr.php file,

replace the entire file with the following, instead:

Code: Select all

class ControllerCronGdpr extends Controller {
	public function index($cron_id, $code, $cycle, $date_added, $date_modified) {

Then, in your admin/model/customer/gdpr.php file,


Code: Select all

public function deleteGdpr($customer_id) {
		$this->db->query("DELETE FROM `" . DB_PREFIX . "customer_gdpr` WHERE customer_id = '" . (int)$customer_id . "'");
add below:

Code: Select all

public function deleteExpiredCustomers() {
		$expiry = (time() - 60 * 60 * 24 * (int)$this->config->get('config_gdpr_limit'));
		$this->db->query("DELETE FROM `" . DB_PREFIX . "customer`, `" . DB_PREFIX . "customer_gdpr` USING `customer`,`customer_gdpr` WHERE `customer_gdpr`.`customer_id` = `customer`.`customer_id` AND UNIX_TIMESTAMP(`customer_gdpr`.`date_added`) < '" . (int)$expiry . "' AND `customer_gdpr`.`status` = '1'");
This should resolved the issue as only one simple query may be needed in order to validate all customers with GDPR without a loop statement.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.

Straightlight Administrator / Quality Assurance Analyst / Programmer

Legendary Member


Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 4 guests