Changeset 173

Show
Ignore:
Timestamp:
01/14/06 03:50:34 (3 years ago)
Author:
ogawa
Message:

Little more fix for mt-tbfixer.cgi

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • mt-db-convert/trunk/mt-tbfixer.cgi

    r172 r173  
    2121    my $app = shift; 
    2222    $app->SUPER::init(@_) or return; 
    23     $app->add_methods(fixer => \&fixer); 
     23    $app->add_methods(check => \&fixer, fix => \&fixer); 
    2424    $app->{charset} = $app->{cfg}->PublishCharset; 
    25     $app->{default_mode} = 'fixer'; 
     25    $app->{default_mode} = 'check'; 
    2626    $app; 
    2727} 
     
    2929sub fixer { 
    3030    my $app = shift; 
    31     my $mode = $app->param('fixit') ? 'fixit' : 'checkit'
     31    my $mode = $app->mode
    3232    my $html = '<html><body><pre>'; 
    3333 
     
    4444 
    4545        my $tb_id = $tbs{$eid}->id; 
    46         $html .= "MT::Trackback(id=" . $tb->id . ") is conflicted to (id=" . $tb_id . ") for entry " . $eid . "\n"; 
     46        $html .= "MT::Trackback(id=" . $tb->id . ") conflicts with (id=" . $tb_id . ") for entry " . $eid . "\n"; 
    4747        $conflicted_tb++; 
    4848 
    4949        my @pings = MT::TBPing->load({ tb_id => $tb->id }); 
    5050        for my $ping (@pings) { 
    51             if ($mode eq 'fixit') { 
     51            if ($mode eq 'fix') { 
    5252                $ping->tb_id($tb_id); 
    5353                $ping->save or die $ping->errstr; 
    5454            } 
    55             $html .= "   MT::TBPing(id=" . $ping->id . ") " . ($mode eq 'fixit' ? 'is' : 'can be') . " moved from MT::Trackback(id=" . $tb->id . ") to (id=" . $tb_id . ")\n"; 
     55            $html .= "   MT::TBPing(id=" . $ping->id . ") " . ($mode eq 'fix' ? 'is' : 'can be') . " moved from MT::Trackback(id=" . $tb->id . ") to (id=" . $tb_id . ")\n"; 
    5656            $conflicted_tbping++; 
    5757        } 
    5858 
    59         $html .= "   MT::Trackback(id=" . $tb->id . ") " . ($mode eq 'fixit' ? 'is' : 'can be') . " removed\n"; 
     59        $html .= "   MT::Trackback(id=" . $tb->id . ") " . ($mode eq 'fix' ? 'is' : 'can be') . " removed\n"; 
    6060 
    61         if ($mode eq 'fixit') { 
     61        if ($mode eq 'fix') { 
    6262            $tb->remove or die $tb->errstr; 
    6363        } 
    6464    } 
    6565    $html .= "\n"; 
    66     if ($mode eq 'fixit') { 
    67         $html .= ($conflicted_tb || 'No') . " conflicts are found and fixed in MT::Trackback!\n"; 
    68         $html .= ($conflicted_tbping || 'No') . " conflicts are found and fixed in MT::TBPing!\n"; 
     66    if ($mode eq 'fix') { 
     67        $html .= "$conflicted_tb conflicts are found and fixed in MT::Trackback!\n"; 
     68        $html .= "$conflicted_tbping conflicts are found and fixed in MT::TBPing!\n"; 
    6969        $html .= "\nYou should perform rebuilding for all MT contents.\n" 
    7070            if $conflicted_tb || $conflicted_tbping; 
    7171    } else { 
    72         $html .= ($conflicted_tb || 'No') . " conflicts are found in MT::Trackback!\n"; 
    73         $html .= ($conflicted_tbping || 'No') . " conflicts are found in MT::TBPing!\n"; 
     72        $html .= "$conflicted_tb conflicts are found in MT::Trackback!\n"; 
     73        $html .= "$conflicted_tbping conflicts are found in MT::TBPing!\n"; 
    7474    } 
    7575    $html . '</pre></body></html>';