fix langs managment

This commit is contained in:
Miraty 2023-10-28 18:16:16 +02:00
parent dcea304d8f
commit 4413249693

View file

@ -50,7 +50,6 @@ function clearnetOrOnion($clearnet_url, $onion_url) {
}
$dirs_last_update = [];
$dirs_entries = [];
$pages_langs = [];
$nodes = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(SITE, RecursiveDirectoryIterator::SKIP_DOTS));
@ -80,6 +79,7 @@ foreach($nodes as $node) {
$lang = $matches['lang'] ?? $config['default-lang'] ?? exit('no language found for ' . $src . LF);
$pages_langs[$path_parts_src['dirname'] . '/' . $matches['pagename']][] = $lang;
$files_langs[$src] = $lang;
$page_names[$src] = $matches['pagename'];
}
@ -94,6 +94,7 @@ foreach ($pages as $node) {
$base_filepath_target = $path_parts_target['dirname'] . '/' . $path_parts_target['filename'];
$content = file_get_contents($src);
$lang = $files_langs[$src];
preg_match('/^# (?<title>.*)$/Dm', $content, $matches);
$title = $matches['title'] ?? NULL;