mirror of
https://github.com/mbirth/tcl_update_db.git
synced 2024-11-09 23:06:45 +00:00
Added writing backup copy to data/ directory.
This commit is contained in:
parent
0ac893aeca
commit
c62c036905
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
/data/
|
||||
/otadb.db3
|
||||
|
12
index.php
12
index.php
@ -27,10 +27,16 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
echo "Input length is " . strlen($input_xml) . " Bytes." . PHP_EOL;
|
||||
#echo $input_xml . PHP_EOL;
|
||||
|
||||
// Write backup copy (for maybe re-parsing later)
|
||||
$bkup_dir = __DIR__ . '/data/';
|
||||
if (!is_dir($bkup_dir)) {
|
||||
mkdir($bkup_dir);
|
||||
}
|
||||
$bkup_filename = $bkup_dir . sprintf('%f-%04x.xml', microtime(true), rand(0, 65535));
|
||||
file_put_contents($bkup_filename, $input_xml);
|
||||
|
||||
// TODO: Parse XML into database
|
||||
|
||||
// TODO: Check if it's XML
|
||||
// If so: Store a copy for re-parsing (or to print out and hang up on a wall)
|
||||
// Then parse XML into database
|
||||
exit;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user