mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-18 00:09:06 +01:00
Restore location paths in ldapsaisie.pot file but make it relative
This commit is contained in:
parent
4ae9e304ad
commit
fd81cb496f
3 changed files with 1942 additions and 1315 deletions
|
@ -317,10 +317,13 @@ class LScli extends LSlog_staticLoggerClass {
|
||||||
* @param[in] $command string|array The command. It's could be an array of the command with its arguments.
|
* @param[in] $command string|array The command. It's could be an array of the command with its arguments.
|
||||||
* @param[in] $data_stdin string|null The command arguments (optional, default: null)
|
* @param[in] $data_stdin string|null The command arguments (optional, default: null)
|
||||||
* @param[in] $escape_command_args boolean If true, the command will be escaped (optional, default: true)
|
* @param[in] $escape_command_args boolean If true, the command will be escaped (optional, default: true)
|
||||||
|
* @param[in] $cwd string|null The initial working dir for the command
|
||||||
|
* (optional, default: null = use current PHP
|
||||||
|
* process working directory)
|
||||||
*
|
*
|
||||||
* @retval false|array An array of return code, stdout and stderr result or False in case of fatal error
|
* @retval false|array An array of return code, stdout and stderr result or False in case of fatal error
|
||||||
**/
|
**/
|
||||||
public static function run_external_command($command, $data_stdin=null, $escape_command_args=true) {
|
public static function run_external_command($command, $data_stdin=null, $escape_command_args=true, $cwd=null) {
|
||||||
if (array($command))
|
if (array($command))
|
||||||
$command = implode(' ', $command);
|
$command = implode(' ', $command);
|
||||||
if ($escape_command_args)
|
if ($escape_command_args)
|
||||||
|
@ -331,7 +334,7 @@ class LScli extends LSlog_staticLoggerClass {
|
||||||
1 => array("pipe", "w"), // stdout
|
1 => array("pipe", "w"), // stdout
|
||||||
2 => array("pipe", "w"), // stderr
|
2 => array("pipe", "w"), // stderr
|
||||||
);
|
);
|
||||||
$process = proc_open($command, $descriptorspec, $pipes);
|
$process = proc_open($command, $descriptorspec, $pipes, $cwd);
|
||||||
|
|
||||||
if (!is_resource($process)) {
|
if (!is_resource($process)) {
|
||||||
self :: log_error("Fail to run external command: '$command'");
|
self :: log_error("Fail to run external command: '$command'");
|
||||||
|
|
|
@ -1059,9 +1059,10 @@ function cli_generate_ldapsaisie_pot($command_args) {
|
||||||
|
|
||||||
// List PHP files to parse
|
// List PHP files to parse
|
||||||
$php_files = LScli :: run_external_command(
|
$php_files = LScli :: run_external_command(
|
||||||
array('find', escapeshellarg(LS_ROOT_DIR), '-name', "'*.php'"),
|
array('find', '-name', "'*.php'"),
|
||||||
null, // no STDIN data
|
null, // no STDIN data
|
||||||
false // do not escape command args (already done)
|
false, // do not escape command args (already done)
|
||||||
|
LS_ROOT_DIR // run in LdapSaisie root directory to retreive relative paths
|
||||||
);
|
);
|
||||||
if (!is_array($php_files) || $php_files[0] != 0) {
|
if (!is_array($php_files) || $php_files[0] != 0) {
|
||||||
$LSlang_cli_logger -> fatal("Fail to list PHP files.");
|
$LSlang_cli_logger -> fatal("Fail to list PHP files.");
|
||||||
|
@ -1071,7 +1072,6 @@ function cli_generate_ldapsaisie_pot($command_args) {
|
||||||
$result = LScli :: run_external_command(
|
$result = LScli :: run_external_command(
|
||||||
array(
|
array(
|
||||||
"xgettext",
|
"xgettext",
|
||||||
"--no-location",
|
|
||||||
"--from-code utf-8",
|
"--from-code utf-8",
|
||||||
"--language=PHP",
|
"--language=PHP",
|
||||||
"-o", LS_I18N_DIR_PATH."/ldapsaisie-main.pot", // Output
|
"-o", LS_I18N_DIR_PATH."/ldapsaisie-main.pot", // Output
|
||||||
|
@ -1080,7 +1080,9 @@ function cli_generate_ldapsaisie_pot($command_args) {
|
||||||
"--keyword=___", // Handle custom ___() translation function
|
"--keyword=___", // Handle custom ___() translation function
|
||||||
"--files=-" // Read files to parse from STDIN
|
"--files=-" // Read files to parse from STDIN
|
||||||
),
|
),
|
||||||
$php_files[1] // Pass PHP files list via STDIN
|
$php_files[1], // Pass PHP files list via STDIN
|
||||||
|
true, // Escape parameters
|
||||||
|
LS_ROOT_DIR // Run in LdapSaisie root directory
|
||||||
);
|
);
|
||||||
if (!is_array($result) || $result[0] != 0)
|
if (!is_array($result) || $result[0] != 0)
|
||||||
$LSlang_cli_logger -> fatal("Fail to extract messages from PHP files using xgettext.");
|
$LSlang_cli_logger -> fatal("Fail to extract messages from PHP files using xgettext.");
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue