[icinga-checkins] icinga.org: icingaweb2-module-director/feature-ddo-playground: ImportRunBasedPurgeStrategy: do not fetch no rows

git at icinga.org git at icinga.org
Tue Jul 19 10:31:51 CEST 2016


Module: icingaweb2-module-director
Branch: feature-ddo-playground
Commit: e58c31ab63fdb2ad71b4e0f6509ae4c51b37f4ba
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=e58c31ab63fdb2ad71b4e0f6509ae4c51b37f4ba

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Jul 19 06:18:52 2016 +0200

ImportRunBasedPurgeStrategy: do not fetch no rows

---

 .../Import/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 0e46e83..4e37b8b 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);
     }
 }



More information about the icinga-checkins mailing list