mirror of
https://github.com/mbirth/tcl_update_db.git
synced 2024-11-09 23:06:45 +00:00
30 lines
708 B
PHP
Executable File
30 lines
708 B
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
|
|
require_once __DIR__ . '/lib/autoloader.php';
|
|
|
|
use \TclUpdates\GotuObject;
|
|
use \TclUpdates\XmlParser;
|
|
|
|
$bkup_dir = __DIR__ . '/data/';
|
|
|
|
$file_list = glob($bkup_dir . '*.xml');
|
|
|
|
foreach ($file_list as $file) {
|
|
$filename = basename($file);
|
|
$data = file_get_contents($file);
|
|
$xp = new XmlParser();
|
|
$load_ok = $xp->loadXmlFromString($data);
|
|
if (!$load_ok) {
|
|
echo 'Could not load ' . $filename . '!' . PHP_EOL;
|
|
continue;
|
|
}
|
|
if (!$xp->validateGOTU()) {
|
|
echo 'XML not valid in ' . $filename . '!' . PHP_EOL;
|
|
continue;
|
|
}
|
|
echo 'Processing ' . $filename . PHP_EOL;
|
|
$g = GotuObject::fromXmlParser($xp);
|
|
print_r($g);
|
|
}
|