Skip to content

Commit 219f22d

Browse files
committed
added breakdown.php
generates an xml (server-side) for use in breakdown
1 parent 76bd1e5 commit 219f22d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

breakdown/breakdown.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
// Generate index.xml for Breakdown
3+
4+
$folder = '/storage/ssd5/003/10550003/public_html/reports';
5+
$input = '<?xml version="1.0" standalone="yes"?><reports></reports>';
6+
$output = $folder . '/index.xml';
7+
8+
$xml = new SimpleXMLElement($input);
9+
$files = glob($folder . '/*.dmp', GLOB_BRACE);
10+
foreach($files as $file) {
11+
$info = pathinfo($file);
12+
$uuid = basename($file, '.' . $info['extension']);
13+
$report = $xml->addChild('report');
14+
$report->addChild('uuid', $uuid);
15+
$report->addChild('dmp', sha1_file($folder . '/' . $uuid. '.dmp'));
16+
$report->addChild('txt', sha1_file($folder . '/' . $uuid. '.txt'));
17+
}
18+
19+
$result = $xml->asXML();
20+
21+
$result_checksum = sha1($result);
22+
$old_checksum = '';
23+
if (file_exists($output)) {
24+
$old_checksum = sha1(file_get_contents($output));
25+
}
26+
if ($result_checksum != $old_checksum) {
27+
file_put_contents($output, $xml->asXML());
28+
}
29+
?>

0 commit comments

Comments
 (0)