From 6c7f7b625f3376b165e6091870ff2959e1f8e4e3 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Wed, 9 Mar 2011 18:47:33 -0600 Subject: [PATCH 01/10] fix guard usage --- lib/Lacuna/RPC/Building/Trade.pm | 2 +- lib/Lacuna/RPC/Building/Transporter.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Lacuna/RPC/Building/Trade.pm b/lib/Lacuna/RPC/Building/Trade.pm index 00d5bb62..5bb9aace 100644 --- a/lib/Lacuna/RPC/Building/Trade.pm +++ b/lib/Lacuna/RPC/Building/Trade.pm @@ -87,7 +87,7 @@ sub accept_from_market { confess [1013, 'Another buyer has placed an offer on this trade. Please wait a few moments and try again.']; } $cache->set('trade_lock',$trade_id,1,5); - my $guard = scope_guard { + my $guard = guard { $cache->delete('trade_lock',$trade_id); }; diff --git a/lib/Lacuna/RPC/Building/Transporter.pm b/lib/Lacuna/RPC/Building/Transporter.pm index 4afb5963..8966135f 100644 --- a/lib/Lacuna/RPC/Building/Transporter.pm +++ b/lib/Lacuna/RPC/Building/Transporter.pm @@ -102,7 +102,7 @@ sub accept_from_market { confess [1013, 'Another buyer has placed an offer on this trade. Please wait a few moments and try again.']; } $cache->set('trade_lock',$trade_id,1,5); - my $guard = scope_guard { + my $guard = guard { $cache->delete('trade_lock',$trade_id); }; -- 2.51.2 From 1253128df689019fded255bc08352076eaf39692 Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Wed, 9 Mar 2011 20:12:07 -0600 Subject: [PATCH 02/10] Add option to view_all_ships to return all results. --- docs/SpacePort.pod | 35 ++++++- lib/Lacuna/RPC/Building/SpacePort.pm | 147 ++++++++++++++++----------- 2 files changed, 115 insertions(+), 67 deletions(-) diff --git a/docs/SpacePort.pod b/docs/SpacePort.pod index aa876f8b..cf6e0e07 100644 --- a/docs/SpacePort.pod +++ b/docs/SpacePort.pod @@ -29,7 +29,7 @@ This method is extended to include a list of docked ships. } -=head2 view_all_ships ( session_id, building_id, [ page_number, items_per_page, filter, sort ] ) +=head2 view_all_ships ( session_id, building_id, [ paging, filter, sort ] ) Shows you all your ships whatever they are doing. @@ -100,17 +100,43 @@ A session id. The unique id of the space port. -=head3 page_number +=head3 paging + +Optional. A hash reference that contains the paging criteria. Valid paging option keys include page_number, items_per page and no_paging. + +=head4 page_number Optional. An integer representing the page of ships to return. Defaults to 1. -=head3 items_per_page +=head4 items_per_page Optional. An integer representing the number of items per page to return. Defaults to 25. +=head4 no_paging + +Optional. If set to 1, all other paging options are ignored and all results will be retured. + + { "no_paging" : 1 } + + { "page_number" : 2, "items_per_page" : 30 } + =head3 filter -Optional. A hash reference that contains the filter criteria. Valid filter option keys include task, type and tag. Valid tasks include Docked, Building, Mining, Travelling, and Defend. Valid types are the existing ship types. Valid tags include Trade, Colonization, Intelligence, Exploration, War, and Mining. The filter option values should be passed as an array reference or scalar. Tags will be converted to types prior to filtering. (This means that if tags and types are passed together, the types will be overwritten when the tags are converted.) +Optional. A hash reference that contains the filter criteria. Valid filter option keys include task, type and tag. + +=head4 task + +Optional. An array reference or string with the task(s) to filter on. Valid tasks include Docked, Building, Mining, Travelling, and Defend. + +=head4 type + +Optional. An array reference or string with the type(s) to filter on. Valid types are the existing ship types. + +=head4 tag + +Optional. An array reference or string with the tag(s) to filter on. Valid tags include Trade, Colonization, Intelligence, Exploration, War, and Mining. + +Note: Tags will be converted to types prior to filtering and any types that were passed will be replaced. { "task" : "Defend" } @@ -125,7 +151,6 @@ Optional. A hash reference that contains the filter criteria. Valid filter optio Optional. A string with the column to sort on. Defaults to 'type'. (A second sort column, 'name', is added to your chosen sort column.) Valid columns to sort on include: combat, name, speed, stealth, task, and type. - =head2 view_foreign_ships ( session_id, building_id, page_number ) Shows you all the foreign ships that are incoming. However, the list is filtered by the stealth of the ship vs the level of the SpacePort. The formula is: diff --git a/lib/Lacuna/RPC/Building/SpacePort.pm b/lib/Lacuna/RPC/Building/SpacePort.pm index ad9e92bf..cf4dce98 100644 --- a/lib/Lacuna/RPC/Building/SpacePort.pm +++ b/lib/Lacuna/RPC/Building/SpacePort.pm @@ -428,82 +428,104 @@ sub view_ships_travelling { }; } -sub view_all_ships { - my ($self, $session_id, $building_id, $page_number, $items_per_page, $filter, $sort) = @_; - if (defined $filter && ref $filter ne 'HASH') { - confess [-32602, 'The filter parameter should be a hash reference. For example { "task" : "Docked" }.']; +sub _ship_paging_options { + my ($self, $paging) = @_; + for my $key ( keys %{ $paging } ) { + # Throw away bad keys + unless ($key ~~ [qw(page_number items_per_page no_paging)]) { + delete $paging->{$key}; + next; + } } - my $empire = $self->get_empire_by_session($session_id); - my $building = $self->get_building($empire, $building_id); - $page_number ||= 1; - $items_per_page ||= 25; - $filter //= {}; - $sort //= 'type'; + if ($paging->{no_paging}) { + $paging = {}; + } + else { + $paging->{page_number} ||= 1; + $paging->{items_per_page} ||= 25; + } + return $paging; +} - if ($sort && $sort ~~ [qw(combat name speed stealth task type)]) { - if ( $sort ne 'name' ) { - $sort = [ $sort, 'name' ]; - } - else { - $sort = [ 'name' ]; +sub _ship_filter_options { + my ($self, $filter) = @_; + + # Valid filter options include... + my $options = { + task => [qw(Docked Building Mining Travelling Defend)], + tags => [qw(Trade Colonization Intelligence Exploration War Mining)], + type => [SHIP_TYPES], + }; + + # Pull in the list of ship types by tag + my %tag; + for my $type ( SHIP_TYPES ) { + my $ship = Lacuna->db->resultset('Lacuna::DB::Result::Ships')->new({ type => $type }); + for my $tag ( @{$ship->build_tags} ) { + push @{ $tag{$tag} }, $type; } } - if ($filter) { - # Valid filter options include... - my $options = { - task => [qw(Docked Building Mining Travelling Defend)], - tags => [qw(Trade Colonization Intelligence Exploration War Mining)], - type => [SHIP_TYPES], - }; - - # Pull in the list of ship types by tag - my %tag; - foreach my $type (SHIP_TYPES) { - my $ship = Lacuna->db->resultset('Lacuna::DB::Result::Ships')->new({type=>$type}); - my @tags = @{$ship->build_tags}; - for my $tag ( @tags ) { - push @{$tag{$tag}}, $type; - } + for my $key ( keys %{ $filter } ) { + # Throw away bad keys + unless ( $key ~~ [keys %$options] ) { + delete $filter->{$key}; + next; } - for my $key ( keys %{$filter} ) { - # Throw away bad keys - unless ($key ~~ [keys %$options]) { - delete $filter->{$key}; - next; - } + # Throw away bad values + my $value = $filter->{$key}; + if ( ref($value) eq 'ARRAY' ) { + @$value = grep { $_ ~~ $options->{$key} } @$value; + } + elsif ( ! ref($value) ) { + delete $filter->{$key} unless ( $value ~~ $options->{$key} ); + } + else { + delete $filter->{$key}; + } - # Throw away bad values - my $value = $filter->{$key}; - if (ref($value) eq 'ARRAY') { - @$value = grep { $_ ~~ $options->{$key} } @$value; - } - elsif (! ref($value)) { - delete $filter->{$key} unless ($value ~~ $options->{$key}); + # Convert tags to types (destructive) + if ( $key eq 'tags' ) { + if ( ref($value) eq 'ARRAY' ) { + my @types; + for my $tag ( @$value ) { + push @types, @{ $tag{$tag} }; + } + my %uniq = map { $_ => 1 } @types; + $filter->{type} = [ sort keys %uniq ]; } else { - delete $filter->{$key}; - } - - # Convert tags to types (destructive) - if ($key eq 'tags') { - if (ref($value) eq 'ARRAY') { - my @types; - for my $tag ( @$value ) { - push @types, @{$tag{$tag}}; - } - my %types = map { $_ => 1 } @types; - $filter->{type} = [ sort keys %types ]; - } - else { - $filter->{type} = $tag{$value}; - } - delete $filter->{tags}; + $filter->{type} = $tag{$value}; } + delete $filter->{tags}; } } + return $filter; +} + +sub _ship_sort_options { + my ($self, $sort) = @_; + + # return the default if it's not one of the following or is 'name' + if ( ! $sort || $sort eq 'name' || ! $sort ~~ [qw(combat speed stealth task type)] ) { + return [ 'name' ]; + } + + # append name to the sort options + return [ $sort, 'name' ]; +} + +sub view_all_ships { + my ($self, $session_id, $building_id, $paging, $filter, $sort) = @_; + + $paging = $self->_ship_paging_options( $paging // {} ); + $filter = $self->_ship_filter_options( $filter // {} ); + $sort = $self->_ship_sort_options( $sort // 'type' ); + + my $empire = $self->get_empire_by_session($session_id); + my $building = $self->get_building($empire, $building_id); my $body = $building->body; my @fleet; my $ships = $building->ships->search( $filter, { rows => $items_per_page, order_by => $sort, page => $page_number } ); @@ -511,6 +533,7 @@ sub view_all_ships { $ship->body($body); push @fleet, $ship->get_status; } + return { status => $self->format_status($empire, $body), number_of_ships => $ships->pager->total_entries, -- 2.51.2 From 856c2cbd600eb2f856acbb1f25c9c797064e6fa6 Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Wed, 9 Mar 2011 20:32:01 -0600 Subject: [PATCH 03/10] Actually use the new paging options. --- lib/Lacuna/RPC/Building/SpacePort.pm | 8 +++++++- t/SpacePort.t | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Lacuna/RPC/Building/SpacePort.pm b/lib/Lacuna/RPC/Building/SpacePort.pm index cf4dce98..2f1da805 100644 --- a/lib/Lacuna/RPC/Building/SpacePort.pm +++ b/lib/Lacuna/RPC/Building/SpacePort.pm @@ -524,11 +524,17 @@ sub view_all_ships { $filter = $self->_ship_filter_options( $filter // {} ); $sort = $self->_ship_sort_options( $sort // 'type' ); + my $attrs = { + sort_by => $sort + }; + $attrs->{rows} = $paging->{items_per_page} if ( defined $paging->{items_per_page} ); + $attrs->{page} = $paging->{page_number} if ( defined $paging->{page_number} ); + my $empire = $self->get_empire_by_session($session_id); my $building = $self->get_building($empire, $building_id); my $body = $building->body; my @fleet; - my $ships = $building->ships->search( $filter, { rows => $items_per_page, order_by => $sort, page => $page_number } ); + my $ships = $building->ships->search( $filter, $attrs ); while (my $ship = $ships->next) { $ship->body($body); push @fleet, $ship->get_status; diff --git a/t/SpacePort.t b/t/SpacePort.t index 6f50b63f..8d9e3fda 100644 --- a/t/SpacePort.t +++ b/t/SpacePort.t @@ -122,7 +122,7 @@ $result = $tester->post('spaceport', 'send_ship', [$session_id, $sweeper->id, { ok($result->{result}{ship}{date_arrives}, "sweeper sent"); $result = $tester->post('spaceport', 'view_all_ships', - [$session_id, $spaceport->id, undef, undef, { task => "Docked", tags => [qw(Trade Mining)]}, 'combat'] + [$session_id, $spaceport->id, undef, { task => "Docked", tags => [qw(Trade Mining)]}, 'combat'] ); is(ref $result->{result}{ships}, 'ARRAY', "can see all my ships"); -- 2.51.2 From 3f8eb53fe9530ee0486e2ed79996e1dae627c31a Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Wed, 9 Mar 2011 20:33:54 -0600 Subject: [PATCH 04/10] Add SAW medal back. --- lib/Lacuna/DB/Result/Medals.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Lacuna/DB/Result/Medals.pm b/lib/Lacuna/DB/Result/Medals.pm index 9ef50e89..ee1f13eb 100644 --- a/lib/Lacuna/DB/Result/Medals.pm +++ b/lib/Lacuna/DB/Result/Medals.pm @@ -182,6 +182,7 @@ use constant MEDALS => { building28 => 'Built Level 28 Building', building29 => 'Built Level 29 Building', building30 => 'Built Level 30 Building', + SAW => 'Built Shield Against Weapons', IBS => 'Built Interstellar Broadcast System', StationCommand => 'Built Station Command Center', Parliament => 'Built Parliament', -- 2.51.2 From f5c43b4e4ca358ddc4a83c0e978759ea09e9c429 Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Wed, 9 Mar 2011 21:18:43 -0600 Subject: [PATCH 05/10] Fix pager --- lib/Lacuna/RPC/Building/SpacePort.pm | 2 +- t/SpacePort.t | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Lacuna/RPC/Building/SpacePort.pm b/lib/Lacuna/RPC/Building/SpacePort.pm index 2f1da805..74c1e034 100644 --- a/lib/Lacuna/RPC/Building/SpacePort.pm +++ b/lib/Lacuna/RPC/Building/SpacePort.pm @@ -542,7 +542,7 @@ sub view_all_ships { return { status => $self->format_status($empire, $body), - number_of_ships => $ships->pager->total_entries, + number_of_ships => defined $paging->{page_number} ? $ships->pager->total_entries : $ships->count, ships => \@fleet, }; } diff --git a/t/SpacePort.t b/t/SpacePort.t index 8d9e3fda..93519bd6 100644 --- a/t/SpacePort.t +++ b/t/SpacePort.t @@ -126,6 +126,11 @@ $result = $tester->post('spaceport', 'view_all_ships', ); is(ref $result->{result}{ships}, 'ARRAY', "can see all my ships"); +$result = $tester->post('spaceport', 'view_all_ships', + [$session_id, $spaceport->id, { no_paging => 1}, { task => "Docked", tags => [qw(Trade Mining)]}, 'combat'] +); +is(ref $result->{result}{ships}, 'ARRAY', "can see all my ships"); + END { $enemy->cleanup; $tester->cleanup; -- 2.51.2 From 230612f959f88ebc81dc4192da91d04cc0bede2f Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Wed, 9 Mar 2011 21:26:42 -0600 Subject: [PATCH 06/10] Change 'tags' to 'tag'. --- lib/Lacuna/RPC/Building/SpacePort.pm | 10 +++++----- t/SpacePort.t | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Lacuna/RPC/Building/SpacePort.pm b/lib/Lacuna/RPC/Building/SpacePort.pm index 74c1e034..2b883346 100644 --- a/lib/Lacuna/RPC/Building/SpacePort.pm +++ b/lib/Lacuna/RPC/Building/SpacePort.pm @@ -452,9 +452,9 @@ sub _ship_filter_options { # Valid filter options include... my $options = { - task => [qw(Docked Building Mining Travelling Defend)], - tags => [qw(Trade Colonization Intelligence Exploration War Mining)], - type => [SHIP_TYPES], + task => [qw(Docked Building Mining Travelling Defend)], + tag => [qw(Trade Colonization Intelligence Exploration War Mining)], + type => [SHIP_TYPES], }; # Pull in the list of ship types by tag @@ -486,7 +486,7 @@ sub _ship_filter_options { } # Convert tags to types (destructive) - if ( $key eq 'tags' ) { + if ( $key eq 'tag' ) { if ( ref($value) eq 'ARRAY' ) { my @types; for my $tag ( @$value ) { @@ -498,7 +498,7 @@ sub _ship_filter_options { else { $filter->{type} = $tag{$value}; } - delete $filter->{tags}; + delete $filter->{tag}; } } diff --git a/t/SpacePort.t b/t/SpacePort.t index 93519bd6..cb558c0d 100644 --- a/t/SpacePort.t +++ b/t/SpacePort.t @@ -122,12 +122,12 @@ $result = $tester->post('spaceport', 'send_ship', [$session_id, $sweeper->id, { ok($result->{result}{ship}{date_arrives}, "sweeper sent"); $result = $tester->post('spaceport', 'view_all_ships', - [$session_id, $spaceport->id, undef, { task => "Docked", tags => [qw(Trade Mining)]}, 'combat'] + [$session_id, $spaceport->id, undef, { task => "Docked", tag => [qw(Trade Mining)]}, 'combat'] ); is(ref $result->{result}{ships}, 'ARRAY', "can see all my ships"); $result = $tester->post('spaceport', 'view_all_ships', - [$session_id, $spaceport->id, { no_paging => 1}, { task => "Docked", tags => [qw(Trade Mining)]}, 'combat'] + [$session_id, $spaceport->id, { no_paging => 1}, { task => "Docked", tag => [qw(Trade Mining)]}, 'combat'] ); is(ref $result->{result}{ships}, 'ARRAY', "can see all my ships"); -- 2.51.2 From 0f257a4f89203023903d3d105273c1a99c766660 Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Wed, 9 Mar 2011 22:13:23 -0600 Subject: [PATCH 07/10] Rule: Archived messages will be purged thirty days after they were sent. --- bin/clean_up_mail.pl | 49 ++++++++++++++++++++++++++++++++++++++ bin/run_hourly.sh | 1 + var/www/public/changes.txt | 1 + 3 files changed, 51 insertions(+) create mode 100644 bin/clean_up_mail.pl diff --git a/bin/clean_up_mail.pl b/bin/clean_up_mail.pl new file mode 100644 index 00000000..6614b879 --- /dev/null +++ b/bin/clean_up_mail.pl @@ -0,0 +1,49 @@ +use 5.010; +use strict; +use feature "switch"; +use lib '/data/Lacuna-Server/lib'; +use Lacuna::DB; +use Lacuna; +use List::Util qw(shuffle); +use Lacuna::Util qw(randint format_date); +use Getopt::Long; +$|=1; +our $quiet; +GetOptions( + 'quiet' => \$quiet, +); + + +out('Started'); +my $start = time; +my $date_ended = DateTime->now->subtract( days => 30); + +out('Loading DB'); +our $db = Lacuna->db; + +out('Deleting Outdated Mail Items'); +my $mail = $db->resultset('Lacuna::DB::Result::Message'); +my @to_be_deleted = $mail->search({ has_archived => 1, date_sent => { '<' => $date_ended }})->get_column('id')->all; +foreach my $id (@to_be_deleted) { + out('Deleting '.$id); + my $message = $mail->find($id); + $message->delete; +} + +my $finish = time; +out('Finished'); +out((($finish - $start)/60)." minutes have elapsed"); + + +############### +## SUBROUTINES +############### + +sub out { + my $message = shift; + unless ($quiet) { + say format_date(DateTime->now), " ", $message; + } +} + + diff --git a/bin/run_hourly.sh b/bin/run_hourly.sh index af28a5ac..6fd74edb 100755 --- a/bin/run_hourly.sh +++ b/bin/run_hourly.sh @@ -13,3 +13,4 @@ perl trelvestian/hourly_update.pl perl trelvestian/send_attack.pl& perl diablotin/hourly_update.pl perl saben/hourly_update.pl +perl clean_up_mail.pl diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 3e5ada0f..d6666411 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -2,6 +2,7 @@ - Rule: Added Space Station Lab building, which will eventually allow building space station modules. - Rule: Allow building space station hulls. - Rule: Added Station Command Center, Parliament, Warehouse, and IBS modules for space stations. + - Rule: Archived messages will be purged thirty days after they were sent. - API: Sending ships that trigger defenses requires the new captchas. - API: Sending spies requires the new captchas. - API: Running spy missions require the new captchas. -- 2.51.2 From a17ba719175030c8e231cd2689f911400c501fcc Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Wed, 9 Mar 2011 22:51:05 -0600 Subject: [PATCH 08/10] Delete all AI mail --- bin/clean_up_mail.pl | 12 +++++------- bin/run_hourly.sh | 1 - bin/run_weekly.sh | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/bin/clean_up_mail.pl b/bin/clean_up_mail.pl index 6614b879..81d0b68f 100644 --- a/bin/clean_up_mail.pl +++ b/bin/clean_up_mail.pl @@ -21,14 +21,12 @@ my $date_ended = DateTime->now->subtract( days => 30); out('Loading DB'); our $db = Lacuna->db; -out('Deleting Outdated Mail Items'); +out('Deleting AI Mail Items'); my $mail = $db->resultset('Lacuna::DB::Result::Message'); -my @to_be_deleted = $mail->search({ has_archived => 1, date_sent => { '<' => $date_ended }})->get_column('id')->all; -foreach my $id (@to_be_deleted) { - out('Deleting '.$id); - my $message = $mail->find($id); - $message->delete; -} +$mail->search({ to_id => { '<' => 0 }})->get_column('id')->delete_all; + +out('Deleting Outdated Player Mail Items'); +$mail->search({ has_archived => 1, date_sent => { '<' => $date_ended }})->get_column('id')->delete_all; my $finish = time; out('Finished'); diff --git a/bin/run_hourly.sh b/bin/run_hourly.sh index 6fd74edb..af28a5ac 100755 --- a/bin/run_hourly.sh +++ b/bin/run_hourly.sh @@ -13,4 +13,3 @@ perl trelvestian/hourly_update.pl perl trelvestian/send_attack.pl& perl diablotin/hourly_update.pl perl saben/hourly_update.pl -perl clean_up_mail.pl diff --git a/bin/run_weekly.sh b/bin/run_weekly.sh index 175cabd4..b815bb68 100644 --- a/bin/run_weekly.sh +++ b/bin/run_weekly.sh @@ -3,4 +3,4 @@ export PATH=/data/apps/bin:$PATH cd /data/Lacuna-Server/bin perl weekly_medals.pl perl trelvestian/reset_essentia_veins.pl - +perl clean_up_mail.pl -- 2.51.2 From 6f543bcc7dd999908201a501510f554d6916b34d Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Wed, 9 Mar 2011 22:54:48 -0600 Subject: [PATCH 09/10] Fix silly mistake --- bin/clean_up_mail.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/clean_up_mail.pl b/bin/clean_up_mail.pl index 81d0b68f..df5c14f6 100644 --- a/bin/clean_up_mail.pl +++ b/bin/clean_up_mail.pl @@ -23,10 +23,10 @@ our $db = Lacuna->db; out('Deleting AI Mail Items'); my $mail = $db->resultset('Lacuna::DB::Result::Message'); -$mail->search({ to_id => { '<' => 0 }})->get_column('id')->delete_all; +$mail->search({ to_id => { '<' => 0 }})->delete_all; out('Deleting Outdated Player Mail Items'); -$mail->search({ has_archived => 1, date_sent => { '<' => $date_ended }})->get_column('id')->delete_all; +$mail->search({ has_archived => 1, date_sent => { '<' => $date_ended }})->delete_all; my $finish = time; out('Finished'); -- 2.51.2 From c6c22b4701c3f2bd487f3e9418288f39f9b2910f Mon Sep 17 00:00:00 2001 From: Matthew Musgrove Date: Wed, 9 Mar 2011 22:56:34 -0600 Subject: [PATCH 10/10] Fix AI id --- bin/clean_up_mail.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/clean_up_mail.pl b/bin/clean_up_mail.pl index df5c14f6..ddeef50a 100644 --- a/bin/clean_up_mail.pl +++ b/bin/clean_up_mail.pl @@ -23,7 +23,7 @@ our $db = Lacuna->db; out('Deleting AI Mail Items'); my $mail = $db->resultset('Lacuna::DB::Result::Message'); -$mail->search({ to_id => { '<' => 0 }})->delete_all; +$mail->search({ to_id => { '<=' => 1 }})->delete_all; out('Deleting Outdated Player Mail Items'); $mail->search({ has_archived => 1, date_sent => { '<' => $date_ended }})->delete_all; -- 2.51.2