Rev 267 | Rev 320 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 267 | Rev 319 | ||
---|---|---|---|
Line 40... | Line 40... | ||
40 | if ($cnt){ |
40 | if ($cnt){ |
41 | $str .= ","; |
41 | $str .= ","; |
42 | } |
42 | } |
43 | if($node->hasChildNodes()) { |
43 | if($node->hasChildNodes()) { |
44 | if (!$node->childNodes->item(0)->hasChildNodes() || |
44 | if (!$node->childNodes->item(0)->hasChildNodes() || |
45 | strpos($node->nodeName,"list")!==false |
45 | strpos($node->nodeName,"list")!==false |
46 |
|
46 | // || $node->nodeName === "histogram" |
- | 47 | ) { |
|
47 | $str .= parseDOMNode($node); |
48 | $str .= parseDOMNode($node); |
48 | } else { |
49 | } else { |
49 | $str .= $node->nodeName.'(' ; |
50 | $str .= $node->nodeName.'(' ; |
- | 51 | if ( $node->nodeName === "histogram") $str .= $node->childNodes->length . ',' ; |
|
50 | $str .= parseDOMNode($node); |
52 | $str .= parseDOMNode($node); |
51 | $str .= ') ' ; |
53 | $str .= ') ' ; |
52 | } |
54 | } |
53 | 55 | ||
54 | } else { |
56 | } else { |
Line 135... | Line 137... | ||
135 | $len = $unpacked[2]; |
137 | $len = $unpacked[2]; |
136 | $progress = $unpacked[3]; |
138 | $progress = $unpacked[3]; |
137 | if ($len>0){ |
139 | if ($len>0){ |
138 | $out= fread($pipe, $len); |
140 | $out= fread($pipe, $len); |
139 | if ($id == 3){ |
141 | if ($id == 3){ |
- | 142 | $hostname = gethostname(); |
|
- | 143 | if ($hostname == "belle2.ijs.si") { |
|
140 | stat2db($out); |
144 | stat2db($out); |
- | 145 | } |
|
141 | // $out = $_SERVER['REMOTE_ADDR'] . ";" .$out ; |
146 | // $out = $_SERVER['REMOTE_ADDR'] . ";" .$out ; |
142 | // $retval = system("echo '$out' >> public/blab2stat.txt "); |
147 | // $retval = system("echo '$out' >> public/blab2stat.txt "); |
143 | // $out .= ";" . $retval; |
148 | // $out .= ";" . $retval; |
144 | $id = 0 ; |
149 | $id = 0 ; |
145 | } |
150 | } |
Line 162... | Line 167... | ||
162 | ob_flush(); |
167 | ob_flush(); |
163 | } |
168 | } |
164 | flush(); |
169 | flush(); |
165 | } |
170 | } |
166 | 171 | ||
- | 172 | ||
- | 173 | function removeTrailingCommas($json) |
|
- | 174 | { |
|
- | 175 | $json=preg_replace('/,\s*([\]}])/m', '$1', $json); |
|
- | 176 | return $json; |
|
- | 177 | } |
|
167 | 178 | ||
168 | 179 | ||
169 | $code=""; |
180 | $code=""; |
170 | if (PHP_SAPI === 'cli') { |
181 | if (PHP_SAPI === 'cli') { |
171 | $code = $argv[1]; |
182 | $code = $argv[1]; |
172 | } else { |
183 | } else { |
173 | if (isset($_GET["code"])){ |
184 | if (isset($_GET["code"])){ |
174 | $code = $_GET["code"]; |
185 | $code = $_GET["code"]; |
175 | } |
186 | } |
176 | } |
187 | } |
- | 188 | ||
- | 189 | $code = removeTrailingCommas($code); |
|
- | 190 | //send_message(0,"$code",0); |
|
177 | 191 | ||
178 | $data = json_decode($code, true); |
192 | $data = json_decode($code, true); |
- | 193 | ||
- | 194 | ||
- | 195 | $ierr =json_last_error(); |
|
- | 196 | if (json_last_error() != JSON_ERROR_NONE) { |
|
- | 197 | send_message(0,"JSON Error $ierr ! cannot convert...",0); |
|
- | 198 | send_message('CLOSE', "Stopping...",100); |
|
- | 199 | } |
|
- | 200 | ||
- | 201 | ||
179 | 202 | ||
180 | $neve = $data['analysis']['neve']; |
203 | $neve = $data['analysis']['neve']; |
181 | $first = $data['analysis']['first']; |
204 | $first = $data['analysis']['first']; |
182 | $evprint = $data['analysis']['print']; |
205 | $evprint = $data['analysis']['print']; |
183 | $source= $data['analysis']['datasource']; |
206 | $source= $data['analysis']['datasource']; |
184 | 207 | ||
185 | $xml = '<?xml version="1.0" encoding="utf-8"?>' . xmlWalker($data,'start'); |
208 | $xml = '<?xml version="1.0" encoding="utf-8"?>' . xmlWalker($data,'start'); |
186 | $dom = new DOMDocument; |
209 | $dom = new DOMDocument; |
187 | $dom->loadXML($xml); |
210 | $dom->loadXML($xml); |
188 | - | ||
189 | 211 | /* |
|
190 | echo "<pre>"; |
212 | echo "<pre>"; |
191 | echo $dom->saveXML(); |
213 | echo $dom->saveXML(); |
192 | echo "</pre>"; |
214 | echo "</pre>"; |
193 | echo PHP_EOL; |
215 | echo PHP_EOL; |
- | 216 | */ |
|
194 | 217 | ||
195 | $cnt=0; |
218 | $cnt=0; |
196 | 219 | ||
197 | $fstart = $dom->createElement("init"); |
220 | $fstart = $dom->createElement("init"); |
198 | $dom->appendChild($fstart); |
221 | $dom->appendChild($fstart); |
199 | 222 | ||
200 | $el = $dom->getElementsByTagName('neve')->item(0); |
223 | $el = $dom->getElementsByTagName('neve')->item(0); |
201 | $fstart->appendChild($el); |
224 | $fstart->appendChild($el); |
202 | $el = $dom->getElementsByTagName('first')->item(0); |
225 | $el = $dom->getElementsByTagName('first')->item(0); |
203 | $fstart->appendChild($el); |
226 | $fstart->appendChild($el); |
204 | $el = $dom->getElementsByTagName('print')->item(0); |
227 | $el = $dom->getElementsByTagName('print')->item(0); |
Line 242... | Line 265... | ||
242 | $plist->appendChild($newnode); |
265 | $plist->appendChild($newnode); |
243 | } |
266 | } |
244 | } |
267 | } |
245 | //$isEmpty = $elem->childNodes->length === 0; |
268 | //$isEmpty = $elem->childNodes->length === 0; |
246 | 269 | ||
- | 270 | /* |
|
247 | echo "<pre>"; |
271 | echo "<pre>"; |
248 | echo $dom->saveXML(); |
272 | echo $dom->saveXML(); |
249 | echo "</pre>"; |
273 | echo "</pre>"; |
250 | - | ||
251 | echo PHP_EOL; |
274 | echo PHP_EOL; |
- | 275 | */ |
|
252 | 276 | ||
253 | $str=""; |
277 | $str=""; |
254 | foreach ($dom->getElementsByTagName('analysis') as $node){ |
278 | foreach ($dom->getElementsByTagName('analysis') as $node){ |
255 | $str = PHP_EOL . "void Blab2::event(){" . PHP_EOL ; |
279 | $str = PHP_EOL . "void Blab2::event(){" . PHP_EOL ; |
256 | $str .= parseDOMNode($node) . ";"; |
280 | $str .= parseDOMNode($node) . ";"; |