X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Fpod2x;h=64ccf882e7a91b09371cbf96791f06c51491b87b;hp=6b7153f9676211a149d3b52b07069fbcf4c6c6dc;hb=3f2a7b01b59902faed5767d81e2959e131bdbdfd;hpb=5e05724a635a22776f1b973f5d7e77989da4e048 diff --git a/bin/pod2x b/bin/pod2x index 6b7153f96..64ccf882e 100755 --- a/bin/pod2x +++ b/bin/pod2x @@ -1,37 +1,19 @@ #!/usr/bin/perl -w use strict; -use WWW::Mediawiki::Client; -#sub WWW::Mediawiki::Client::pagename_to_url { -# my ($self, $name, $action) = @_; -# WWW::Mediawiki::Client::URLConstructionException->throw( -# error => 'No action supplied.', -# ) unless $action; -# WWW::Mediawiki::Client::URLConstructionException->throw( -# error => "Page name $name ends with '.wiki'.", -# ) if $name =~ /.wiki$/; -# my $char = $self->space_substitute; -# $name =~ s/ /$char/; -# my $lang = $self->language_code; -# my $host = $self->host; -# $host =~ s/__LANG__/$lang/g; -# my $wiki_path = $self->wiki_path; -# $wiki_path =~ s/__LANG__/$lang/g; -# my $protocol = $self->protocol; -# return "$protocol://$host/$wiki_path?" . ACTION . "=$action&" . TITLE . "=$name" . '&wpRecreate=1'; -#} my $mw_username = 'ivan'; chomp( my $mw_password = `cat .mw-password` ); my $site_perl = "./FS"; -#my $html = "Freeside:1.7:Documentation:Developer"; -my $html = "Freeside:1.9:Documentation:Developer"; +my $html = "Freeside:5:Documentation:Developer"; foreach my $dir ( $html, - map "$html/$_", qw( bin FS FS/UI FS/part_export FS/part_pkg + map "$html/$_", qw( bin FS + FS/cdr FS/cust_main FS/cust_pkg FS/detail_format FS/part_event FS/part_event/Condition FS/part_event/Action + FS/part_export FS/part_pkg FS/pay_batch FS/ClientAPI FS/Cron FS/Misc FS/Report FS/Report/Table FS/TicketSystem FS/UI FS/SelfService @@ -58,15 +40,31 @@ foreach my $file ( -e "$file.pod" or system("cp $file $file.pod"); } +#just for filename_to_pagename for now +use WWW::Mediawiki::Client; my $mvs = WWW::Mediawiki::Client->new( 'host' => 'www.freeside.biz', + 'protocol' => 'https', 'wiki_path' => 'mediawiki/index.php', 'username' => $mw_username, 'password' => $mw_password, #'commit_message' => 'import from POD' ); +#$mvs->do_login; -$mvs->do_login; +use MediaWiki; + +my $c = MediaWiki->new; +# $is_ok = $c->setup("config.ini"); +$c->setup({ + 'bot' => { 'user' => $mw_username, 'pass' => $mw_password }, + 'wiki' => { + 'host' => 'www.freeside.biz', + 'path' => 'mediawiki', + #'has_query' => 1, + + } +}) or die "Mediawiki->setup failed"; my @files; if ( @ARGV ) { @@ -110,20 +108,21 @@ foreach my $file (@files) { next; }; - $mvs->do_update("$html/$name.wiki"); +# $mvs->do_update("$html/$name.wiki"); + + my $text = ''; open(RAW, "<$html/$name.rawwiki") or die $!; - open(WIKI,">$html/$name.wiki" ) or die $!; while () { s/\[\[([^#p][^\]]*)\]\]/"[[$html\/". w_e($1). "|$1]]"/ge; - print WIKI $_; + $text .= $_; } close RAW; - close WIKI; - print " uploading to ". $mvs->filename_to_pagename("$html/$name.wiki"). "\n"; - $mvs->commit_message( 'import from POD' ); - $mvs->do_commit("$html/$name.wiki"); + my $pagename = $mvs->filename_to_pagename("$html/$name.wiki"); + #print " uploading to $pagename\n"; + + $c->text( $pagename, $text ); }