]> git.openstreetmap.org Git - nominatim.git/commitdiff
Changed phrase_settings.py to phrase-settings.json and added migration function for...
authorAntoJvlt <antonin.jolivat@gmail.com>
Sun, 21 Mar 2021 23:07:55 +0000 (00:07 +0100)
committerAntoJvlt <antonin.jolivat@gmail.com>
Tue, 23 Mar 2021 22:27:56 +0000 (23:27 +0100)
lib-php/migration/phraseSettingsToJson.php [new file with mode: 0644]

diff --git a/lib-php/migration/phraseSettingsToJson.php b/lib-php/migration/phraseSettingsToJson.php
new file mode 100644 (file)
index 0000000..15c49f0
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+$phpPhraseSettingsFile = $argv[1];
+$jsonPhraseSettingsFile = dirname($phpPhraseSettingsFile).'/'.basename($phpPhraseSettingsFile, '.php').'.json';
+
+if (file_exists($phpPhraseSettingsFile) && !file_exists($jsonPhraseSettingsFile)) {
+    include $phpPhraseSettingsFile;
+
+    $data = array();
+
+    if (isset($aTagsBlacklist))
+        $data['blackList'] = $aTagsBlacklist;
+    if (isset($aTagsWhitelist))
+        $data['whiteList'] = $aTagsWhitelist;
+
+    $jsonFile = fopen($jsonPhraseSettingsFile, 'w');
+    fwrite($jsonFile, json_encode($data));
+    fclose($jsonFile);
+}