Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
232150b1
Commit
232150b1
authored
10 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
i18n: Automate dns signature publishing for language packs
parent
9adad36f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup/cli/modules/i18n.php
+63
-6
63 additions, 6 deletions
setup/cli/modules/i18n.php
with
63 additions
and
6 deletions
setup/cli/modules/i18n.php
+
63
−
6
View file @
232150b1
...
...
@@ -18,6 +18,10 @@ class i18n_Compiler extends Module {
'sign'
=>
'Sign a language pack'
,
),
),
'file(s)'
=>
array
(
'required'
=>
false
,
'help'
=>
'File(s) to be signed, used with `sign`'
,
),
);
var
$options
=
array
(
...
...
@@ -35,8 +39,15 @@ class i18n_Compiler extends Module {
'domain'
=>
array
(
'-D'
,
'--domain'
,
'metavar'
=>
'name'
,
'default'
=>
''
,
'help'
=>
'Add a domain to the path/context of PO strings'
),
'dns'
=>
array
(
'-d'
,
'--dns'
,
'default'
=>
false
,
'metavar'
=>
'zone-id'
,
'help'
=>
'Write signature to DNS (via this AWS HostedZoneId)'
),
);
var
$epilog
=
"Note: If updating DNS, you will need to set
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in the AWS credentials
profile in your home folder or in your environment. See AWS
configuration docs for more information"
;
static
$project
=
'osticket-official'
;
static
$crowdin_api_url
=
'http://i18n.osticket.com/api/project/{project}/{command}'
;
...
...
@@ -96,9 +107,14 @@ class i18n_Compiler extends Module {
$this
->
_make_pot
(
$options
);
break
;
case
'sign'
:
if
(
!
$options
[
'file'
]
||
!
file_exists
(
$options
[
'file'
]))
$this
->
fail
(
'Specify a language pack to sign with --file='
);
$this
->
_sign
(
$options
[
'file'
],
$options
);
if
(
count
(
$args
)
<
2
)
$this
->
fail
(
'Specify a language pack to sign'
);
foreach
(
range
(
1
,
count
(
$args
)
-
1
,
1
)
as
$i
)
{
$plugin
=
$args
[
$i
];
if
(
!
is_file
(
$args
[
$i
]))
$this
->
fail
(
$args
[
$i
]
.
': No such file'
);
$this
->
_sign
(
$args
[
$i
],
$options
);
}
break
;
}
}
...
...
@@ -303,9 +319,50 @@ class i18n_Compiler extends Module {
$this
->
stdout
->
write
(
sprintf
(
"Signature: %s
\n
"
,
strtolower
(
$signature
[
'hash'
])));
$this
->
stdout
->
write
(
sprintf
(
"Seal:
\"
v=1; i=%s; s=%s; V=%s;
\"\n
"
,
$info
[
'Id'
],
base64_encode
(
$seal
),
$info
[
'Version'
]));
$seal
=
sprintf
(
'"v=1; i=%s; s=%s; V=%s;"'
,
$info
[
'Id'
],
base64_encode
(
$seal
),
$info
[
'Version'
]);
if
(
$options
[
'dns'
])
{
if
(
!
is_file
(
INCLUDE_DIR
.
'aws.phar'
))
$this
->
fail
(
'Unable to include AWS phar file. Download to INCLUDE_DIR'
);
require_once
INCLUDE_DIR
.
'aws.phar'
;
$aws
=
Aws\Common\Aws
::
factory
(
array
());
$client
=
$aws
->
get
(
'Route53'
);
try
{
$resp
=
$client
->
changeResourceRecordSets
(
array
(
'HostedZoneId'
=>
$options
[
'dns'
],
'ChangeBatch'
=>
array
(
'Changes'
=>
array
(
array
(
'Action'
=>
'CREATE'
,
'ResourceRecordSet'
=>
array
(
'Name'
=>
"
{
$signature
[
'hash'
]
}
.updates.osticket.com."
,
'Type'
=>
'TXT'
,
'TTL'
=>
172800
,
'ResourceRecords'
=>
array
(
array
(
'Value'
=>
$seal
,
),
),
),
),
),
),
));
$this
->
stdout
->
write
(
sprintf
(
'%s: %s'
,
$resp
[
'ChangeInfo'
][
'Comment'
],
$resp
[
'ChangeInfo'
][
'Status'
]));
}
catch
(
Exception
$ex
)
{
$this
->
stdout
->
write
(
"Seal:
$seal
\n
"
);
$this
->
fail
(
'!! AWS Update Failed: '
.
$ex
->
getMessage
());
}
}
else
{
$this
->
stdout
->
write
(
"Seal:
$seal
\n
"
);
}
}
function
__read_next_string
(
$tokens
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment