From: Michael Andreen Date: Sat, 12 Jan 2008 16:16:38 +0000 (+0100) Subject: Merge branch 'master' of ruin.nu:git/ndwebbie X-Git-Url: https://ruin.nu/git/?a=commitdiff_plain;h=f2c438684b7835e8c2033999fcc020d9352afca8;hp=b6cb51ce02932a2d761d06ed5b1303fc2fc9cb87;p=ndwebbie.git Merge branch 'master' of ruin.nu:git/ndwebbie --- diff --git a/apache-conf.conf b/apache-conf.conf index 2eb0cae..167819f 100644 --- a/apache-conf.conf +++ b/apache-conf.conf @@ -52,10 +52,10 @@ ServerName nd.ruin.nu ServerAlias webbie.ndawn.com - ErrorLog logs/ndawn_error_log + ErrorLog /var/log/apache2/ndawn_error_log #TransferLog logs/ndawn_access_log - CustomLog logs/ndawn_access_log "%h %l %u [%{%F %H:%M:%S}t] \"%r\" %>s %b %T \"%{Referer}i\" \"%{User-Agent}i\"" + CustomLog /var/log/apache2/ndawn_access_log "%h %l %u [%{%F %H:%M:%S}t] \"%r\" %>s %b %T \"%{Referer}i\" \"%{User-Agent}i\"" diff --git a/database/clean-webbie.sql b/database/clean-webbie.sql index a03a1b5..24e469c 100644 --- a/database/clean-webbie.sql +++ b/database/clean-webbie.sql @@ -5,11 +5,12 @@ TRUNCATE defense_requests; TRUNCATE graphs; TRUNCATE fleet_ships; TRUNCATE incomings; -TRUNCATE intel; -TRUNCATE scans; -TRUNCATE covop_targets; TRUNCATE raid_claims; TRUNCATE dumps; +TRUNCATE fleet_scans; +TRUNCATE planet_data; +UPDATE users SET scan_points = 0, defense_points = 0, attack_points = 0, humor_points = 0, rank = NULL, planet = NULL; +DELETE FROM scans; DELETE FROM raids; DELETE FROM calls; DELETE FROM fleets; @@ -27,4 +28,4 @@ ALTER SEQUENCE incomings_id_seq RESTART 1; ALTER SEQUENCE planets_id_seq RESTART 1; ALTER SEQUENCE raid_targets_id_seq RESTART 1; ALTER SEQUENCE raids_id_seq RESTART 1; -UPDATE users SET scan_points = 0, defense_points = 0, attack_points = 0, humor_points = 0, rank = NULL; +ALTER SEQUENCE scans_id_seq RESTART 1; diff --git a/scripts/fetchdumps.pl b/scripts/fetchdumps.pl index efd124a..b8be1c3 100755 --- a/scripts/fetchdumps.pl +++ b/scripts/fetchdumps.pl @@ -27,17 +27,11 @@ use DBD::Pg qw(:pg_types); use LWP::Simple; -$0 =~ /(.*\/)[^\/]/; -my $dir = $1; -our $dbh; -for my $file ("/home/whale/db.pl") -{ - unless (my $return = do $file){ - warn "couldn't parse $file: $@" if $@; - warn "couldn't do $file: $!" unless defined $return; - warn "couldn't run $file" unless $return; - } -} +use lib qw{/var/www/ndawn/}; +use ND::DB; + +our $dbh = ND::DB::DB(); + $dbh->do("SET CLIENT_ENCODING TO 'LATIN1';"); my $insert = $dbh->prepare("INSERT INTO dumps(tick,type,modified,dump) VALUES(?,?,?,?)"); @@ -57,8 +51,8 @@ for my $type ("planet","alliance","galaxy"){ } if ($updated){ - `${dir}parsedumps.pl $updated`; - `${dir}ndrank.pl`; + `/var/www/ndawn/scripts/parsedumps.pl $updated`; + `/var/www/ndawn/scripts/ndrank.pl`; $dbh->do("UPDATE misc SET value = ? WHERE id = 'TICK'", undef, $updated); } diff --git a/scripts/ndrank.pl b/scripts/ndrank.pl index cc7c127..be8b1cc 100755 --- a/scripts/ndrank.pl +++ b/scripts/ndrank.pl @@ -27,15 +27,10 @@ use DBD::Pg qw(:pg_types); use LWP::Simple; -our $dbh; -for my $file ("/home/whale/db.pl") -{ - unless (my $return = do $file){ - warn "couldn't parse $file: $@" if $@; - warn "couldn't do $file: $!" unless defined $return; - warn "couldn't run $file" unless $return; - } -} +use lib qw{/var/www/ndawn/}; +use ND::DB; + +our $dbh = ND::DB::DB(); $dbh->begin_work; my $st = $dbh->prepare(q{SELECT uid FROM current_planet_stats p JOIN users u ON p.id = u.planet WHERE alliance_id = 1 ORDER BY score DESC}); diff --git a/scripts/parsedumps.pl b/scripts/parsedumps.pl index f1738bf..d22525f 100755 --- a/scripts/parsedumps.pl +++ b/scripts/parsedumps.pl @@ -30,17 +30,9 @@ use LWP::Simple; use lib qw{/var/www/ndawn/}; use ND::Include; +use ND::DB; -our $dbh; -for my $file ("/home/whale/db.pl") -{ - unless (my $return = do $file){ - warn "couldn't parse $file: $@" if $@; - warn "couldn't do $file: $!" unless defined $return; - warn "couldn't run $file" unless $return; - } -} -#$dbh->trace("0","/tmp/parsedumps"); +our $dbh = ND::DB::DB(); $ND::DBH = $dbh; diff --git a/scripts/reset_hosts.pl b/scripts/reset_hosts.pl index 4932f05..a86ea3c 100755 --- a/scripts/reset_hosts.pl +++ b/scripts/reset_hosts.pl @@ -6,18 +6,12 @@ use DBI; use DBD::Pg qw(:pg_types); use LWP::Simple; +use lib qw{/var/www/ndawn/}; +use ND::DB; -our $dbh; -for my $file ("/home/whale/db.pl") -{ - unless (my $return = do $file){ - warn "couldn't parse $file: $@" if $@; - warn "couldn't do $file: $!" unless defined $return; - warn "couldn't run $file" unless $return; - } -} +our $dbh = ND::DB::DB(); -$dbh->trace("0","/tmp/scanstest"); +#$dbh->trace("0","/tmp/scanstest"); my $update = $dbh->prepare("UPDATE users SET hostmask = pnick || '.users.netgamers.org' where hostmask ilike '%.%' AND NOT hostmask ilike pnick || '.users.netgamers.org'"); $update->execute(); $dbh->disconnect; diff --git a/scripts/stats.pl b/scripts/stats.pl index ad8fc00..bcac7fe 100755 --- a/scripts/stats.pl +++ b/scripts/stats.pl @@ -26,18 +26,11 @@ use DBI; use DBD::Pg qw(:pg_types); use LWP::Simple; +use lib qw{/var/www/ndawn/}; +use ND::DB; + +our $dbh = ND::DB::DB(); -$0 =~ /(.*\/)[^\/]/; -my $dir = $1; -our $dbh; -for my $file ("/home/whale/db.pl") -{ - unless (my $return = do $file){ - warn "couldn't parse $file: $@" if $@; - warn "couldn't do $file: $!" unless defined $return; - warn "couldn't run $file" unless $return; - } -} $dbh->do("SET CLIENT_ENCODING TO 'LATIN1';"); my %classes = (Fighter => 'Fi', Corvette => 'Co', Frigate => 'Fr', Destroyer => 'De', Cruiser => 'Cr', Battleship => 'Bs'); diff --git a/scripts/tick.pl b/scripts/tick.pl index bb652a8..6b97aa1 100755 --- a/scripts/tick.pl +++ b/scripts/tick.pl @@ -7,17 +7,11 @@ use DBD::Pg qw(:pg_types); use LWP::Simple; -our $dbh; -for my $file ("/home/whale/db.pl") -{ - unless (my $return = do $file){ - warn "couldn't parse $file: $@" if $@; - warn "couldn't do $file: $!" unless defined $return; - warn "couldn't run $file" unless $return; - } -} +use lib qw{/var/www/ndawn/}; +use ND::DB; + +our $dbh = ND::DB::DB(); -$dbh->trace("0","/tmp/scanstest"); my $update = $dbh->prepare("UPDATE misc SET value = value::int + 1 WHERE id = 'TICK'"); $update->execute(); $dbh->disconnect; diff --git a/templates/forum.tmpl b/templates/forum.tmpl index c0aa490..394264d 100644 --- a/templates/forum.tmpl +++ b/templates/forum.tmpl @@ -1,4 +1,4 @@ -

+

@@ -29,7 +29,7 @@ - class="sticky">   + class="sticky">   @@ -104,7 +104,7 @@ Move checked threads to: