aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPim van den Berg2014-06-28 16:10:02 +0200
committerPim van den Berg2014-06-28 16:15:00 +0200
commit056714a29721f1332f2497e440654f6735055d67 (patch)
tree741bc168cd6ff247d5cb5ff58ed5de8f96461cc5
parentMerge remote-tracking branch 'dhchen/master' (diff)
downloadapt-panopticon_cgp-056714a29721f1332f2497e440654f6735055d67.zip
apt-panopticon_cgp-056714a29721f1332f2497e440654f6735055d67.tar.gz
apt-panopticon_cgp-056714a29721f1332f2497e440654f6735055d67.tar.bz2
apt-panopticon_cgp-056714a29721f1332f2497e440654f6735055d67.tar.xz
type/base: replace array_merge by + sign to merge a fallback array
array_merge resets the index, while in case of $this->colors and $this->legend, we'd like to keep the index. An irq plugin sample: array(1 => 1, 'ERR' => 'ERR') must not become array(0 => 1, 'ERR' => 'ERR') after an array_merge.
-rw-r--r--type/Base.class.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/type/Base.class.php b/type/Base.class.php
index 883c98f..34e182f 100644
--- a/type/Base.class.php
+++ b/type/Base.class.php
@@ -191,7 +191,7 @@ class Type_Base {
191 191
192 $colors = $this->colors; 192 $colors = $this->colors;
193 $this->rainbow_colors(); 193 $this->rainbow_colors();
194 $this->colors = array_merge($this->colors, $colors); 194 $this->colors = $colors + $this->colors;
195 195
196 $graphdata = $this->rrd_gen_graph(); 196 $graphdata = $this->rrd_gen_graph();
197 197
@@ -304,7 +304,7 @@ class Type_Base {
304 304
305 function parse_legend($sources) { 305 function parse_legend($sources) {
306 # fill up legend by items that are not defined by plugin 306 # fill up legend by items that are not defined by plugin
307 $this->legend = array_merge(array_combine($sources, $sources), $this->legend); 307 $this->legend = $this->legend + array_combine($sources, $sources);
308 308
309 # detect length of longest legend 309 # detect length of longest legend
310 $max = 0; 310 $max = 0;