On 29/05/12 10:28, nguyenkim thuat wrote:
my $url="http://localhost/mediawiki";
my $wiki_login="nguyenki";
my $wiki_passwd="linh";
my $wiki_domain="";
chomp($wiki_login);
chomp($wiki_passwd);
chomp($wiki_domain);
you dont need to use chomp here.
my $mediawiki;
mw_connect_maybe();
my $name="Te5.txt";
my $file="/index.php/File:";
my $path= $url.$file.$name;
#my $path= $url.$name
# the url to the file:
http://localhost/mediawiki/index.php/File:Te5.txt
print "$path\n";
#delete a file via mediawiki::API->api
$mediawiki->edit({
action => 'delete',
title => $path,
reason => 'no longer nedded'
}) || die $mediawiki-> {error}->{code} . ':' .
$mediawiki->{error}->{details};
the title of the file to delete should not include the url. it should be
"File:Something" or "Main Page" etc.
Best Regards
Jools