]> git.openstreetmap.org Git - nominatim.git/blob - lib-php/migration/PhraseSettingsToJson.php
add documentation for PHP part of tokenizer
[nominatim.git] / lib-php / migration / PhraseSettingsToJson.php
1 <?php
2
3 $phpPhraseSettingsFile = $argv[1];
4 $jsonPhraseSettingsFile = dirname($phpPhraseSettingsFile).'/'.basename($phpPhraseSettingsFile, '.php').'.json';
5
6 if (file_exists($phpPhraseSettingsFile) && !file_exists($jsonPhraseSettingsFile)) {
7     include $phpPhraseSettingsFile;
8
9     $data = array();
10
11     if (isset($aTagsBlacklist)) {
12         $data['blackList'] = $aTagsBlacklist;
13     }
14     if (isset($aTagsWhitelist)) {
15         $data['whiteList'] = $aTagsWhitelist;
16     }
17
18     $jsonFile = fopen($jsonPhraseSettingsFile, 'w');
19     fwrite($jsonFile, json_encode($data));
20     fclose($jsonFile);
21 }