Changeset 256 for captcha/trunk/plugins

Show
Ignore:
Timestamp:
10/05/06 02:06:26 (2 years ago)
Author:
ogawa
Message:

removes a meaningless caching.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • captcha/trunk/plugins/captcha/captcha.pl

    r254 r256  
    6363 
    6464    # load config 
    65     my $cfg = config('blog:' . $blog->id); 
     65    my $cfg = $plugin->get_config_hash('blog:' . $blog->id); 
    6666 
    6767    # check if captcha-test disabled 
     
    9090    my $plugin = shift; 
    9191 
    92     my $conf = ''; 
     92    my $res = ''; 
    9393    my @blogs = MT::Blog->load; 
    9494    for my $blog (@blogs) { 
    95         my $config = $plugin->get_config_hash('blog:' . $blog->id); 
    96         next unless $config->{captcha_enable}; 
    97         $conf .= $blog->id . ',' . 
    98             $config->{captcha_ttl} . ',' . 
    99             $config->{captcha_secret} . ',' . 
    100             $config->{captcha_length} . ',' . 
    101             $config->{captcha_images_url} . ',' . 
    102             $config->{captcha_images_path} . "\n"; 
     95        my $cfg = $plugin->get_config_hash('blog:' . $blog->id); 
     96        next unless $cfg->{captcha_enable}; 
     97        $res .= $blog->id . ',' . 
     98            $cfg->{captcha_ttl} . ',' . 
     99            $cfg->{captcha_secret} . ',' . 
     100            $cfg->{captcha_length} . ',' . 
     101            $cfg->{captcha_images_url} . ',' . 
     102            $cfg->{captcha_images_path} . "\n"; 
    103103    } 
    104104 
     
    107107    open FH, ">$cfg_file" or die "Can't open File: $cfg_file\n"; 
    108108    flock FH, 2; 
    109     print FH $conf; 
     109    print FH $res; 
    110110    close(FH); 
    111111} 
     
    125125} 
    126126 
    127 use MT::Request; 
    128 sub config { 
    129     return {} unless $plugin; 
    130     my $scope = shift || 'system'; 
    131     my $r = MT::Request->instance; 
    132     my $cfg = $r->cache('captcha_config_' . $scope); 
    133     if (!$cfg) { 
    134         $cfg = $plugin->get_config_hash($scope); 
    135         $r->cache('captcha_config_' . $scope, $cfg); 
    136     } 
    137     $cfg; 
    138 } 
    139  
    1401271;