Mailing List Archive

Re: [8490] I wonder how long bric_media_upload has been failing?
On Wed, 11 Mar 2009, theory@bricolage.cc wrote:
> Revision: 8490
[...]
> --- bricolage/branches/rev_1_10/contrib/bric_media_upload/bric_media_upload 2009-03-11 18:55:37 UTC (rev 8489)
> +++ bricolage/branches/rev_1_10/contrib/bric_media_upload/bric_media_upload 2009-03-11 23:42:04 UTC (rev 8490)
> @@ -398,6 +398,7 @@
> <description></description>
> <uri>$media_uri</uri>
> <priority>3</priority>
> + <publish_status>0</publish_status>

This doesn't actually fix it, though,
because the media is possibly being updated
and has therefore possibly been published already.
My local fix (I thought I committed it before,
but I guess not) isn't really better but assumes
that on update that it's already been published:


# xxx: here I just declare that if we're updating
# then it's already been published before;
# I don't know how else to do it with our crappy soap interface
my $publish_crap = $operation eq 'create'
? ' <publish_status>0</publish_status>'
: <<EOPC;
<publish_status>1</publish_status>
<first_publish_date>$media_cover_date</first_publish_date>
<publish_date>$media_cover_date</publish_date>
EOPC

my $infoelements = ($media_info) ? get_media_info($media_file) : '';
# put vars into xml skeleton
my $media_xml = <<"EOS";
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assets xmlns="http://bricolage.sourceforge.net/assets.xsd">
<media id="$media_id" element="$media_type">
<site>$site</site>
<name>$media_name</name>
<description></description>
<uri>$media_uri</uri>
<priority>3</priority>
<active>1</active>
<source>$content_source</source>
<cover_date>$media_cover_date</cover_date>
$publish_crap

....

It'd probably be better for Bric::SOAP to ignore <publish_status>
(and first_publish_date and publish_date) on create/update.
Re: [8490] I wonder how long bric_media_upload has been failing? [ In reply to ]
On Mar 12, 2009, at 2:34 AM, Scott Lanning wrote:

> This doesn't actually fix it, though,
> because the media is possibly being updated
> and has therefore possibly been published already.
> My local fix (I thought I committed it before,
> but I guess not) isn't really better but assumes
> that on update that it's already been published:

Yeah, that should fix it, because Bric::SOAP actually ignores it if
the story exists and has been published:

if ($update) {
if ($media->get_publish_date or $media-
>get_first_publish_date) {
# some publish date is set, so it must've been
published
$media->set_publish_status(1);
} else {
$media->set_publish_status($mdata->{publish_status});
}
} else {
# creating, so can't have published it yet
$media->set_publish_status(0);
}

So please do feel free to commit your fix.

Best,

David