Changeset 173
- Timestamp:
- 01/14/06 03:50:34 (3 years ago)
- Files:
-
- mt-db-convert/trunk/mt-tbfixer.cgi (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
mt-db-convert/trunk/mt-tbfixer.cgi
r172 r173 21 21 my $app = shift; 22 22 $app->SUPER::init(@_) or return; 23 $app->add_methods( fixer=> \&fixer);23 $app->add_methods(check => \&fixer, fix => \&fixer); 24 24 $app->{charset} = $app->{cfg}->PublishCharset; 25 $app->{default_mode} = ' fixer';25 $app->{default_mode} = 'check'; 26 26 $app; 27 27 } … … 29 29 sub fixer { 30 30 my $app = shift; 31 my $mode = $app-> param('fixit') ? 'fixit' : 'checkit';31 my $mode = $app->mode; 32 32 my $html = '<html><body><pre>'; 33 33 … … 44 44 45 45 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"; 47 47 $conflicted_tb++; 48 48 49 49 my @pings = MT::TBPing->load({ tb_id => $tb->id }); 50 50 for my $ping (@pings) { 51 if ($mode eq 'fix it') {51 if ($mode eq 'fix') { 52 52 $ping->tb_id($tb_id); 53 53 $ping->save or die $ping->errstr; 54 54 } 55 $html .= " MT::TBPing(id=" . $ping->id . ") " . ($mode eq 'fix it' ? '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"; 56 56 $conflicted_tbping++; 57 57 } 58 58 59 $html .= " MT::Trackback(id=" . $tb->id . ") " . ($mode eq 'fix it' ? 'is' : 'can be') . " removed\n";59 $html .= " MT::Trackback(id=" . $tb->id . ") " . ($mode eq 'fix' ? 'is' : 'can be') . " removed\n"; 60 60 61 if ($mode eq 'fix it') {61 if ($mode eq 'fix') { 62 62 $tb->remove or die $tb->errstr; 63 63 } 64 64 } 65 65 $html .= "\n"; 66 if ($mode eq 'fix it') {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"; 69 69 $html .= "\nYou should perform rebuilding for all MT contents.\n" 70 70 if $conflicted_tb || $conflicted_tbping; 71 71 } 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"; 74 74 } 75 75 $html . '</pre></body></html>';
