diff --git a/crontab/sitemap.php b/crontab/sitemap.php new file mode 100644 index 0000000..5991e8b --- /dev/null +++ b/crontab/sitemap.php @@ -0,0 +1,59 @@ +'; +$transaction .= ''; + +$namespace = ''; +$namespace .= ''; + +$namespaces = []; +$transactions = []; + +foreach ($db->getData(false, false, false, 0, 1000000) as $value) { + + if (!in_array($value['namehash'], $namespaces)) { + $namespace .= '' . BASE_URL . '/' . $value['namehash'] . ''; + } + + + if (!in_array($value['namehash'], $transactions)) { + $transaction .= '' . BASE_URL . '/' . $value['txid'] . ''; + } + + $namespaces[] = $value['namehash']; + $transactions[] = $value['txid']; +} + +$namespace .= ''; +$transaction .= ''; + +$handle = fopen(dirname(__FILE__) . '/../public/sitemap.transaction.xml', 'w'); +fwrite($handle, $transaction); +fclose($handle); + + +$handle = fopen(dirname(__FILE__) . '/../public/sitemap.namespace.xml', 'w'); +fwrite($handle, $namespace); +fclose($handle); + + +// Sitemap +$sitemap = ''; +$sitemap .= ''; +$sitemap .= ' '; +$sitemap .= ' ' . BASE_URL . '/sitemap.namespace.xml'; +$sitemap .= ' '; +$sitemap .= ' '; +$sitemap .= ' ' . BASE_URL . '/sitemap.transaction.xml'; +$sitemap .= ' '; +$sitemap .= ''; + +$handle = fopen(dirname(__FILE__) . '/../public/sitemap.xml', 'w'); +fwrite($handle, $sitemap); +fclose($handle);