root/tagwire/trunk/tagwire-pdcleaner.cgi

Revision 105, 0.9 kB (checked in by ogawa, 3 years ago)

Add MTTagDate for displaying the last date the tag added.
Add MTRelatedTags for listing tags related to the current tag.
Add MTXSearchTags for listing tags specified by MT-XSearch's argument.
Modify README.txt for these changes.
Add tagwire-pdcleaner.cgi which is a simple tool for cleaning PluginData? for tagwire.

  • Property svn:executable set to *
  • Property svn:keywords set to Id Author Date Rev
Line 
1 #!/usr/bin/perl -w
2 # Tagwire PluginData Cleaner
3 #
4 # $Id$
5 #
6 # This software is provided as-is. You may use it for commercial or
7 # personal use. If you distribute it, please keep this notice intact.
8 #
9 # Copyright (c) 2005 Hirotaka Ogawa
10
11 use strict;
12 local $|=1;
13
14 my($MT_DIR);
15 BEGIN {
16     if ($0 =~ m!(.*[/\\])!) {
17         $MT_DIR = $1;
18     } else {
19         $MT_DIR = './';
20     }
21     unshift @INC, $MT_DIR . 'lib';
22     unshift @INC, $MT_DIR . 'extlib';
23 }
24
25 use MT;
26 use MT::Blog;
27 use MT::PluginData;
28
29 print "Content-Type: text/html\n\n";
30 print <<HTML;
31 <html>
32 <head><title>Tagwire PluginData Cleaner</title></head>
33 <body>
34 <h1>Tagwire PluginData Cleaner</h1>
35 HTML
36
37 my $mt = MT->new;
38 my $iter = MT::Blog->load_iter();
39 while (my $b = $iter->()) {
40     while (my $pd = MT::PluginData->load({ plugin => 'Tagwire Plugin',
41                                            key => $b->id })) {
42         $pd->remove;
43         print ".";
44     }
45 }
46
47 print <<HTML;
48 <p><strong>PluginData successfully removed.</strong></p>
49 </body>
50 </html>
51 HTML
Note: See TracBrowser for help on using the browser.