From 6a646b810b7aabdd1e3f0bafed7ef5a58844c957 Mon Sep 17 00:00:00 2001 From: haszi Date: Sat, 20 Apr 2024 16:09:10 +0200 Subject: [PATCH] Add file modification history setup (#120) Copy the appropriate file from the language repo or create an empty one to use Co-authored-by: haszi --- configure.php | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/configure.php b/configure.php index 4f1f1dd9d..4f7eb20df 100755 --- a/configure.php +++ b/configure.php @@ -59,6 +59,7 @@ function usage() // {{{ --disable-version-files Do not merge the extension specific version.xml files --disable-sources-file Do not generate sources.xml file + --disable-history-file Do not copy file modification history file --disable-libxml-check Disable the libxml 2.7.4+ requirement check --with-php=PATH Path to php CLI executable [detect] --with-lang=LANG Language to build [{$acd['LANG']}] @@ -295,6 +296,35 @@ function generate_sources_file() // {{{ } } // }}} +function getFileModificationHistory(): array { + global $ac; + + $lang_mod_file = (($ac['LANG'] !== 'en') ? ("{$ac['rootdir']}/{$ac['EN_DIR']}") : ("{$ac['rootdir']}/{$ac['LANGDIR']}")) . "/fileModHistory.php"; + $doc_base_mod_file = __DIR__ . "/fileModHistory.php"; + + if (file_exists($lang_mod_file)) { + $history_file = include $lang_mod_file; + if (is_array($history_file)) { + echo 'Copying modification history file... '; + $isFileCopied = copy($lang_mod_file, $doc_base_mod_file); + echo $isFileCopied ? "done.\n" : "failed.\n"; + } else { + echo "Corrupted modification history file found: $lang_mod_file \n"; + } + } else { + echo "Modification history file $lang_mod_file not found.\n"; + } + + if (!is_array($history_file)) { + $history_file = []; + echo "Creating empty modification history file..."; + file_put_contents($doc_base_mod_file, " 'yes', 'VERSION_FILES' => 'yes', 'SOURCES_FILE' => 'yes', + 'HISTORY_FILE' => 'yes', 'LIBXML_CHECK' => 'yes', 'USE_BROKEN_TRANSLATION_FILENAME' => 'yes', 'OUTPUT_FILENAME' => $srcdir . '/.manual.xml', @@ -467,6 +498,10 @@ function generate_sources_file() // {{{ $ac['SOURCES_FILE'] = $v; break; + case 'history-file': + $ac['SOURCES_FILE'] = $v; + break; + case 'libxml-check': $ac['LIBXML_CHECK'] = $v; break; @@ -697,6 +732,11 @@ function generate_sources_file() // {{{ generate_sources_file(); } +$history_file = []; +if ($ac['HISTORY_FILE'] === 'yes') { + $history_file = getFileModificationHistory(); +} + globbetyglob("{$ac['basedir']}/scripts", 'make_scripts_executable'); $redir = ($ac['quiet'] == 'yes') ? ' > ' . (is_windows() ? 'nul' : '/dev/null') : ''; @@ -875,4 +915,3 @@ function generate_sources_file() // {{{ errors_are_bad(1); // Tell the shell that this script finished with an error. } ?> -