Skip to content

Commit

Permalink
Fixes for publication
Browse files Browse the repository at this point in the history
  • Loading branch information
oliwel committed Jan 28, 2015
1 parent 7408f7c commit 837adc5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ action:
label: I18N_OPENXPKI_UI_WORKFLOW_ACTION_CREATE_CA_LIST_LABEL
description: I18N_OPENXPKI_UI_WORKFLOW_ACTION_CREATE_CA_LIST_DESC
param:
group: ca-one-signer
token: certsign

publish_cacert:
class: OpenXPKI::Server::Workflow::Activity::Tools::PublishCA
Expand Down
39 changes: 25 additions & 14 deletions core/server/OpenXPKI/Server/Workflow/Activity/Tools/PublishCRL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ sub execute {
my $config = CTX('config');
my $pki_realm = CTX('session')->get_pki_realm();

my $dbi = CTX('dbi_backend');

if (!$self->param('prefix')) {
OpenXPKI::Exception->throw(
message => 'I18N_OPENXPI_WORKFLOW_ACTIVITY_TOOLS_PUBLISH_CRL_NO_PREFIX'
Expand Down Expand Up @@ -61,7 +63,7 @@ sub execute {
if ($crl_serial eq 'latest') {

# Load the crl data
$crl = CTX('dbi_backend')->first(
$crl = $dbi->first(
TABLE => 'CRL',
DYNAMIC => {
PKI_REALM => $pki_realm,
Expand All @@ -70,10 +72,13 @@ sub execute {
ORDER => [ 'LAST_UPDATE' ],
REVERSE => 1
);

$crl_serial = $crl->{CRL_SERIAL};

} else {

# Load the crl data
$crl = CTX('dbi_backend')->first(
$crl = $dbi->first(
TABLE => 'CRL',
KEY => $crl_serial
);
Expand Down Expand Up @@ -156,18 +161,24 @@ sub execute {
);
}

# Set the publication date in the database
my $dbi = CTX('dbi_backend');
$dbi->update(
TABLE => 'CRL',
DATA => {
'PUBLICATION_DATE' => DateTime->now()->epoch(),
},
WHERE => {
'CRL_SERIAL' => $crl_serial,
},
);
$dbi->commit();
# Set the publication date in the database, only if not set already
if (!$crl->{PUBLICATION_DATE}) {
$dbi->update(
TABLE => 'CRL',
DATA => {
'PUBLICATION_DATE' => DateTime->now()->epoch(),
},
WHERE => {
'CRL_SERIAL' => $crl_serial,
},
);
$dbi->commit();
CTX('log')->log(
MESSAGE => "CRL pubication date set for crl $crl_serial",
PRIORITY => 'info',
FACILITY => [ 'system' ],
);
}

##! 4: 'end'
return;
Expand Down

0 comments on commit 837adc5

Please sign in to comment.