[icinga-checkins] icinga.org: icingaweb2/master: Repository: Fix column caches²

git at icinga.org git at icinga.org
Thu Aug 18 15:40:44 CEST 2016


Module: icingaweb2
Branch: master
Commit: 124fb848a09733900c880c2650c434fa62f090c0
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=124fb848a09733900c880c2650c434fa62f090c0

Author: Johannes Meyer <johannes.meyer at netways.de>
Date:   Thu Aug 18 15:40:20 2016 +0200

Repository: Fix column caches²


---

 library/Icinga/Repository/Repository.php |   34 ++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/library/Icinga/Repository/Repository.php b/library/Icinga/Repository/Repository.php
index a211a25..379614f 100644
--- a/library/Icinga/Repository/Repository.php
+++ b/library/Icinga/Repository/Repository.php
@@ -370,9 +370,13 @@ abstract class Repository implements Selectable
             $this->legacyBlacklistedQueryColumns = is_int(key($this->blacklistedQueryColumns));
         }
 
-        return $this->legacyBlacklistedQueryColumns
-            ? $this->blacklistedQueryColumns
-            : $this->blacklistedQueryColumns[$table];
+        if ($this->legacyBlacklistedQueryColumns) {
+            return $this->blacklistedQueryColumns;
+        } elseif (! isset($this->blacklistedQueryColumns[$table])) {
+            $this->blacklistedQueryColumns[$table] = $this->initializeBlacklistedQueryColumns($table);
+        }
+
+        return $this->blacklistedQueryColumns[$table];
     }
 
     /**
@@ -415,7 +419,13 @@ abstract class Repository implements Selectable
             $this->legacyFilterColumns = empty($foundTables);
         }
 
-        return $this->legacyFilterColumns ? $this->filterColumns : $this->filterColumns[$table];
+        if ($this->legacyFilterColumns) {
+            return $this->filterColumns;
+        } elseif (! isset($this->filterColumns[$table])) {
+            $this->filterColumns[$table] = $this->initializeFilterColumns($table);
+        }
+
+        return $this->filterColumns[$table];
     }
 
     /**
@@ -456,7 +466,13 @@ abstract class Repository implements Selectable
             $this->legacySearchColumns = is_int(key($this->searchColumns));
         }
 
-        return $this->legacySearchColumns ? $this->searchColumns : $this->searchColumns[$table];
+        if ($this->legacySearchColumns) {
+            return $this->searchColumns;
+        } elseif (! isset($this->searchColumns[$table])) {
+            $this->searchColumns[$table] = $this->initializeSearchColumns($table);
+        }
+
+        return $this->searchColumns[$table];
     }
 
     /**
@@ -499,7 +515,13 @@ abstract class Repository implements Selectable
             $this->legacyFilterColumns = empty($foundTables);
         }
 
-        return $this->legacySortRules ? $this->sortRules : $this->sortRules[$table];
+        if ($this->legacySortRules) {
+            return $this->sortRules;
+        } elseif (! isset($this->sortRules[$table])) {
+            $this->sortRules[$table] = $this->initializeSortRules($table);
+        }
+
+        return $this->sortRules[$table];
     }
 
     /**



More information about the icinga-checkins mailing list