Skip to content

Commit

Permalink
Don't deactivate assets while updating via SOAP.
Browse files Browse the repository at this point in the history
I've no idea why they were able temporarily disabled to begin with. Seemed an
unnecessary defense against something or other. And the downside was
discovered with the addition of the `EXPIRE_ON_DEACTIVATE` directive:
assets were getting expired every time they were updated via SOAP! So
change the code to only activate or deactivate if requested.
  • Loading branch information
theory committed Jul 7, 2010
1 parent 256e550 commit 317a77e
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 15 deletions.
1 change: 1 addition & 0 deletions comp/widgets/help/debuggers.html
Expand Up @@ -93,4 +93,5 @@
<li>Zdravko Balorda</li>
<li>Vincent Stemen</li>
<li>Héctor Daniel Cortés González</li>
<li>Nick Legg</li>
</ul>
8 changes: 8 additions & 0 deletions lib/Bric/Changes.pod
Expand Up @@ -59,6 +59,14 @@ permission to edit an asset [Kahil Jallad].
Fixed a bug where the SFTP mover would not properly finish moving the file,
leaving escaped tmp files on the destination server. [Matt Rolf]

=item *

Updating published stories or media or deployed templates via the SOAP
interface with the C<EXPIRE_ON_DEACTIVATE> F<bricolage.conf> directive enabled
no longer expires those assets unless they are active and the
C<< <expire_date> >> element is set in the XML. Thanks to Nick Legg for the
report (Bug # 184). [David]

=back

=head1 Version 2.0.0 (2010-04-12)
Expand Down
2 changes: 2 additions & 0 deletions lib/Bric/License.pod
Expand Up @@ -492,6 +492,8 @@ Friends who have spotted bugs include:

=item * Héctor Daniel Cortés González

=item * Nick Legg

=back

Bricolage's translation team:
Expand Down
16 changes: 10 additions & 6 deletions lib/Bric/SOAP/Media.pm
Expand Up @@ -888,10 +888,8 @@ sub load_asset {
}
}

# save the media in an inactive state. this is necessary to
# allow element addition - you can't add elements to an
# unsaved media, strangely.
$media->deactivate;
# save the media. this is necessary to allow element addition - you
# can't add elements to an unsaved media, strangely.
$media->save;

# Manage the output channels if any are included in the XML file.
Expand Down Expand Up @@ -967,8 +965,14 @@ sub load_asset {
data => $mdata->{elements} || {}
) unless $aliased;

# activate if desired
$media->activate if $mdata->{active};
# Activate or deactivate if desired.
if (defined $mdata->{active}) {
if ($mdata->{active}) {
$media->activate unless $media->is_active;
} else {
$media->deactivate if $media->is_active;
}
}

# checkin and save
$media->checkin;
Expand Down
16 changes: 10 additions & 6 deletions lib/Bric/SOAP/Story.pm
Expand Up @@ -1021,10 +1021,8 @@ sub load_asset {
}
}

# save the story in an inactive state. this is necessary to
# allow element addition - you can't add elements to an
# unsaved story, strangely.
$story->deactivate;
# save the story. this is necessary to allow element addition - you
# can't add elements to an unsaved story, strangely.
$story->save;

# Manage the output channels if any are included in the XML file.
Expand Down Expand Up @@ -1100,8 +1098,14 @@ sub load_asset {
data => $sdata->{elements} || {})
unless $aliased;

# activate if desired
$story->activate if $sdata->{active};
# Activate or deactivate if desired.
if (defined $sdata->{active}) {
if ($sdata->{active}) {
$story->activate unless $story->is_active;
} else {
$story->deactivate if $story->is_active;
}
}

# checkin and save
$story->checkin;
Expand Down
11 changes: 8 additions & 3 deletions lib/Bric/SOAP/Template.pm
Expand Up @@ -745,7 +745,6 @@ sub load_asset {
}

# need a save here to get the desk stuff working
$template->deactivate;
$template->save;

unless ($update && $no_wf_or_desk_param) {
Expand All @@ -766,8 +765,14 @@ sub load_asset {
log_event('template_moved', $template, { Desk => $desk->get_name });
}

# activate if desired
$template->activate if $tdata->{active};
# Activate or deactivate if desired.
if (defined $data->{active}) {
if ($data->{active}) {
$template->activate unless $template->is_active;
} else {
$template->deactivate if $template->is_active;
}
}

# checkin and save
$template->checkin();
Expand Down

0 comments on commit 317a77e

Please sign in to comment.