From ccab4b92225075ae9fe06aa480bed7eb6b63d5c9 Mon Sep 17 00:00:00 2001 From: dMetzger Date: Thu, 16 Aug 2012 13:23:52 +0000 Subject: [PATCH] // Changed max_execution_time for big product selection removal #PSCFV-3181 --- classes/Product.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/classes/Product.php b/classes/Product.php index b19d7d7e8..ab4612d3c 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -681,12 +681,18 @@ class ProductCore extends ObjectModel public function deleteSelection($products) { $return = 1; - if (is_array($products) && count($products)) + if (is_array($products) && ($count = count($products))) + { + // Deleting products can be quite long on a cheap server. Let's say 1.5 seconds by product (I've seen it!). + if (intval(ini_get('max_execution_time')) < round($count * 1.5)) + ini_set('max_execution_time', round($count * 1.5)); + foreach ($products as $id_product) { $product = new Product((int)$id_product); $return &= $product->delete(); } + } return $return; }