Mojito
view release on metacpan or search on metacpan
lib/Mojito.pm view on Meta::CPAN
return $response_href;
}
=head2 update_page
Update a page given: content, id and base_url
=cut
sub update_page {
my ( $self, $params ) = @_;
$self->parser->page($params->{content});
$self->parser->default_format($params->{wiki_language});
my $page = $self->page_structure;
# Store rendered parts as well. May as well until proven wrong.
$page->{page_html} = $self->render_page($page);
$page->{body_html} = $self->render_body($page);
$page->{title} = $self->intro_text( $page->{body_html} );
lib/Mojito/Collection/CRUD/Deep.pm view on Meta::CPAN
}
return;
}
=head2 update
Update a collection in the database.
=cut
sub update {
my ( $self, $params) = @_;
my $id = $params->{id};
$params->{last_modified} = time();
$self->collection->{$id} = $params;
}
=head2 delete
Delete a collection from the database.
lib/Mojito/Collection/CRUD/Elasticsearch.pm view on Meta::CPAN
);
return $doc;
}
=head2 update
Update a collection in the database.
=cut
sub update {
my ( $self, $id, $params) = @_;
$params->{last_modified} = time();
$self->db->update(
index => $self->db_name,
type => $self->collection_name,
id => $id,
body => { doc => $params },
);
}
lib/Mojito/Collection/CRUD/Elasticsearch.pm view on Meta::CPAN
my @collections = map { $_->{_source} } @{$self->get_all};
foreach my $collection (@collections) {
if ($page_id eq any(@{$collection->{collected_page_ids}})) {
push @collection_ids, $collection->{id};
}
}
return @collection_ids;
}
sub update_collection_membership {
my ($self, $params) = @_;
my $collection_ids = $params->{collection_select};
# Want to coerce (single select) SCALAR into an ArrayRef (happens w/ Dancer params)
if (ref($collection_ids) ne 'ARRAY') {
warn "Coercing collection select params into an ArrefRef" if $ENV{MOJITO_DEBUG};
$collection_ids = [$collection_ids];
}
my $scroll = $self->db->scroll_helper(
lib/Mojito/Collection/CRUD/Mongo.pm view on Meta::CPAN
my $oid = MongoDB::OID->new( value => $id );
return $self->collection->find_one( { _id => $oid } );
}
=head2 update
Update a collection in the database.
=cut
sub update {
my ( $self, $params) = @_;
my $oid = MongoDB::OID->new( value => $params->{id} );
$params->{last_modified} = time();
$self->collection->update( { '_id' => $oid }, $params );
}
=head2 delete
lib/Mojito/Collection/CRUD/Mongo.pm view on Meta::CPAN
while (my $doc = $collections->next) {
my @collected_pages = @{$doc->{collected_page_ids}};
if ($page_id eq any(@collected_pages)) {
push @collection_ids, $doc->{_id}->value ;
}
}
return @collection_ids;
}
sub update_collection_membership {
my ($self, $params) = @_;
my $collection_ids = $params->{collection_select};
# Want to coerce (single select) SCALAR into an ArrayRef (happens w/ Dancer params)
if (ref($collection_ids) ne 'ARRAY') {
warn "Coercing collection select params into an ArrefRef" if $ENV{MOJITO_DEBUG};
$collection_ids = [$collection_ids];
}
# Have we assigned the page to at least one collection?
if (defined $collection_ids->[0]) {
lib/Mojito/Page/CRUD/Deep.pm view on Meta::CPAN
}
return;
}
=head2 update
Update a page in the database.
=cut
sub update {
my ( $self, $id, $page_struct ) = @_;
$page_struct->{last_modified} = time();
# Add in id as a key/value
$page_struct->{id} = $id;
$self->collection->{$id} = $page_struct;
}
=head2 delete
Delete a page from the database.
lib/Mojito/Page/CRUD/Elasticsearch.pm view on Meta::CPAN
return $doc;
}
=head2 update
Update a page in the database.
=cut
sub update {
my ( $self, $id, $page_struct ) = @_;
$page_struct->{last_modified} = time();
# Add in id as a key/value
$page_struct->{id} = $id;
$self->db->update(
index => $self->db_name,
type => $self->collection_name,
id => $id,
body => { doc => $page_struct },
);
lib/Mojito/Page/CRUD/Mongo.pm view on Meta::CPAN
my $oid = MongoDB::OID->new( value => $id );
return $self->collection->find_one( { _id => $oid } );
}
=head2 update
Update a page in the database.
=cut
sub update {
my ( $self, $id, $page_struct ) = @_;
my $oid = MongoDB::OID->new( value => $id );
$page_struct->{last_modified} = time();
$self->collection->update( { '_id' => $oid }, $page_struct );
}
=head2 delete
Delete a page from the database.
( run in 0.649 second using v1.01-cache-2.11-cpan-95122f20152 )