-
Notifications
You must be signed in to change notification settings - Fork 51
Recipes: bric_soap
In addition to the excellent documentation found in Bricolage itself, and available online here, these recipes document some common site administration needs that can be achieved with bric_soap.
Basically, you need to:
- define your search criteria from the available methods of list_ids on the object your working with, e.g. Stories or Media, etc.
- use workflow checkout to move those assets to your desk
- use workflow move to check them into the target desk
*Here’s an example for moving unpublished, unexpired, and not checked out stories between a certain date range that are on a certain desk (defined by desk_id) to the Publish desk. (Currently untested. Will test shortly.)
./bric_soap --username=yourusername --password=yourpassword --server=yoursever story
list_ids --search publish_status=0 --search unexpired=1 --search checked_out=0 --search
cover_date_start=2008-01-01T00:00:00Z1 --search cover_date_end=2008-12-01T00:00:00Z
--search desk_id=yourdeskID | sort -k2 -t_ -n | ./bric_soap -username=yourusername
--password=yourpassword --server=yoursever workflow checkout | ./bric_soap
-username=yourusername --password=yourpassword --server=yoursever worflow move --desk Publish -
You can use the —continue-on-errors option to bypass errors.
— Bric.PhillipSmith – 22 Jan 2008
Republish all “cover” element types
./bric_soap --username=username --password=pass --server=server
story list_ids --search element="cover" --search unexpired=1
--search checked_out=0 | sort -k2 -t_ -n |
./bric_soap --username=username --password=pass --server=server
workflow publish --timeout 300 --chunks 5 --continue-on-errors -
— Bric.PhillipSmith – 10 Feb 2008
This is a scripty way to bulk publish everything (even remotely, you don’t have have a terminal open on the bric server). Just put this in an example in an executable file somewhere. It’s still pretty rough; please expand on it.
#!/usr/bin/perl
use SOAP::Lite;
use HTTP::Cookies;
import SOAP::Data 'name';
# setup soap object to login with
my $soap = new SOAP::Lite
uri => 'http://bricolage.sourceforge.net/Bric/SOAP/Auth',
readable => DEBUG;
$soap->proxy('http://PATH_TO_BRIC_SERVER/soap', cookie_jar => HTTP::Cookies->new(ignore_discard => 1));
$soap->login(name(username => 'EXAMPLE'), name(password => 'EXAMPLE'));
$soap->uri('http://bricolage.sourceforge.net/Bric/SOAP/Story');
my $story_ids = $soap->list_ids(name(publish_status => 1) )->result;
$soap->uri('http://bricolage.sourceforge.net/Bric/SOAP/Media');
my $media_ids = $soap->list_ids(name(publish_status => 1) )->result;
$soap->uri('http://bricolage.sourceforge.net/Bric/SOAP/Workflow');
#Publish one at a time, so we can get print out some simple status text.
for my $sid (@$story_ids) {
print("Publishing Story $sid \n");
$soap->publish(name(story_id => $sid));
}
for my $mid (@$media_ids) {
print("Publishing Media $mid \n");
$soap->publish(name(media_id => $mid));
}
It would be close to trivial to add command line options. Like —element=foo or —slug=‘bar%’.
— Bric.JasonBrackins – 01 May 2008