@@ -9,8 +9,6 @@ |
||
9 | 9 | use Composer\Autoload\ClassLoader; |
10 | 10 | use Doctrine\Common\Annotations\AnnotationRegistry; |
11 | 11 | use Doctrine\Common\Annotations\AnnotationReader; |
12 | -use Doctrine\Common\Cache\ApcCache; |
|
13 | -use Doctrine\Common\Cache\FilesystemCache; |
|
14 | 12 | use BEAR\Package\Module\Di\DiCompilerProvider; |
15 | 13 | use Doctrine\Common\Cache\Cache; |
16 | 14 |
@@ -13,7 +13,6 @@ |
||
13 | 13 | use BEAR\Resource\Exception\ResourceNotFound; |
14 | 14 | use BEAR\Resource\Exception\Scheme; |
15 | 15 | use BEAR\Resource\Exception\Uri; |
16 | -use BEAR\Sunday\Exception\LogicException; |
|
17 | 16 | use BEAR\Sunday\Extension\WebResponse\ResponseInterface; |
18 | 17 | use BEAR\Sunday\Inject\LogDirInject; |
19 | 18 | use Exception; |
@@ -9,7 +9,6 @@ |
||
9 | 9 | use Ray\Aop\MethodInterceptor; |
10 | 10 | use Ray\Aop\MethodInvocation; |
11 | 11 | use Ray\Di\Di\Inject; |
12 | -use Ray\Di\Di\Named; |
|
13 | 12 | use ReflectionMethod; |
14 | 13 | use Doctrine\Common\Cache\Cache; |
15 | 14 |
@@ -10,7 +10,6 @@ |
||
10 | 10 | use Ray\Aop\MethodInvocation; |
11 | 11 | use Aura\Input\Form; |
12 | 12 | use Ray\Di\Di\Inject; |
13 | -use Ray\Di\Di\Named; |
|
14 | 13 | use Aura\Session\Manager as Session; |
15 | 14 | use BEAR\Package\Module\Session\AuraSession\AntiCsrf; |
16 | 15 |
@@ -6,10 +6,7 @@ |
||
6 | 6 | */ |
7 | 7 | namespace BEAR\Package\Module\Resource; |
8 | 8 | |
9 | -use BEAR\Package\Provide as ProvideModule; |
|
10 | -use BEAR\Sunday\Module as SundayModule; |
|
11 | 9 | use Ray\Di\AbstractModule; |
12 | -use Ray\Di\Scope; |
|
13 | 10 | |
14 | 11 | class ResourceGraphModule extends AbstractModule |
15 | 12 | { |
@@ -10,11 +10,9 @@ |
||
10 | 10 | use Aura\Signal\Manager; |
11 | 11 | use Aura\Signal\ResultCollection; |
12 | 12 | use Aura\Signal\ResultFactory; |
13 | -use BEAR\Package\Provide as ProvideModule; |
|
14 | 13 | use BEAR\Resource\Param; |
15 | 14 | use BEAR\Resource\SignalParameter; |
16 | 15 | use BEAR\Resource\ParamProviderInterface; |
17 | -use BEAR\Sunday\Module as SundayModule; |
|
18 | 16 | use Ray\Di\InstanceInterface; |
19 | 17 | use Ray\Di\ProviderInterface; |
20 | 18 | use Ray\Di\Di\Inject; |
@@ -11,7 +11,6 @@ |
||
11 | 11 | use Nocarrier\Hal; |
12 | 12 | use BEAR\Resource\Link; |
13 | 13 | use Ray\Di\Di\Inject; |
14 | -use Ray\Di\Di\Named; |
|
15 | 14 | |
16 | 15 | class HalFactory implements HalFactoryInterface |
17 | 16 | { |
@@ -6,7 +6,6 @@ |
||
6 | 6 | */ |
7 | 7 | namespace BEAR\Package\Provide\WebResponse; |
8 | 8 | |
9 | -use BEAR\Resource\ResourceObject as Page; |
|
10 | 9 | use BEAR\Resource\ResourceObject; |
11 | 10 | use BEAR\Resource\RenderInterface; |
12 | 11 | use BEAR\Sunday\Exception\InvalidResourceType; |
@@ -48,73 +48,73 @@ discard block |
||
48 | 48 | ///////////MEMCACHE FUNCTIONS ///////////////////////////////////////////////////////////////////// |
49 | 49 | |
50 | 50 | function get_host_port_from_server($server){ |
51 | - $values = explode(':', $server); |
|
52 | - if (($values[0] == 'unix') && (!is_numeric( $values[1]))) { |
|
53 | - return array($server, 0); |
|
54 | - } |
|
55 | - else { |
|
56 | - return $values; |
|
57 | - } |
|
51 | + $values = explode(':', $server); |
|
52 | + if (($values[0] == 'unix') && (!is_numeric( $values[1]))) { |
|
53 | + return array($server, 0); |
|
54 | + } |
|
55 | + else { |
|
56 | + return $values; |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | function sendMemcacheCommands($command){ |
61 | 61 | global $MEMCACHE_SERVERS; |
62 | - $result = array(); |
|
62 | + $result = array(); |
|
63 | 63 | |
64 | - foreach($MEMCACHE_SERVERS as $server){ |
|
65 | - $strs = get_host_port_from_server($server); |
|
66 | - $host = $strs[0]; |
|
67 | - $port = $strs[1]; |
|
68 | - $result[$server] = sendMemcacheCommand($host,$port,$command); |
|
69 | - } |
|
70 | - return $result; |
|
64 | + foreach($MEMCACHE_SERVERS as $server){ |
|
65 | + $strs = get_host_port_from_server($server); |
|
66 | + $host = $strs[0]; |
|
67 | + $port = $strs[1]; |
|
68 | + $result[$server] = sendMemcacheCommand($host,$port,$command); |
|
69 | + } |
|
70 | + return $result; |
|
71 | 71 | } |
72 | 72 | function sendMemcacheCommand($server,$port,$command){ |
73 | 73 | |
74 | - $s = @fsockopen($server,$port); |
|
75 | - if (!$s){ |
|
76 | - die("Cant connect to:".$server.':'.$port); |
|
77 | - } |
|
74 | + $s = @fsockopen($server,$port); |
|
75 | + if (!$s){ |
|
76 | + die("Cant connect to:".$server.':'.$port); |
|
77 | + } |
|
78 | 78 | |
79 | - fwrite($s, $command."\r\n"); |
|
80 | - |
|
81 | - $buf=''; |
|
82 | - while ((!feof($s))) { |
|
83 | - $buf .= fgets($s, 256); |
|
84 | - if (strpos($buf,"END\r\n")!==false){ // stat says end |
|
85 | - break; |
|
86 | - } |
|
87 | - if (strpos($buf,"DELETED\r\n")!==false || strpos($buf,"NOT_FOUND\r\n")!==false){ // delete says these |
|
88 | - break; |
|
89 | - } |
|
90 | - if (strpos($buf,"OK\r\n")!==false){ // flush_all says ok |
|
91 | - break; |
|
92 | - } |
|
93 | - } |
|
79 | + fwrite($s, $command."\r\n"); |
|
80 | + |
|
81 | + $buf=''; |
|
82 | + while ((!feof($s))) { |
|
83 | + $buf .= fgets($s, 256); |
|
84 | + if (strpos($buf,"END\r\n")!==false){ // stat says end |
|
85 | + break; |
|
86 | + } |
|
87 | + if (strpos($buf,"DELETED\r\n")!==false || strpos($buf,"NOT_FOUND\r\n")!==false){ // delete says these |
|
88 | + break; |
|
89 | + } |
|
90 | + if (strpos($buf,"OK\r\n")!==false){ // flush_all says ok |
|
91 | + break; |
|
92 | + } |
|
93 | + } |
|
94 | 94 | fclose($s); |
95 | 95 | return parseMemcacheResults($buf); |
96 | 96 | } |
97 | 97 | function parseMemcacheResults($str){ |
98 | 98 | |
99 | - $res = array(); |
|
100 | - $lines = explode("\r\n",$str); |
|
101 | - $cnt = count($lines); |
|
102 | - for($i=0; $i< $cnt; $i++){ |
|
103 | - $line = $lines[$i]; |
|
104 | - $l = explode(' ',$line,3); |
|
105 | - if (count($l)==3){ |
|
106 | - $res[$l[0]][$l[1]]=$l[2]; |
|
107 | - if ($l[0]=='VALUE'){ // next line is the value |
|
108 | - $res[$l[0]][$l[1]] = array(); |
|
109 | - list ($flag,$size)=explode(' ',$l[2]); |
|
110 | - $res[$l[0]][$l[1]]['stat']=array('flag'=>$flag,'size'=>$size); |
|
111 | - $res[$l[0]][$l[1]]['value']=$lines[++$i]; |
|
112 | - } |
|
113 | - }elseif($line=='DELETED' || $line=='NOT_FOUND' || $line=='OK'){ |
|
114 | - return $line; |
|
115 | - } |
|
116 | - } |
|
117 | - return $res; |
|
99 | + $res = array(); |
|
100 | + $lines = explode("\r\n",$str); |
|
101 | + $cnt = count($lines); |
|
102 | + for($i=0; $i< $cnt; $i++){ |
|
103 | + $line = $lines[$i]; |
|
104 | + $l = explode(' ',$line,3); |
|
105 | + if (count($l)==3){ |
|
106 | + $res[$l[0]][$l[1]]=$l[2]; |
|
107 | + if ($l[0]=='VALUE'){ // next line is the value |
|
108 | + $res[$l[0]][$l[1]] = array(); |
|
109 | + list ($flag,$size)=explode(' ',$l[2]); |
|
110 | + $res[$l[0]][$l[1]]['stat']=array('flag'=>$flag,'size'=>$size); |
|
111 | + $res[$l[0]][$l[1]]['value']=$lines[++$i]; |
|
112 | + } |
|
113 | + }elseif($line=='DELETED' || $line=='NOT_FOUND' || $line=='OK'){ |
|
114 | + return $line; |
|
115 | + } |
|
116 | + } |
|
117 | + return $res; |
|
118 | 118 | |
119 | 119 | } |
120 | 120 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | list($host,$port) = get_host_port_from_server($server); |
123 | 123 | $resp = sendMemcacheCommand($host,$port,'stats cachedump '.$slabId.' '.$limit); |
124 | 124 | |
125 | - return $resp; |
|
125 | + return $resp; |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | return $resp; |
133 | 133 | } |
134 | 134 | function getCacheItems(){ |
135 | - $items = sendMemcacheCommands('stats items'); |
|
136 | - $serverItems = array(); |
|
137 | - $totalItems = array(); |
|
138 | - foreach ($items as $server=>$itemlist){ |
|
135 | + $items = sendMemcacheCommands('stats items'); |
|
136 | + $serverItems = array(); |
|
137 | + $totalItems = array(); |
|
138 | + foreach ($items as $server=>$itemlist){ |
|
139 | 139 | $serverItems[$server] = array(); |
140 | 140 | $totalItems[$server]=0; |
141 | 141 | if (!isset($itemlist['STAT'])){ |
@@ -152,91 +152,91 @@ discard block |
||
152 | 152 | } |
153 | 153 | } |
154 | 154 | } |
155 | - } |
|
156 | - return array('items'=>$serverItems,'counts'=>$totalItems); |
|
155 | + } |
|
156 | + return array('items'=>$serverItems,'counts'=>$totalItems); |
|
157 | 157 | } |
158 | 158 | function getMemcacheStats($total=true){ |
159 | - $resp = sendMemcacheCommands('stats'); |
|
160 | - if ($total){ |
|
161 | - $res = array(); |
|
162 | - foreach($resp as $server=>$r){ |
|
163 | - foreach($r['STAT'] as $key=>$row){ |
|
164 | - if (!isset($res[$key])){ |
|
165 | - $res[$key]=null; |
|
166 | - } |
|
167 | - switch ($key){ |
|
168 | - case 'pid': |
|
169 | - $res['pid'][$server]=$row; |
|
170 | - break; |
|
171 | - case 'uptime': |
|
172 | - $res['uptime'][$server]=$row; |
|
173 | - break; |
|
174 | - case 'time': |
|
175 | - $res['time'][$server]=$row; |
|
176 | - break; |
|
177 | - case 'version': |
|
178 | - $res['version'][$server]=$row; |
|
179 | - break; |
|
180 | - case 'pointer_size': |
|
181 | - $res['pointer_size'][$server]=$row; |
|
182 | - break; |
|
183 | - case 'rusage_user': |
|
184 | - $res['rusage_user'][$server]=$row; |
|
185 | - break; |
|
186 | - case 'rusage_system': |
|
187 | - $res['rusage_system'][$server]=$row; |
|
188 | - break; |
|
189 | - case 'curr_items': |
|
190 | - $res['curr_items']+=$row; |
|
191 | - break; |
|
192 | - case 'total_items': |
|
193 | - $res['total_items']+=$row; |
|
194 | - break; |
|
195 | - case 'bytes': |
|
196 | - $res['bytes']+=$row; |
|
197 | - break; |
|
198 | - case 'curr_connections': |
|
199 | - $res['curr_connections']+=$row; |
|
200 | - break; |
|
201 | - case 'total_connections': |
|
202 | - $res['total_connections']+=$row; |
|
203 | - break; |
|
204 | - case 'connection_structures': |
|
205 | - $res['connection_structures']+=$row; |
|
206 | - break; |
|
207 | - case 'cmd_get': |
|
208 | - $res['cmd_get']+=$row; |
|
209 | - break; |
|
210 | - case 'cmd_set': |
|
211 | - $res['cmd_set']+=$row; |
|
212 | - break; |
|
213 | - case 'get_hits': |
|
214 | - $res['get_hits']+=$row; |
|
215 | - break; |
|
216 | - case 'get_misses': |
|
217 | - $res['get_misses']+=$row; |
|
218 | - break; |
|
219 | - case 'evictions': |
|
220 | - $res['evictions']+=$row; |
|
221 | - break; |
|
222 | - case 'bytes_read': |
|
223 | - $res['bytes_read']+=$row; |
|
224 | - break; |
|
225 | - case 'bytes_written': |
|
226 | - $res['bytes_written']+=$row; |
|
227 | - break; |
|
228 | - case 'limit_maxbytes': |
|
229 | - $res['limit_maxbytes']+=$row; |
|
230 | - break; |
|
231 | - case 'threads': |
|
232 | - $res['rusage_system'][$server]=$row; |
|
233 | - break; |
|
234 | - } |
|
235 | - } |
|
236 | - } |
|
237 | - return $res; |
|
238 | - } |
|
239 | - return $resp; |
|
159 | + $resp = sendMemcacheCommands('stats'); |
|
160 | + if ($total){ |
|
161 | + $res = array(); |
|
162 | + foreach($resp as $server=>$r){ |
|
163 | + foreach($r['STAT'] as $key=>$row){ |
|
164 | + if (!isset($res[$key])){ |
|
165 | + $res[$key]=null; |
|
166 | + } |
|
167 | + switch ($key){ |
|
168 | + case 'pid': |
|
169 | + $res['pid'][$server]=$row; |
|
170 | + break; |
|
171 | + case 'uptime': |
|
172 | + $res['uptime'][$server]=$row; |
|
173 | + break; |
|
174 | + case 'time': |
|
175 | + $res['time'][$server]=$row; |
|
176 | + break; |
|
177 | + case 'version': |
|
178 | + $res['version'][$server]=$row; |
|
179 | + break; |
|
180 | + case 'pointer_size': |
|
181 | + $res['pointer_size'][$server]=$row; |
|
182 | + break; |
|
183 | + case 'rusage_user': |
|
184 | + $res['rusage_user'][$server]=$row; |
|
185 | + break; |
|
186 | + case 'rusage_system': |
|
187 | + $res['rusage_system'][$server]=$row; |
|
188 | + break; |
|
189 | + case 'curr_items': |
|
190 | + $res['curr_items']+=$row; |
|
191 | + break; |
|
192 | + case 'total_items': |
|
193 | + $res['total_items']+=$row; |
|
194 | + break; |
|
195 | + case 'bytes': |
|
196 | + $res['bytes']+=$row; |
|
197 | + break; |
|
198 | + case 'curr_connections': |
|
199 | + $res['curr_connections']+=$row; |
|
200 | + break; |
|
201 | + case 'total_connections': |
|
202 | + $res['total_connections']+=$row; |
|
203 | + break; |
|
204 | + case 'connection_structures': |
|
205 | + $res['connection_structures']+=$row; |
|
206 | + break; |
|
207 | + case 'cmd_get': |
|
208 | + $res['cmd_get']+=$row; |
|
209 | + break; |
|
210 | + case 'cmd_set': |
|
211 | + $res['cmd_set']+=$row; |
|
212 | + break; |
|
213 | + case 'get_hits': |
|
214 | + $res['get_hits']+=$row; |
|
215 | + break; |
|
216 | + case 'get_misses': |
|
217 | + $res['get_misses']+=$row; |
|
218 | + break; |
|
219 | + case 'evictions': |
|
220 | + $res['evictions']+=$row; |
|
221 | + break; |
|
222 | + case 'bytes_read': |
|
223 | + $res['bytes_read']+=$row; |
|
224 | + break; |
|
225 | + case 'bytes_written': |
|
226 | + $res['bytes_written']+=$row; |
|
227 | + break; |
|
228 | + case 'limit_maxbytes': |
|
229 | + $res['limit_maxbytes']+=$row; |
|
230 | + break; |
|
231 | + case 'threads': |
|
232 | + $res['rusage_system'][$server]=$row; |
|
233 | + break; |
|
234 | + } |
|
235 | + } |
|
236 | + } |
|
237 | + return $res; |
|
238 | + } |
|
239 | + return $resp; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | ////////////////////////////////////////////////////// |
@@ -273,24 +273,24 @@ discard block |
||
273 | 273 | // create graphics |
274 | 274 | // |
275 | 275 | function graphics_avail() { |
276 | - return extension_loaded('gd'); |
|
276 | + return extension_loaded('gd'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | function bsize($s) { |
280 | - foreach (array('','K','M','G') as $i => $k) { |
|
281 | - if ($s < 1024) break; |
|
282 | - $s/=1024; |
|
283 | - } |
|
284 | - return sprintf("%5.1f %sBytes",$s,$k); |
|
280 | + foreach (array('','K','M','G') as $i => $k) { |
|
281 | + if ($s < 1024) break; |
|
282 | + $s/=1024; |
|
283 | + } |
|
284 | + return sprintf("%5.1f %sBytes",$s,$k); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | // create menu entry |
288 | 288 | function menu_entry($ob,$title) { |
289 | - global $PHP_SELF; |
|
290 | - if ($ob==$_GET['op']){ |
|
291 | - return "<li><a class=\"child_active\" href=\"$PHP_SELF&op=$ob\">$title</a></li>"; |
|
292 | - } |
|
293 | - return "<li><a class=\"active\" href=\"$PHP_SELF&op=$ob\">$title</a></li>"; |
|
289 | + global $PHP_SELF; |
|
290 | + if ($ob==$_GET['op']){ |
|
291 | + return "<li><a class=\"child_active\" href=\"$PHP_SELF&op=$ob\">$title</a></li>"; |
|
292 | + } |
|
293 | + return "<li><a class=\"active\" href=\"$PHP_SELF&op=$ob\">$title</a></li>"; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | function getHeader(){ |
@@ -513,8 +513,8 @@ discard block |
||
513 | 513 | EOB; |
514 | 514 | } |
515 | 515 | echo |
516 | - menu_entry(1,'View Host Stats'), |
|
517 | - menu_entry(2,'Variables'); |
|
516 | + menu_entry(1,'View Host Stats'), |
|
517 | + menu_entry(2,'Variables'); |
|
518 | 518 | |
519 | 519 | echo <<<EOB |
520 | 520 | </ol> |
@@ -548,115 +548,115 @@ discard block |
||
548 | 548 | $memcacheStatsSingle = getMemcacheStats(false); |
549 | 549 | |
550 | 550 | if (!graphics_avail()) { |
551 | - exit(0); |
|
552 | - } |
|
551 | + exit(0); |
|
552 | + } |
|
553 | 553 | |
554 | - function fill_box($im, $x, $y, $w, $h, $color1, $color2,$text='',$placeindex='') { |
|
555 | - global $col_black; |
|
556 | - $x1=$x+$w-1; |
|
557 | - $y1=$y+$h-1; |
|
558 | - |
|
559 | - imagerectangle($im, $x, $y1, $x1+1, $y+1, $col_black); |
|
560 | - if($y1>$y) imagefilledrectangle($im, $x, $y, $x1, $y1, $color2); |
|
561 | - else imagefilledrectangle($im, $x, $y1, $x1, $y, $color2); |
|
562 | - imagerectangle($im, $x, $y1, $x1, $y, $color1); |
|
563 | - if ($text) { |
|
564 | - if ($placeindex>0) { |
|
565 | - |
|
566 | - if ($placeindex<16) |
|
567 | - { |
|
568 | - $px=5; |
|
569 | - $py=$placeindex*12+6; |
|
570 | - imagefilledrectangle($im, $px+90, $py+3, $px+90-4, $py-3, $color2); |
|
571 | - imageline($im,$x,$y+$h/2,$px+90,$py,$color2); |
|
572 | - imagestring($im,2,$px,$py-6,$text,$color1); |
|
573 | - |
|
574 | - } else { |
|
575 | - if ($placeindex<31) { |
|
576 | - $px=$x+40*2; |
|
577 | - $py=($placeindex-15)*12+6; |
|
578 | - } else { |
|
579 | - $px=$x+40*2+100*intval(($placeindex-15)/15); |
|
580 | - $py=($placeindex%15)*12+6; |
|
581 | - } |
|
582 | - imagefilledrectangle($im, $px, $py+3, $px-4, $py-3, $color2); |
|
583 | - imageline($im,$x+$w,$y+$h/2,$px,$py,$color2); |
|
584 | - imagestring($im,2,$px+2,$py-6,$text,$color1); |
|
585 | - } |
|
586 | - } else { |
|
587 | - imagestring($im,4,$x+5,$y1-16,$text,$color1); |
|
588 | - } |
|
589 | - } |
|
590 | - } |
|
554 | + function fill_box($im, $x, $y, $w, $h, $color1, $color2,$text='',$placeindex='') { |
|
555 | + global $col_black; |
|
556 | + $x1=$x+$w-1; |
|
557 | + $y1=$y+$h-1; |
|
558 | + |
|
559 | + imagerectangle($im, $x, $y1, $x1+1, $y+1, $col_black); |
|
560 | + if($y1>$y) imagefilledrectangle($im, $x, $y, $x1, $y1, $color2); |
|
561 | + else imagefilledrectangle($im, $x, $y1, $x1, $y, $color2); |
|
562 | + imagerectangle($im, $x, $y1, $x1, $y, $color1); |
|
563 | + if ($text) { |
|
564 | + if ($placeindex>0) { |
|
565 | + |
|
566 | + if ($placeindex<16) |
|
567 | + { |
|
568 | + $px=5; |
|
569 | + $py=$placeindex*12+6; |
|
570 | + imagefilledrectangle($im, $px+90, $py+3, $px+90-4, $py-3, $color2); |
|
571 | + imageline($im,$x,$y+$h/2,$px+90,$py,$color2); |
|
572 | + imagestring($im,2,$px,$py-6,$text,$color1); |
|
573 | + |
|
574 | + } else { |
|
575 | + if ($placeindex<31) { |
|
576 | + $px=$x+40*2; |
|
577 | + $py=($placeindex-15)*12+6; |
|
578 | + } else { |
|
579 | + $px=$x+40*2+100*intval(($placeindex-15)/15); |
|
580 | + $py=($placeindex%15)*12+6; |
|
581 | + } |
|
582 | + imagefilledrectangle($im, $px, $py+3, $px-4, $py-3, $color2); |
|
583 | + imageline($im,$x+$w,$y+$h/2,$px,$py,$color2); |
|
584 | + imagestring($im,2,$px+2,$py-6,$text,$color1); |
|
585 | + } |
|
586 | + } else { |
|
587 | + imagestring($im,4,$x+5,$y1-16,$text,$color1); |
|
588 | + } |
|
589 | + } |
|
590 | + } |
|
591 | 591 | |
592 | 592 | |
593 | 593 | function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1,$color2,$text='',$placeindex=0) { |
594 | - $r=$diameter/2; |
|
595 | - $w=deg2rad((360+$start+($end-$start)/2)%360); |
|
596 | - |
|
597 | - |
|
598 | - if (function_exists("imagefilledarc")) { |
|
599 | - // exists only if GD 2.0.1 is avaliable |
|
600 | - imagefilledarc($im, $centerX+1, $centerY+1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE); |
|
601 | - imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2, IMG_ARC_PIE); |
|
602 | - imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color1, IMG_ARC_NOFILL|IMG_ARC_EDGED); |
|
603 | - } else { |
|
604 | - imagearc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2); |
|
605 | - imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2); |
|
606 | - imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start+1)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2); |
|
607 | - imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end-1)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2); |
|
608 | - imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2); |
|
609 | - imagefill($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2, $color2); |
|
610 | - } |
|
611 | - if ($text) { |
|
612 | - if ($placeindex>0) { |
|
613 | - imageline($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$diameter, $placeindex*12,$color1); |
|
614 | - imagestring($im,4,$diameter, $placeindex*12,$text,$color1); |
|
615 | - |
|
616 | - } else { |
|
617 | - imagestring($im,4,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$text,$color1); |
|
618 | - } |
|
619 | - } |
|
620 | - } |
|
621 | - $size = GRAPH_SIZE; // image size |
|
622 | - $image = imagecreate($size+50, $size+10); |
|
594 | + $r=$diameter/2; |
|
595 | + $w=deg2rad((360+$start+($end-$start)/2)%360); |
|
596 | + |
|
597 | + |
|
598 | + if (function_exists("imagefilledarc")) { |
|
599 | + // exists only if GD 2.0.1 is avaliable |
|
600 | + imagefilledarc($im, $centerX+1, $centerY+1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE); |
|
601 | + imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2, IMG_ARC_PIE); |
|
602 | + imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color1, IMG_ARC_NOFILL|IMG_ARC_EDGED); |
|
603 | + } else { |
|
604 | + imagearc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2); |
|
605 | + imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2); |
|
606 | + imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start+1)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2); |
|
607 | + imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end-1)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2); |
|
608 | + imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2); |
|
609 | + imagefill($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2, $color2); |
|
610 | + } |
|
611 | + if ($text) { |
|
612 | + if ($placeindex>0) { |
|
613 | + imageline($im,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$diameter, $placeindex*12,$color1); |
|
614 | + imagestring($im,4,$diameter, $placeindex*12,$text,$color1); |
|
623 | 615 | |
624 | - $col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); |
|
625 | - $col_red = imagecolorallocate($image, 0xD0, 0x60, 0x30); |
|
626 | - $col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60); |
|
627 | - $col_black = imagecolorallocate($image, 0, 0, 0); |
|
616 | + } else { |
|
617 | + imagestring($im,4,$centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2,$text,$color1); |
|
618 | + } |
|
619 | + } |
|
620 | + } |
|
621 | + $size = GRAPH_SIZE; // image size |
|
622 | + $image = imagecreate($size+50, $size+10); |
|
623 | + |
|
624 | + $col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); |
|
625 | + $col_red = imagecolorallocate($image, 0xD0, 0x60, 0x30); |
|
626 | + $col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60); |
|
627 | + $col_black = imagecolorallocate($image, 0, 0, 0); |
|
628 | 628 | |
629 | - imagecolortransparent($image,$col_white); |
|
629 | + imagecolortransparent($image,$col_white); |
|
630 | 630 | |
631 | 631 | switch ($_GET['IMG']){ |
632 | 632 | case 1: // pie chart |
633 | 633 | $tsize=$memcacheStats['limit_maxbytes']; |
634 | - $avail=$tsize-$memcacheStats['bytes']; |
|
635 | - $x=$y=$size/2; |
|
636 | - $angle_from = 0; |
|
637 | - $fuzz = 0.000001; |
|
634 | + $avail=$tsize-$memcacheStats['bytes']; |
|
635 | + $x=$y=$size/2; |
|
636 | + $angle_from = 0; |
|
637 | + $fuzz = 0.000001; |
|
638 | 638 | |
639 | 639 | foreach($memcacheStatsSingle as $serv=>$mcs) { |
640 | - $free = $mcs['STAT']['limit_maxbytes']-$mcs['STAT']['bytes']; |
|
641 | - $used = $mcs['STAT']['bytes']; |
|
640 | + $free = $mcs['STAT']['limit_maxbytes']-$mcs['STAT']['bytes']; |
|
641 | + $used = $mcs['STAT']['bytes']; |
|
642 | 642 | |
643 | 643 | |
644 | 644 | if ($free>0){ |
645 | - // draw free |
|
646 | - $angle_to = ($free*360)/$tsize; |
|
645 | + // draw free |
|
646 | + $angle_to = ($free*360)/$tsize; |
|
647 | 647 | $perc =sprintf("%.2f%%", ($free *100) / $tsize) ; |
648 | 648 | |
649 | - fill_arc($image,$x,$y,$size,$angle_from,$angle_from + $angle_to ,$col_black,$col_green,$perc); |
|
650 | - $angle_from = $angle_from + $angle_to ; |
|
649 | + fill_arc($image,$x,$y,$size,$angle_from,$angle_from + $angle_to ,$col_black,$col_green,$perc); |
|
650 | + $angle_from = $angle_from + $angle_to ; |
|
651 | 651 | } |
652 | - if ($used>0){ |
|
653 | - // draw used |
|
654 | - $angle_to = ($used*360)/$tsize; |
|
655 | - $perc =sprintf("%.2f%%", ($used *100) / $tsize) ; |
|
656 | - fill_arc($image,$x,$y,$size,$angle_from,$angle_from + $angle_to ,$col_black,$col_red, '('.$perc.')' ); |
|
652 | + if ($used>0){ |
|
653 | + // draw used |
|
654 | + $angle_to = ($used*360)/$tsize; |
|
655 | + $perc =sprintf("%.2f%%", ($used *100) / $tsize) ; |
|
656 | + fill_arc($image,$x,$y,$size,$angle_from,$angle_from + $angle_to ,$col_black,$col_red, '('.$perc.')' ); |
|
657 | 657 | $angle_from = $angle_from+ $angle_to ; |
658 | - } |
|
659 | - } |
|
658 | + } |
|
659 | + } |
|
660 | 660 | |
661 | 661 | break; |
662 | 662 | |
@@ -666,14 +666,14 @@ discard block |
||
666 | 666 | $misses = ($memcacheStats['get_misses']==0) ? 1:$memcacheStats['get_misses']; |
667 | 667 | $total = $hits + $misses ; |
668 | 668 | |
669 | - fill_box($image, 30,$size,50,-$hits*($size-21)/$total,$col_black,$col_green,sprintf("%.1f%%",$hits*100/$total)); |
|
670 | - fill_box($image,130,$size,50,-max(4,($total-$hits)*($size-21)/$total),$col_black,$col_red,sprintf("%.1f%%",$misses*100/$total)); |
|
671 | - break; |
|
669 | + fill_box($image, 30,$size,50,-$hits*($size-21)/$total,$col_black,$col_green,sprintf("%.1f%%",$hits*100/$total)); |
|
670 | + fill_box($image,130,$size,50,-max(4,($total-$hits)*($size-21)/$total),$col_black,$col_red,sprintf("%.1f%%",$misses*100/$total)); |
|
671 | + break; |
|
672 | 672 | |
673 | 673 | } |
674 | 674 | header("Content-type: image/png"); |
675 | - imagepng($image); |
|
676 | - exit; |
|
675 | + imagepng($image); |
|
676 | + exit; |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | echo getHeader(); |
@@ -682,14 +682,14 @@ discard block |
||
682 | 682 | switch ($_GET['op']) { |
683 | 683 | |
684 | 684 | case 1: // host stats |
685 | - $phpversion = phpversion(); |
|
685 | + $phpversion = phpversion(); |
|
686 | 686 | $memcacheStats = getMemcacheStats(); |
687 | 687 | $memcacheStatsSingle = getMemcacheStats(false); |
688 | 688 | |
689 | 689 | $mem_size = $memcacheStats['limit_maxbytes']; |
690 | - $mem_used = $memcacheStats['bytes']; |
|
691 | - $mem_avail= $mem_size-$mem_used; |
|
692 | - $startTime = time()-array_sum($memcacheStats['uptime']); |
|
690 | + $mem_used = $memcacheStats['bytes']; |
|
691 | + $mem_avail= $mem_size-$mem_used; |
|
692 | + $startTime = time()-array_sum($memcacheStats['uptime']); |
|
693 | 693 | |
694 | 694 | $curr_items = $memcacheStats['curr_items']; |
695 | 695 | $total_items = $memcacheStats['total_items']; |
@@ -697,33 +697,33 @@ discard block |
||
697 | 697 | $misses = ($memcacheStats['get_misses']==0) ? 1:$memcacheStats['get_misses']; |
698 | 698 | $sets = $memcacheStats['cmd_set']; |
699 | 699 | |
700 | - $req_rate = sprintf("%.2f",($hits+$misses)/($time-$startTime)); |
|
701 | - $hit_rate = sprintf("%.2f",($hits)/($time-$startTime)); |
|
702 | - $miss_rate = sprintf("%.2f",($misses)/($time-$startTime)); |
|
703 | - $set_rate = sprintf("%.2f",($sets)/($time-$startTime)); |
|
700 | + $req_rate = sprintf("%.2f",($hits+$misses)/($time-$startTime)); |
|
701 | + $hit_rate = sprintf("%.2f",($hits)/($time-$startTime)); |
|
702 | + $miss_rate = sprintf("%.2f",($misses)/($time-$startTime)); |
|
703 | + $set_rate = sprintf("%.2f",($sets)/($time-$startTime)); |
|
704 | 704 | |
705 | - echo <<< EOB |
|
705 | + echo <<< EOB |
|
706 | 706 | <div class="info div1"><h2>General Cache Information</h2> |
707 | 707 | <table cellspacing=0><tbody> |
708 | 708 | <tr class=tr-1><td class=td-0>PHP Version</td><td>$phpversion</td></tr> |
709 | 709 | EOB; |
710 | - echo "<tr class=tr-0><td class=td-0>Memcached Host". ((count($MEMCACHE_SERVERS)>1) ? 's':'')."</td><td>"; |
|
711 | - $i=0; |
|
712 | - if (!isset($_GET['singleout']) && count($MEMCACHE_SERVERS)>1){ |
|
713 | - foreach($MEMCACHE_SERVERS as $server){ |
|
714 | - echo ($i+1).'. <a href="'.$PHP_SELF.'&singleout='.$i++.'">'.$server.'</a><br/>'; |
|
715 | - } |
|
716 | - } |
|
717 | - else{ |
|
718 | - echo '1.'.$MEMCACHE_SERVERS[0]; |
|
719 | - } |
|
720 | - if (isset($_GET['singleout'])){ |
|
721 | - echo '<a href="'.$PHP_SELF.'">(all servers)</a><br/>'; |
|
722 | - } |
|
723 | - echo "</td></tr>\n"; |
|
724 | - echo "<tr class=tr-1><td class=td-0>Total Memcache Cache</td><td>".bsize($memcacheStats['limit_maxbytes'])."</td></tr>\n"; |
|
725 | - |
|
726 | - echo <<<EOB |
|
710 | + echo "<tr class=tr-0><td class=td-0>Memcached Host". ((count($MEMCACHE_SERVERS)>1) ? 's':'')."</td><td>"; |
|
711 | + $i=0; |
|
712 | + if (!isset($_GET['singleout']) && count($MEMCACHE_SERVERS)>1){ |
|
713 | + foreach($MEMCACHE_SERVERS as $server){ |
|
714 | + echo ($i+1).'. <a href="'.$PHP_SELF.'&singleout='.$i++.'">'.$server.'</a><br/>'; |
|
715 | + } |
|
716 | + } |
|
717 | + else{ |
|
718 | + echo '1.'.$MEMCACHE_SERVERS[0]; |
|
719 | + } |
|
720 | + if (isset($_GET['singleout'])){ |
|
721 | + echo '<a href="'.$PHP_SELF.'">(all servers)</a><br/>'; |
|
722 | + } |
|
723 | + echo "</td></tr>\n"; |
|
724 | + echo "<tr class=tr-1><td class=td-0>Total Memcache Cache</td><td>".bsize($memcacheStats['limit_maxbytes'])."</td></tr>\n"; |
|
725 | + |
|
726 | + echo <<<EOB |
|
727 | 727 | </tbody></table> |
728 | 728 | </div> |
729 | 729 | |
@@ -732,13 +732,13 @@ discard block |
||
732 | 732 | foreach($MEMCACHE_SERVERS as $server){ |
733 | 733 | echo '<table cellspacing=0><tbody>'; |
734 | 734 | echo '<tr class=tr-1><td class=td-1>'.$server.'</td><td><a href="'.$PHP_SELF.'&server='.array_search($server,$MEMCACHE_SERVERS).'&op=6">[<b>Flush this server</b>]</a></td></tr>'; |
735 | - echo '<tr class=tr-0><td class=td-0>Start Time</td><td>',date(DATE_FORMAT,$memcacheStatsSingle[$server]['STAT']['time']-$memcacheStatsSingle[$server]['STAT']['uptime']),'</td></tr>'; |
|
736 | - echo '<tr class=tr-1><td class=td-0>Uptime</td><td>',duration($memcacheStatsSingle[$server]['STAT']['time']-$memcacheStatsSingle[$server]['STAT']['uptime']),'</td></tr>'; |
|
737 | - echo '<tr class=tr-0><td class=td-0>Memcached Server Version</td><td>'.$memcacheStatsSingle[$server]['STAT']['version'].'</td></tr>'; |
|
738 | - echo '<tr class=tr-1><td class=td-0>Used Cache Size</td><td>',bsize($memcacheStatsSingle[$server]['STAT']['bytes']),'</td></tr>'; |
|
739 | - echo '<tr class=tr-0><td class=td-0>Total Cache Size</td><td>',bsize($memcacheStatsSingle[$server]['STAT']['limit_maxbytes']),'</td></tr>'; |
|
740 | - echo '</tbody></table>'; |
|
741 | - } |
|
735 | + echo '<tr class=tr-0><td class=td-0>Start Time</td><td>',date(DATE_FORMAT,$memcacheStatsSingle[$server]['STAT']['time']-$memcacheStatsSingle[$server]['STAT']['uptime']),'</td></tr>'; |
|
736 | + echo '<tr class=tr-1><td class=td-0>Uptime</td><td>',duration($memcacheStatsSingle[$server]['STAT']['time']-$memcacheStatsSingle[$server]['STAT']['uptime']),'</td></tr>'; |
|
737 | + echo '<tr class=tr-0><td class=td-0>Memcached Server Version</td><td>'.$memcacheStatsSingle[$server]['STAT']['version'].'</td></tr>'; |
|
738 | + echo '<tr class=tr-1><td class=td-0>Used Cache Size</td><td>',bsize($memcacheStatsSingle[$server]['STAT']['bytes']),'</td></tr>'; |
|
739 | + echo '<tr class=tr-0><td class=td-0>Total Cache Size</td><td>',bsize($memcacheStatsSingle[$server]['STAT']['limit_maxbytes']),'</td></tr>'; |
|
740 | + echo '</tbody></table>'; |
|
741 | + } |
|
742 | 742 | echo <<<EOB |
743 | 743 | |
744 | 744 | </div> |
@@ -746,28 +746,28 @@ discard block |
||
746 | 746 | <table cellspacing=0><tbody> |
747 | 747 | EOB; |
748 | 748 | |
749 | - $size='width='.(GRAPH_SIZE+50).' height='.(GRAPH_SIZE+10); |
|
750 | - echo <<<EOB |
|
749 | + $size='width='.(GRAPH_SIZE+50).' height='.(GRAPH_SIZE+10); |
|
750 | + echo <<<EOB |
|
751 | 751 | <tr> |
752 | 752 | <td class=td-0>Cache Usage</td> |
753 | 753 | <td class=td-1>Hits & Misses</td> |
754 | 754 | </tr> |
755 | 755 | EOB; |
756 | 756 | |
757 | - echo |
|
758 | - graphics_avail() ? |
|
759 | - '<tr>'. |
|
760 | - "<td class=td-0><img alt=\"\" $size src=\"$PHP_SELF&IMG=1&".(isset($_GET['singleout'])? 'singleout='.$_GET['singleout'].'&':'')."$time\"></td>". |
|
761 | - "<td class=td-1><img alt=\"\" $size src=\"$PHP_SELF&IMG=2&".(isset($_GET['singleout'])? 'singleout='.$_GET['singleout'].'&':'')."$time\"></td></tr>\n" |
|
762 | - : "", |
|
763 | - '<tr>', |
|
764 | - '<td class=td-0><span class="green box"> </span>Free: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"</td>\n", |
|
765 | - '<td class=td-1><span class="green box"> </span>Hits: ',$hits.sprintf(" (%.1f%%)",$hits*100/($hits+$misses)),"</td>\n", |
|
766 | - '</tr>', |
|
767 | - '<tr>', |
|
768 | - '<td class=td-0><span class="red box"> </span>Used: ',bsize($mem_used ).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"</td>\n", |
|
769 | - '<td class=td-1><span class="red box"> </span>Misses: ',$misses.sprintf(" (%.1f%%)",$misses*100/($hits+$misses)),"</td>\n"; |
|
770 | - echo <<< EOB |
|
757 | + echo |
|
758 | + graphics_avail() ? |
|
759 | + '<tr>'. |
|
760 | + "<td class=td-0><img alt=\"\" $size src=\"$PHP_SELF&IMG=1&".(isset($_GET['singleout'])? 'singleout='.$_GET['singleout'].'&':'')."$time\"></td>". |
|
761 | + "<td class=td-1><img alt=\"\" $size src=\"$PHP_SELF&IMG=2&".(isset($_GET['singleout'])? 'singleout='.$_GET['singleout'].'&':'')."$time\"></td></tr>\n" |
|
762 | + : "", |
|
763 | + '<tr>', |
|
764 | + '<td class=td-0><span class="green box"> </span>Free: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"</td>\n", |
|
765 | + '<td class=td-1><span class="green box"> </span>Hits: ',$hits.sprintf(" (%.1f%%)",$hits*100/($hits+$misses)),"</td>\n", |
|
766 | + '</tr>', |
|
767 | + '<tr>', |
|
768 | + '<td class=td-0><span class="red box"> </span>Used: ',bsize($mem_used ).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"</td>\n", |
|
769 | + '<td class=td-1><span class="red box"> </span>Misses: ',$misses.sprintf(" (%.1f%%)",$misses*100/($hits+$misses)),"</td>\n"; |
|
770 | + echo <<< EOB |
|
771 | 771 | </tr> |
772 | 772 | </tbody></table> |
773 | 773 | <br/> |
@@ -789,31 +789,31 @@ discard block |
||
789 | 789 | |
790 | 790 | case 2: // variables |
791 | 791 | |
792 | - $m=0; |
|
793 | - $cacheItems= getCacheItems(); |
|
794 | - $items = $cacheItems['items']; |
|
795 | - $totals = $cacheItems['counts']; |
|
796 | - $maxDump = MAX_ITEM_DUMP; |
|
797 | - foreach($items as $server => $entries) { |
|
792 | + $m=0; |
|
793 | + $cacheItems= getCacheItems(); |
|
794 | + $items = $cacheItems['items']; |
|
795 | + $totals = $cacheItems['counts']; |
|
796 | + $maxDump = MAX_ITEM_DUMP; |
|
797 | + foreach($items as $server => $entries) { |
|
798 | 798 | |
799 | - echo <<< EOB |
|
799 | + echo <<< EOB |
|
800 | 800 | |
801 | 801 | <div class="info"><table cellspacing=0><tbody> |
802 | 802 | <tr><th colspan="2">$server</th></tr> |
803 | 803 | <tr><th>Slab Id</th><th>Info</th></tr> |
804 | 804 | EOB; |
805 | 805 | |
806 | - foreach($entries as $slabId => $slab) { |
|
807 | - $dumpUrl = $PHP_SELF.'&op=2&server='.(array_search($server,$MEMCACHE_SERVERS)).'&dumpslab='.$slabId; |
|
808 | - echo |
|
809 | - "<tr class=tr-$m>", |
|
810 | - "<td class=td-0><center>",'<a href="',$dumpUrl,'">',$slabId,'</a>',"</center></td>", |
|
811 | - "<td class=td-last><b>Item count:</b> ",$slab['number'],'<br/><b>Age:</b>',duration($time-$slab['age']),'<br/> <b>Evicted:</b>',((isset($slab['evicted']) && $slab['evicted']==1)? 'Yes':'No'); |
|
812 | - if ((isset($_GET['dumpslab']) && $_GET['dumpslab']==$slabId) && (isset($_GET['server']) && $_GET['server']==array_search($server,$MEMCACHE_SERVERS))){ |
|
813 | - echo "<br/><b>Items: item</b><br/>"; |
|
814 | - $items = dumpCacheSlab($server,$slabId,$slab['number']); |
|
806 | + foreach($entries as $slabId => $slab) { |
|
807 | + $dumpUrl = $PHP_SELF.'&op=2&server='.(array_search($server,$MEMCACHE_SERVERS)).'&dumpslab='.$slabId; |
|
808 | + echo |
|
809 | + "<tr class=tr-$m>", |
|
810 | + "<td class=td-0><center>",'<a href="',$dumpUrl,'">',$slabId,'</a>',"</center></td>", |
|
811 | + "<td class=td-last><b>Item count:</b> ",$slab['number'],'<br/><b>Age:</b>',duration($time-$slab['age']),'<br/> <b>Evicted:</b>',((isset($slab['evicted']) && $slab['evicted']==1)? 'Yes':'No'); |
|
812 | + if ((isset($_GET['dumpslab']) && $_GET['dumpslab']==$slabId) && (isset($_GET['server']) && $_GET['server']==array_search($server,$MEMCACHE_SERVERS))){ |
|
813 | + echo "<br/><b>Items: item</b><br/>"; |
|
814 | + $items = dumpCacheSlab($server,$slabId,$slab['number']); |
|
815 | 815 | // maybe someone likes to do a pagination here :) |
816 | - $i=1; |
|
816 | + $i=1; |
|
817 | 817 | foreach($items['ITEM'] as $itemKey=>$itemInfo){ |
818 | 818 | $itemInfo = trim($itemInfo,'[ ]'); |
819 | 819 | |
@@ -826,17 +826,17 @@ discard block |
||
826 | 826 | echo ','; |
827 | 827 | } |
828 | 828 | } |
829 | - } |
|
829 | + } |
|
830 | 830 | |
831 | - echo "</td></tr>"; |
|
832 | - $m=1-$m; |
|
833 | - } |
|
834 | - echo <<<EOB |
|
831 | + echo "</td></tr>"; |
|
832 | + $m=1-$m; |
|
833 | + } |
|
834 | + echo <<<EOB |
|
835 | 835 | </tbody></table> |
836 | 836 | </div><hr/> |
837 | 837 | EOB; |
838 | 838 | } |
839 | - break; |
|
839 | + break; |
|
840 | 840 | |
841 | 841 | break; |
842 | 842 | |
@@ -859,16 +859,16 @@ discard block |
||
859 | 859 | EOB; |
860 | 860 | if (!isset($r['VALUE'])) { |
861 | 861 | echo "<tr><td class=td-0>",$theserver,"</td><td class=td-0>",$theKey, |
862 | - "</td><td>[The requested item was not found or has expired]</td>", |
|
863 | - "<td></td>","</tr>"; |
|
862 | + "</td><td>[The requested item was not found or has expired]</td>", |
|
863 | + "<td></td>","</tr>"; |
|
864 | 864 | } |
865 | 865 | else { |
866 | 866 | |
867 | 867 | echo "<tr><td class=td-0>",$theserver,"</td><td class=td-0>",$theKey, |
868 | - " <br/>flag:",$r['VALUE'][$theKey]['stat']['flag'], |
|
869 | - " <br/>Size:",bsize($r['VALUE'][$theKey]['stat']['size']), |
|
870 | - "</td><td>",chunk_split($r['VALUE'][$theKey]['value'],40),"</td>", |
|
871 | - '<td><a href="',$PHP_SELF,'&op=5&server=',(int)$_GET['server'],'&key=',base64_encode($theKey),"\">Delete</a></td>","</tr>"; |
|
868 | + " <br/>flag:",$r['VALUE'][$theKey]['stat']['flag'], |
|
869 | + " <br/>Size:",bsize($r['VALUE'][$theKey]['stat']['size']), |
|
870 | + "</td><td>",chunk_split($r['VALUE'][$theKey]['value'],40),"</td>", |
|
871 | + '<td><a href="',$PHP_SELF,'&op=5&server=',(int)$_GET['server'],'&key=',base64_encode($theKey),"\">Delete</a></td>","</tr>"; |
|
872 | 872 | } |
873 | 873 | echo <<<EOB |
874 | 874 | </tbody></table> |
@@ -876,22 +876,22 @@ discard block |
||
876 | 876 | EOB; |
877 | 877 | break; |
878 | 878 | case 5: // item delete |
879 | - if (!isset($_GET['key']) || !isset($_GET['server'])){ |
|
880 | - echo "No key set!"; |
|
881 | - break; |
|
879 | + if (!isset($_GET['key']) || !isset($_GET['server'])){ |
|
880 | + echo "No key set!"; |
|
881 | + break; |
|
882 | 882 | } |
883 | 883 | $theKey = htmlentities(base64_decode($_GET['key'])); |
884 | - $theserver = $MEMCACHE_SERVERS[(int)$_GET['server']]; |
|
885 | - list($h,$p) = get_host_port_from_server($theserver); |
|
884 | + $theserver = $MEMCACHE_SERVERS[(int)$_GET['server']]; |
|
885 | + list($h,$p) = get_host_port_from_server($theserver); |
|
886 | 886 | $r = sendMemcacheCommand($h,$p,'delete '.$theKey); |
887 | 887 | echo 'Deleting '.$theKey.':'.$r; |
888 | - break; |
|
888 | + break; |
|
889 | 889 | |
890 | - case 6: // flush server |
|
890 | + case 6: // flush server |
|
891 | 891 | $theserver = $MEMCACHE_SERVERS[(int)$_GET['server']]; |
892 | 892 | $r = flushServer($theserver); |
893 | 893 | echo 'Flush '.$theserver.":".$r; |
894 | - break; |
|
894 | + break; |
|
895 | 895 | } |
896 | 896 | echo getFooter(); |
897 | 897 |