Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Bricolage: users

set_expire_date

 

 

Bricolage users RSS feed   Index | Next | Previous | View Threaded


michael.fletcher at cbs

Aug 6, 2009, 2:47 PM

Post #1 of 4 (1244 views)
Permalink
set_expire_date

Hello,

I'm attempting to use $burner->publish_another($story) to either expire storyA or set storyA's expiration in the future when I publish storyB. So the template that uses storyB does this:

if($burner->get_mode == PUBLISH_MODE) {
if (storyB->get_data("expireA")) {
my $storyA = $story->lookup( { id=>"12345" } );
$storyA = $storyA->set_expire_date("1999-12-31 23:59:00");
$burner->publish_another($storyA);
} else {
my $storyA = $story->lookup( { id=>"12345" } );
$storyA = $storyA->set_expire_date("2025-12-31 23:59:00");
$burner->publish_another($storyA);
}
}

Note: storyA and storyB use different templates, so this code is only executed when we publish storyB.

Problem 1:
When the "if" is TRUE, I can see in the Jobs queue that there is a job running to expire storyA. But when I look at storyA's expiration date, it doesn't change to the new value ("1999-12-31 23:59:00").

Problem 2:
When the "if" is FALSE, the publish of storyA creates to Distribute jobs related to storyA:
1. The first one is to distribute the new version.
2. The second one says, "Expire stale version".
Then storyA never shows up on my site - it seems like the expire is happening after the publish and so the story is effectively expired right after it publishes.

Problem 2 is my main problem, but problem 1 is more of a curiosity to me.

Insights into this are very much appreciated.

Thank you,
Mike


david at kineticode

Aug 6, 2009, 8:02 PM

Post #2 of 4 (1151 views)
Permalink
Re: set_expire_date [In reply to]

On Aug 6, 2009, at 2:47 PM, Fletcher, Michael wrote:

> Problem 1:
> When the "if" is TRUE, I can see in the Jobs queue that there is a
> job running to expire storyA. But when I look at storyA's
> expiration date, it doesn't change to the new value ("1999-12-31
> 23:59:00").

You need to save it, first. Try

$storyA->set_expire_date("1999-12-31 23:59:00")->save;

> Problem 2:
> When the "if" is FALSE, the publish of storyA creates to Distribute
> jobs related to storyA:
> 1. The first one is to distribute the new version.
> 2. The second one says, "Expire stale version".
> Then storyA never shows up on my site - it seems like the expire is
> happening after the publish and so the story is effectively expired
> right after it publishes.

Again, you need to save the story, first. What version of Bricolage is
this?

> Problem 2 is my main problem, but problem 1 is more of a curiosity
> to me.
>
> Insights into this are very much appreciated.

HTH,

David


michael.fletcher at cbs

Aug 7, 2009, 10:04 AM

Post #3 of 4 (1164 views)
Permalink
RE: set_expire_date [In reply to]

On Thu 8/6/2009 at 8:03PM David E. Wheeler wrote:

> You need to save it, first. Try
> $storyA->set_expire_date("1999-12-31 23:59:00")->save;

That definitely seems like a logical solution and a necessary step to add the ->save, but the effect is the same. The expire stale action is happening to storyA after the distribute of the new version. So the end result is an expired story regardless of the date I'm setting.

Problem 3:
I'm also noticing that $burner->publish_another($storyA) seems to do the publish before $storyB's changes are saved, because $storyA is using old values from $storyB. Yes - $storyA uses values from $storyB.

So far, my only solution seems to be to have the users manually publish $storyA each time they create a new or change an existing storyB. I was hoping to use publish_another to eliminate that step for them.

I'm on Bric 1.10.2
We are planning an upgrade to 1.11.1 this year if 2.0 doesn't come out first.

Thanks,
Mike


david at kineticode

Aug 9, 2009, 9:50 PM

Post #4 of 4 (1164 views)
Permalink
Re: set_expire_date [In reply to]

On Aug 7, 2009, at 10:04 AM, Fletcher, Michael wrote:

> On Thu 8/6/2009 at 8:03PM David E. Wheeler wrote:
>
>> You need to save it, first. Try
>> $storyA->set_expire_date("1999-12-31 23:59:00")->save;
>
> That definitely seems like a logical solution and a necessary step
> to add the ->save, but the effect is the same. The expire stale
> action is happening to storyA after the distribute of the new
> version. So the end result is an expired story regardless of the
> date I'm setting.

Sorry, isn't that what you want? I must've missed something.

> Problem 3:
> I'm also noticing that $burner->publish_another($storyA) seems to do
> the publish before $storyB's changes are saved, because $storyA is
> using old values from $storyB. Yes - $storyA uses values from
> $storyB.

$storyB is probably cached.

> So far, my only solution seems to be to have the users manually
> publish $storyA each time they create a new or change an existing
> storyB. I was hoping to use publish_another to eliminate that step
> for them.

You can do that regardless of the expiring business; we do it all the
time for our clients.

> I'm on Bric 1.10.2
> We are planning an upgrade to 1.11.1 this year if 2.0 doesn't come
> out first.

2.0 will be out this year, I promise.

David

Bricolage users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.