5 my $mw_username = 'ivan';
6 chomp( my $mw_password = `cat .mw-password` );
8 my $site_perl = "./FS";
9 my $html = "Freeside:3:Documentation:Developer";
13 map "$html/$_", qw( bin FS
14 FS/cdr FS/cust_main FS/cust_pkg FS/detail_format
15 FS/part_event FS/part_event/Condition FS/part_event/Action
16 FS/part_export FS/part_pkg FS/pay_batch
17 FS/ClientAPI FS/Cron FS/Misc FS/Report FS/Report/Table
22 -d $dir or mkdir $dir;
27 die "Can't find $site_perl" unless -d $site_perl;
28 #die "Can't find $catman" unless -d $catman;
29 -d $html or mkdir $html;
33 #make some useless links
35 glob("$site_perl/bin/freeside-*"),
37 next if $file =~ /\.pod$/;
38 #symlink $file, "$file.pod"; # or die "link $file to $file.pod: $!";
39 #system("cp $file $file.pod");
40 -e "$file.pod" or system("cp $file $file.pod");
43 #just for filename_to_pagename for now
44 use WWW::Mediawiki::Client;
45 my $mvs = WWW::Mediawiki::Client->new(
46 'host' => 'www.freeside.biz',
47 'protocol' => 'https',
48 'wiki_path' => 'mediawiki/index.php',
49 'username' => $mw_username,
50 'password' => $mw_password,
51 #'commit_message' => 'import from POD'
57 my $c = MediaWiki->new;
58 # $is_ok = $c->setup("config.ini");
60 'bot' => { 'user' => $mw_username, 'pass' => $mw_password },
62 'host' => 'www.freeside.biz',
63 'path' => 'mediawiki',
67 }) or die "Mediawiki->setup failed";
74 glob("$site_perl/*.pm"),
75 glob("$site_perl/*/*.pm"),
76 glob("$site_perl/*/*/*.pm"),
77 glob("$site_perl/*/*/*/*.pm"),
78 glob("$site_perl/bin/*.pod"),
79 glob("./fs_selfservice/FS-SelfService/*.pm"),
80 glob("./fs_selfservice/FS-SelfService/*/*.pm"),
85 foreach my $file (@files) {
86 next if $file =~ /(^|\/)blib\//;
87 next if $file =~ /(^|\/)CVS\//;
88 #$file =~ /\/([\w\-]+)\.pm$/ or die "oops file $file";
90 if ( $file =~ /fs_\w+\/FS\-\w+\/(.*)\.pm$/ ) {
92 } elsif ( $file =~ /$site_perl\/(.*)\.(pm|pod)$/ ) {
95 die "oops file $file";
98 #exit if $count++ == 10;
100 my $htmlroot = join('/', map '..',1..(scalar($file =~ tr/\///)-2)) || '.';
102 system "pod2wiki --style mediawiki $file >$html/$name.rawwiki";
104 if ( -e "$html/$name.rawwiki" ) {
105 print "processing $name\n";
107 print "skipping $name\n";
111 # $mvs->do_update("$html/$name.wiki");
115 open(RAW, "<$html/$name.rawwiki") or die $!;
117 s/\[\[([^#p][^\]]*)\]\]/"[[$html\/". w_e($1). "|$1]]"/ge;
122 my $pagename = $mvs->filename_to_pagename("$html/$name.wiki");
123 #print " uploading to $pagename\n";
125 $c->text( $pagename, $text );
133 $s =~ s/^freeside-/bin\/freeside-/g;
138 ## system "pod2text $file >$catman/$name.txt";
140 # system "pod2html --podroot=$site_perl --podpath=./FS:./FS/UI:.:./bin --norecurse --htmlroot=$htmlroot $file >$html/$name.html";
141 # #system "pod2html --podroot=$site_perl --htmlroot=$htmlroot $file >$html/$name.html";
142 ## system "pod2html $file >$html/$name.html";
145 #remove the useless links
146 unlink glob("$site_perl/bin/*.pod");