fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-09-15 07:52 am

[dw-free] Fix "unitialized value" warning in LJ::Sysban

[commit: http://hg.dwscoalition.org/dw-free/rev/5dc738ffd616]

http://bugs.dwscoalition.org/show_bug.cgi?id=3942

Reduce warnings in the logs when we haven't loaded ip/uniq/spam sysbans.

Patch by [personal profile] pauamma.

Files modified:
  • cgi-bin/LJ/Sysban.pm
--------------------------------------------------------------------------------
diff -r 8e919bc7da65 -r 5dc738ffd616 cgi-bin/LJ/Sysban.pm
--- a/cgi-bin/LJ/Sysban.pm	Thu Sep 15 15:44:13 2011 +0800
+++ b/cgi-bin/LJ/Sysban.pm	Thu Sep 15 15:52:03 2011 +0800
@@ -40,6 +40,7 @@
         my $ip_ban_delay = $LJ::SYSBAN_IP_REFRESH || 120;
 
         # check memcache first if not loaded
+        $LJ::IP_BANNED_LOADED = 0 unless defined $LJ::IP_BANNED_LOADED;
         unless ($LJ::IP_BANNED_LOADED + $ip_ban_delay > $now) {
             my $memval = LJ::MemCache::get("sysban:ip");
             if ($memval) {
@@ -74,6 +75,7 @@
     if ($what eq 'uniq') {
 
         # check memcache first if not loaded
+        $LJ::UNIQ_BANNED_LOADED = 0 unless defined $LJ::UNIQ_BANNED_LOADED;
         unless ($LJ::UNIQ_BANNED_LOADED) {
             my $memval = LJ::MemCache::get("sysban:uniq");
             if ($memval) {
@@ -106,6 +108,8 @@
     # cache if spamreport ban
     if ( $what eq 'spamreport' ) {
         # check memcache first if not loaded
+        $LJ::SPAM_BANNED_LOADED = 0
+            unless defined $LJ::SPAMREPORT_BANNED_LOADED;
         unless ( $LJ::SPAMREPORT_BANNED_LOADED ) {
             my $memval = LJ::MemCache::get( "sysban:spamreport" );
             if ( $memval ) {
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org