Skip to content

Commit 93cf6c0

Browse files
authored
Merge pull request #2 from php-schubser/master
fix: timeout error
2 parents 5cf3cd5 + d556408 commit 93cf6c0

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

new_files/interface/fs_cleverreach_interface.php

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
require '../includes/application_top_export.php';
55
require '../inc/xtc_not_null.inc.php';
66
require '../inc/xtc_get_country_name.inc.php';
7+
require '../inc/xtc_href_link.inc.php';
8+
session_start();
9+
10+
if (!isset($_SESSION['cleacerreach_interface_counter'])) {
11+
$_SESSION['cleacerreach_interface_counter'] = 1;
12+
}
713

814
if(!defined('MODULE_FS_CLEVERREACH_INTERFACE_STATUS') || MODULE_FS_CLEVERREACH_INTERFACE_STATUS != 'true')
915
{
@@ -43,6 +49,15 @@
4349

4450
$receivers = array();
4551

52+
$where_limit = '';
53+
$where_offset = '';
54+
if (isset($_SESSION['cleacerreach_interface_counter'])) {
55+
$where_limit .= ' LIMIT 100 ';
56+
if ($_SESSION['cleacerreach_interface_counter'] > 1) {
57+
$where_offset .= ' OFFSET ' . ($_SESSION['cleacerreach_interface_counter'] - 1) * 100 . ' ';
58+
}
59+
}
60+
4661
if (MODULE_FS_CLEVERREACH_INTERFACE_IMPORT_SUBSCRIBERS == 'true') {
4762

4863

@@ -52,7 +67,7 @@
5267
date_added as registered,
5368
customers_firstname as firstname,
5469
customers_lastname as lastname
55-
FROM " . TABLE_NEWSLETTER_RECIPIENTS . " WHERE mail_status = '1' ");
70+
FROM " . TABLE_NEWSLETTER_RECIPIENTS . " WHERE mail_status = '1' " . $where_limit . $where_offset);
5671

5772
while ($customer = xtc_db_fetch_array($manual_registered_customers)) {
5873
$orders = array();
@@ -99,7 +114,7 @@
99114
if (isset($_GET['export_filter_amazon']) && $_GET['export_filter_amazon'] == 1) {
100115
$where_clause .= " AND customers_email_address NOT LIKE '%@marketplace.amazon.de%'";
101116
}
102-
$order_rows = xtc_db_query("SELECT DISTINCT o.orders_id, o.customers_id, o.customers_email_address as email, o.customers_firstname as firstname, o.customers_lastname as lastname, o.customers_gender as gender, o.customers_street_address as street, o.customers_city as city, o.customers_postcode as zip, o.customers_country as country, o.date_purchased, op.products_id, op.products_name, op.products_price, op.products_quantity from " . TABLE_ORDERS . " o JOIN " . TABLE_ORDERS_PRODUCTS . " op ON o.orders_id = op.orders_id GROUP BY o.customers_id ORDER BY o.date_purchased ");
117+
$order_rows = xtc_db_query("SELECT DISTINCT o.orders_id, o.customers_id, o.customers_email_address as email, o.customers_firstname as firstname, o.customers_lastname as lastname, o.customers_gender as gender, o.customers_street_address as street, o.customers_city as city, o.customers_postcode as zip, o.customers_country as country, o.date_purchased, op.products_id, op.products_name, op.products_price, op.products_quantity from " . TABLE_ORDERS . " o JOIN " . TABLE_ORDERS_PRODUCTS . " op ON o.orders_id = op.orders_id GROUP BY o.customers_id ORDER BY o.date_purchased " . $where_limit . $where_offset);
103118
while ($order_row = xtc_db_fetch_array($order_rows)) {
104119

105120
$orders = array();
@@ -153,7 +168,15 @@
153168
} else {
154169
die('Keine neuen Daten gefunden');
155170
}
171+
172+
if (count($receivers) == 100) {
173+
$_SESSION['cleacerreach_interface_counter'] = $_SESSION['cleacerreach_interface_counter'] + 1;
174+
header("Refresh:1;");
175+
exit;
176+
}
177+
156178
$receivers = array();
157179

158-
header('Location: ' . preg_replace("/[\r\n]+(.*)$/i", "", html_entity_decode($_SERVER['HTTP_REFERER'])));
180+
unset($_SESSION['cleacerreach_interface_counter']);
181+
header('Location: ' . xtc_href_link_admin((defined('DIR_ADMIN') ? DIR_ADMIN : 'admin/').'module_export.php', 'set=system&module=fs_cleverreach_interface&action=edit', 'NONSSL'));
159182
exit();

0 commit comments

Comments
 (0)