diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/export-norwegian-contacts | 10 | ||||
-rwxr-xr-x | bin/import-categories | 10 | ||||
-rwxr-xr-x | bin/load-contacts | 10 | ||||
-rwxr-xr-x | bin/load-norwegian-contacts | 10 | ||||
-rwxr-xr-x | bin/populate_bing_cache | 58 | ||||
-rwxr-xr-x | bin/problem-creation-graph | 4 | ||||
-rwxr-xr-x | bin/problems-filed-graph | 4 | ||||
-rwxr-xr-x | bin/rotate-photos | 10 | ||||
-rwxr-xr-x | bin/send-reports | 6 | ||||
-rwxr-xr-x | bin/showcouncilrates | 10 | ||||
-rwxr-xr-x | bin/test-mailin | 2 | ||||
-rwxr-xr-x | bin/test-run | 4 | ||||
-rwxr-xr-x | bin/update-areas | 10 |
13 files changed, 105 insertions, 43 deletions
diff --git a/bin/export-norwegian-contacts b/bin/export-norwegian-contacts index 8a7d438e5..0209c6512 100644 --- a/bin/export-norwegian-contacts +++ b/bin/export-norwegian-contacts @@ -31,11 +31,11 @@ use mySociety::MaPit; BEGIN { mySociety::Config::set_file("$FindBin::Bin/../conf/general"); mySociety::DBHandle::configure( - Name => mySociety::Config::get('BCI_DB_NAME'), - User => mySociety::Config::get('BCI_DB_USER'), - Password => mySociety::Config::get('BCI_DB_PASS'), - Host => mySociety::Config::get('BCI_DB_HOST', undef), - Port => mySociety::Config::get('BCI_DB_PORT', undef) + Name => mySociety::Config::get('FMS_DB_NAME'), + User => mySociety::Config::get('FMS_DB_USER'), + Password => mySociety::Config::get('FMS_DB_PASS'), + Host => mySociety::Config::get('FMS_DB_HOST', undef), + Port => mySociety::Config::get('FMS_DB_PORT', undef) ); } diff --git a/bin/import-categories b/bin/import-categories index add12d3d0..e9008b93f 100755 --- a/bin/import-categories +++ b/bin/import-categories @@ -24,11 +24,11 @@ use mySociety::VotingArea; BEGIN { mySociety::Config::set_file("$FindBin::Bin/../conf/general"); mySociety::DBHandle::configure( - Name => mySociety::Config::get('BCI_DB_NAME'), - User => mySociety::Config::get('BCI_DB_USER'), - Password => mySociety::Config::get('BCI_DB_PASS'), - Host => mySociety::Config::get('BCI_DB_HOST', undef), - Port => mySociety::Config::get('BCI_DB_PORT', undef) + Name => mySociety::Config::get('FMS_DB_NAME'), + User => mySociety::Config::get('FMS_DB_USER'), + Password => mySociety::Config::get('FMS_DB_PASS'), + Host => mySociety::Config::get('FMS_DB_HOST', undef), + Port => mySociety::Config::get('FMS_DB_PORT', undef) ); } diff --git a/bin/load-contacts b/bin/load-contacts index 0fa76ca11..b18699db1 100755 --- a/bin/load-contacts +++ b/bin/load-contacts @@ -23,11 +23,11 @@ use mySociety::Random; BEGIN { mySociety::Config::set_file("$FindBin::Bin/../conf/general"); mySociety::DBHandle::configure( - Name => mySociety::Config::get('BCI_DB_NAME'), - User => mySociety::Config::get('BCI_DB_USER'), - Password => mySociety::Config::get('BCI_DB_PASS'), - Host => mySociety::Config::get('BCI_DB_HOST', undef), - Port => mySociety::Config::get('BCI_DB_PORT', undef) + Name => mySociety::Config::get('FMS_DB_NAME'), + User => mySociety::Config::get('FMS_DB_USER'), + Password => mySociety::Config::get('FMS_DB_PASS'), + Host => mySociety::Config::get('FMS_DB_HOST', undef), + Port => mySociety::Config::get('FMS_DB_PORT', undef) ); if (!dbh()->selectrow_array('select secret from secret for update of secret')) { diff --git a/bin/load-norwegian-contacts b/bin/load-norwegian-contacts index f7466ad2a..b73778848 100755 --- a/bin/load-norwegian-contacts +++ b/bin/load-norwegian-contacts @@ -25,11 +25,11 @@ use mySociety::Random; BEGIN { mySociety::Config::set_file("$FindBin::Bin/../conf/general"); mySociety::DBHandle::configure( - Name => mySociety::Config::get('BCI_DB_NAME'), - User => mySociety::Config::get('BCI_DB_USER'), - Password => mySociety::Config::get('BCI_DB_PASS'), - Host => mySociety::Config::get('BCI_DB_HOST', undef), - Port => mySociety::Config::get('BCI_DB_PORT', undef) + Name => mySociety::Config::get('FMS_DB_NAME'), + User => mySociety::Config::get('FMS_DB_USER'), + Password => mySociety::Config::get('FMS_DB_PASS'), + Host => mySociety::Config::get('FMS_DB_HOST', undef), + Port => mySociety::Config::get('FMS_DB_PORT', undef) ); if (!dbh()->selectrow_array('select secret from secret for update of secret')) { diff --git a/bin/populate_bing_cache b/bin/populate_bing_cache new file mode 100755 index 000000000..a3bef6759 --- /dev/null +++ b/bin/populate_bing_cache @@ -0,0 +1,58 @@ +#!/usr/bin/perl + +use strict; +use warnings; +require 5.8.0; + +use Data::Dumper; + +use FixMyStreet::App; +use FixMyStreet::Geocode::Bing; + +my $reports = FixMyStreet::App->model('DB::Problem')->search( + { + geocode => undef, + confirmed => { '!=', undef }, + latitude => { '!=', 0 }, + longitude => { '!=', 0 }, + }, + { + select => [qw/id geocode confirmed latitude longitude/], + order_by => { -desc => 'confirmed' } + } +); + +my $num_reports = $reports->count(); +print "Found $num_reports lacking geocode information\n"; + +my $time_to_do = ( $num_reports * 10 ) / 60 / 60; +if ( $time_to_do > 24 ) { + my $days = $time_to_do / 24; + my $hours = $time_to_do % 24; + printf( "Should take %d days and %d hours to finish\n", $days, $hours ); +} +elsif ( $time_to_do < 1 ) { + printf( "Should take %d minutes to finish\n", $time_to_do * 60 ); +} +else { + my $mins = ( $num_reports * 10 ) / 60 % 60; + printf( "Should take %d hours and %d minutes to finish\n", + $time_to_do, $mins ); +} + +while ( my $report = $reports->next ) { + $num_reports--; + next unless $report->latitude && $report->longitude; + next if $report->geocode; + + my $j = FixMyStreet::Geocode::Bing::reverse( $report->latitude, + $report->longitude ); + + $report->geocode($j); + $report->update; + + print "$num_reports left to populate\n" unless $num_reports % 100; + sleep 10; +} + +print "done\n"; diff --git a/bin/problem-creation-graph b/bin/problem-creation-graph index 6d34d3b49..4bba1cdb8 100755 --- a/bin/problem-creation-graph +++ b/bin/problem-creation-graph @@ -18,7 +18,7 @@ cd `dirname $0` cd ../../ source fixmystreet/commonlib/shlib/deployfns -read_conf fixmystreet/conf/general +read_conf fixmystreet/conf/general.yml if [ $OPTION_BASE_URL = "http://reportemptyhomes.com" ]; then DATE="2008-10-01" @@ -42,7 +42,7 @@ function grab_data { $1 group by date(created) order by date(created) - ;" | psql --host $OPTION_BCI_DB_HOST --port $OPTION_BCI_DB_PORT -A -F " " $OPTION_BCI_DB_NAME $OPTION_BCI_DB_USER | egrep -v "date|rows" >$2 + ;" | psql --host $OPTION_FMS_DB_HOST --port $OPTION_FMS_DB_PORT -A -F " " $OPTION_FMS_DB_NAME $OPTION_FMS_DB_USER | egrep -v "date|rows" >$2 } # rather nastily, work out the cumulative heights in reverse, so can plot impulses on top of each other diff --git a/bin/problems-filed-graph b/bin/problems-filed-graph index 702bea651..dbac35639 100755 --- a/bin/problems-filed-graph +++ b/bin/problems-filed-graph @@ -18,7 +18,7 @@ cd `dirname $0` cd ../../ source fixmystreet/commonlib/shlib/deployfns -read_conf fixmystreet/conf/general +read_conf fixmystreet/conf/general.yml SOURCEO=/tmp/bci-report-rate-graph-data-nonwmc-$RANDOM$RANDOM GPSCRIPT=/tmp/bci-report-rate-graph-script-$RANDOM$RANDOM @@ -29,7 +29,7 @@ echo "select where state not in ('unconfirmed', 'hidden') group by date(created) order by date(created) - ;" | psql --host $OPTION_BCI_DB_HOST --port $OPTION_BCI_DB_PORT -A -F " " $OPTION_BCI_DB_NAME $OPTION_BCI_DB_USER | egrep -v "date|rows" >$SOURCEO + ;" | psql --host $OPTION_FMS_DB_HOST --port $OPTION_FMS_DB_PORT -A -F " " $OPTION_FMS_DB_NAME $OPTION_FMS_DB_USER | egrep -v "date|rows" >$SOURCEO #echo "source $SOURCEO" cat >$GPSCRIPT <<END diff --git a/bin/rotate-photos b/bin/rotate-photos index 84c713926..faf2748e6 100755 --- a/bin/rotate-photos +++ b/bin/rotate-photos @@ -24,11 +24,11 @@ use mySociety::TempFiles; BEGIN { mySociety::Config::set_file("$FindBin::Bin/../conf/general"); mySociety::DBHandle::configure( - Name => mySociety::Config::get('BCI_DB_NAME'), - User => mySociety::Config::get('BCI_DB_USER'), - Password => mySociety::Config::get('BCI_DB_PASS'), - Host => mySociety::Config::get('BCI_DB_HOST', undef), - Port => mySociety::Config::get('BCI_DB_PORT', undef) + Name => mySociety::Config::get('FMS_DB_NAME'), + User => mySociety::Config::get('FMS_DB_USER'), + Password => mySociety::Config::get('FMS_DB_PASS'), + Host => mySociety::Config::get('FMS_DB_HOST', undef), + Port => mySociety::Config::get('FMS_DB_PORT', undef) ); } diff --git a/bin/send-reports b/bin/send-reports index 3d5243990..f1d8c5742 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -92,7 +92,7 @@ while (my $row = $unsent->next) { } if ( $row->used_map ) { - $h{closest_address} = $cobrand->find_closest( $h{latitude}, $h{longitude} ); + $h{closest_address} = $cobrand->find_closest( $h{latitude}, $h{longitude}, $row ); } my (@to, @recips, $template, $areas_info, @open311_councils); @@ -290,6 +290,10 @@ while (my $row = $unsent->next) { $result *= 0; } else { $result *= 1; + # temporary fix to resolve some issues with west berks + if ( $row->council =~ /2619/ ) { + $result *= 0; + } } } } diff --git a/bin/showcouncilrates b/bin/showcouncilrates index 9ae5c3e7b..cc8ce8d10 100755 --- a/bin/showcouncilrates +++ b/bin/showcouncilrates @@ -16,11 +16,11 @@ use FixMyStreet::Geocode::OSM; BEGIN { mySociety::Config::set_file("$FindBin::Bin/../conf/general"); mySociety::DBHandle::configure( - Name => mySociety::Config::get('BCI_DB_NAME'), - User => mySociety::Config::get('BCI_DB_USER'), - Password => mySociety::Config::get('BCI_DB_PASS'), - Host => mySociety::Config::get('BCI_DB_HOST', undef), - Port => mySociety::Config::get('BCI_DB_PORT', undef) + Name => mySociety::Config::get('FMS_DB_NAME'), + User => mySociety::Config::get('FMS_DB_USER'), + Password => mySociety::Config::get('FMS_DB_PASS'), + Host => mySociety::Config::get('FMS_DB_HOST', undef), + Port => mySociety::Config::get('FMS_DB_PORT', undef) ); } diff --git a/bin/test-mailin b/bin/test-mailin index 96e2022c0..3f101b438 100755 --- a/bin/test-mailin +++ b/bin/test-mailin @@ -29,7 +29,7 @@ use mySociety::WebTestHarness; print_log('notice', "started"); our $wth = new mySociety::WebTestHarness(); -$wth->database_connect('BCI_'); +$wth->database_connect('FMS_'); print_log('notice', "reading mail from STDIN"); my $slurped = read_file(\*STDIN); print_log('notice', "calling email_incoming"); diff --git a/bin/test-run b/bin/test-run index 58cf0b2ea..29e975ce4 100755 --- a/bin/test-run +++ b/bin/test-run @@ -5,7 +5,7 @@ # # Requires: # * ../conf/general file set up for FixMyStreet, and matching the below requirements -# * apache configured to serve ../web on OPTION_BASE_URL +# * apache configured to serve ../web on BASE_URL # * a database with name ending "_testharness"; this script will drop and remake the # database, so make sure it is never used for anything important # * email addresses (email_n below) configured to pipe to ./test-mailin with fast @@ -54,7 +54,7 @@ date_print("Set up web test harness..."); my ($wth, $action, $verbose, $pause, $multispawn) = mySociety::WebTestHarness::setup({ actions => \@actions, actions_desc => \%actions_desc, - dbname => 'BCI', + dbname => 'FMS', 'sql_extra' => ['../db/alert_types.sql'], }); $multispawn = 1; diff --git a/bin/update-areas b/bin/update-areas index bbc933faf..a8cc01769 100755 --- a/bin/update-areas +++ b/bin/update-areas @@ -24,11 +24,11 @@ use mySociety::VotingArea; BEGIN { mySociety::Config::set_file("$FindBin::Bin/../conf/general"); mySociety::DBHandle::configure( - Name => mySociety::Config::get('BCI_DB_NAME'), - User => mySociety::Config::get('BCI_DB_USER'), - Password => mySociety::Config::get('BCI_DB_PASS'), - Host => mySociety::Config::get('BCI_DB_HOST', undef), - Port => mySociety::Config::get('BCI_DB_PORT', undef) + Name => mySociety::Config::get('FMS_DB_NAME'), + User => mySociety::Config::get('FMS_DB_USER'), + Password => mySociety::Config::get('FMS_DB_PASS'), + Host => mySociety::Config::get('FMS_DB_HOST', undef), + Port => mySociety::Config::get('FMS_DB_PORT', undef) ); } |