Skip to content
Snippets Groups Projects
Commit cb3a8d8f authored by Tyler Antonio's avatar Tyler Antonio
Browse files

Added import script for flatfile metadata

parent c18dce47
No related branches found
No related tags found
No related merge requests found
<?php
$baseDir = dirname(dirname(__FILE__));
require_once $baseDir . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . '_autoload.php';
require_once $baseDir . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
# Iterate through configured metadata sources and ensure
# that a PDO source exists.
foreach ($config['metadata.sources'] as $s) {
# If pdo is configured, create the new handler and add in the metadata sets.
if ("pdo" === $s['type']) {
$mdshp = new SimpleSAML_Metadata_MetaDataStorageHandlerPdo($s);
$mdshp->initDatabase();
foreach (glob("metadata/*.php") as $filename) {
$metadata = array();
require_once $filename;
$set = basename($filename, ".php");
echo "importing set '$set'..." . PHP_EOL;
foreach ($metadata as $k => $v) {
echo "\t$k" . PHP_EOL;
$mdshp->addEntry($k, $set, $v);
}
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment