From e58c31ab63fdb2ad71b4e0f6509ae4c51b37f4ba Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 19 Jul 2016 06:18:52 +0200 Subject: [PATCH] ImportRunBasedPurgeStrategy: do not fetch no rows --- .../PurgeStrategy/ImportRunBasedPurgeStrategy.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/library/Director/Import/PurgeStrategy/ImportRunBasedPurgeStrategy.php b/library/Director/Import/PurgeStrategy/ImportRunBasedPurgeStrategy.php index 0e46e835..4e37b8bb 100644 --- a/library/Director/Import/PurgeStrategy/ImportRunBasedPurgeStrategy.php +++ b/library/Director/Import/PurgeStrategy/ImportRunBasedPurgeStrategy.php @@ -66,6 +66,10 @@ class ImportRunBasedPurgeStrategy extends PurgeStrategy $result = $db->fetchCol($query); + if (empty($result)) { + return array(); + } + if ($rule->object_type === 'service') { $pattern = $rule->getSourceKeyPattern(); $columns = SyncUtils::getRootVariables( @@ -78,10 +82,10 @@ class ImportRunBasedPurgeStrategy extends PurgeStrategy } } - if ($result) { - return array_combine($result, $result); - } else { + if (empty($result)) { return array(); } + + return array_combine($result, $result); } }