Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SWITCHwayf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Guillaume Rousse
SWITCHwayf
Commits
2858a5cb
Commit
2858a5cb
authored
Jul 29, 2013
by
haemmer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added two helper scripts
parent
c9dff61c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
0 deletions
+86
-0
check-locales.php
check-locales.php
+35
-0
update-config.php
update-config.php
+51
-0
No files found.
check-locales.php
0 → 100644
View file @
2858a5cb
<?php
// This script checks for missing and incomplete locales
if
(
isset
(
$_SERVER
[
'REMOTE_ADDR'
])){
exit
(
'No direct script access allowed'
);
}
require_once
(
'languages.php'
);
include
(
'custom-languages.php'
);
echo
"The following problems were found:
\n
"
;
$refLang
=
'en'
;
foreach
(
array_keys
(
$langStrings
)
as
$lang
){
if
(
$lang
==
'en'
){
continue
;
}
foreach
(
$langStrings
[
'en'
]
as
$k
=>
$v
){
if
(
!
isset
(
$langStrings
[
$lang
][
$k
])){
echo
"* In '
$lang
' missing locale '
$k
'
\n
"
;
}
else
if
(
substr_count
(
$langStrings
[
'en'
][
$k
],
'%s'
)
!=
substr_count
(
$langStrings
[
$lang
][
$k
],
'%s'
)){
echo
"* In '
$lang
' the number of substitutions (%s) differ for '
$k
': "
;
echo
substr_count
(
$langStrings
[
'en'
][
$k
],
'%s'
)
.
' vs '
.
substr_count
(
$langStrings
[
$lang
][
$k
],
'%s'
);
echo
"
\n
"
;
}
}
foreach
(
$langStrings
[
$lang
]
as
$k
=>
$v
){
if
(
!
isset
(
$langStrings
[
'en'
][
$k
])){
echo
"In
$lang
obsolete locale
$k
\n
"
;
}
}
}
?>
\ No newline at end of file
update-config.php
0 → 100644
View file @
2858a5cb
<?php
// This script reads an existing config.php and generates
// a new file config.new.php merging the default configuration file
// config.dist.php with the (customized) config.php
if
(
isset
(
$_SERVER
[
'REMOTE_ADDR'
])){
exit
(
'No direct script access allowed'
);
}
if
(
!
file_exists
(
'config.dist.php'
))
{
die
(
'The default configuration file config.dist.php does not exist in this directory!'
);
}
if
(
!
file_exists
(
'config.php'
))
{
die
(
'The configuration file config.php does not exist in this directory!'
);
}
require_once
(
'config.php'
);
echo
"Parsing current configuration and default configuration...
\n
"
;
$fp
=
fopen
(
'config.new.php'
,
'w'
);
$distConfigFile
=
file
(
'config.dist.php'
);
$currentConfigFile
=
file
(
'config.php'
);
$configSettings
=
Array
();
foreach
(
$currentConfigFile
as
$line
){
if
(
preg_match
(
'|^\s*(\$(.+?)\s*=.+;)|'
,
$line
,
$matches
)){
$var
=
$matches
[
2
];
$configSettings
[
$var
]
=
$matches
[
1
];
}
}
echo
"Merging configurations...
\n
"
;
foreach
(
$distConfigFile
as
$line
){
fwrite
(
$fp
,
$line
);
if
(
preg_match
(
'|^(\s*)\/\/\$(.+) =|'
,
$line
,
$matches
)){
$indent
=
$matches
[
1
];
$var
=
$matches
[
2
];
if
(
isset
(
$configSettings
[
$var
])){
echo
"* Using from current configuration: "
;
echo
$configSettings
[
$var
]
.
"
\n
"
;
$config
=
$indent
.
$configSettings
[
$var
]
.
"
\n
"
;
fwrite
(
$fp
,
$config
);
}
}
}
fclose
(
$fp
);
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment