Skip to content

Commit

Permalink
git-remote-mediawiki: support for uploading file in test environment
Browse files Browse the repository at this point in the history
This will be used for testing git-remote-mediawiki's import feature on a
wiki containing media files.

Signed-off-by: Simon CATHEBRAS <[email protected]>
Signed-off-by: Julien KHAYAT <[email protected]>
Signed-off-by: Simon Perrat <[email protected]>
Signed-off-by: Charles ROUSSEL <[email protected]>
Signed-off-by: Guillaume SASDY <[email protected]>
Signed-off-by: Matthieu Moy <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
moy authored and gitster committed Jul 6, 2012
1 parent a3a96a1 commit eb63bfa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contrib/mw-to-git/t/install-wiki/LocalSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@

## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads = false;
$wgEnableUploads = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand ="@CONVERT@";
$wgFileExtensions[] = 'txt';

# InstantCommons allows wiki to use images from http://commons.wikimedia.org
$wgUseInstantCommons = false;
Expand Down
3 changes: 3 additions & 0 deletions contrib/mw-to-git/t/test-gitmw-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ else
WIKI_DIR_INST="$CURR_DIR/$WEB_WWW"
fi

wiki_upload_file () {
"$CURR_DIR"/test-gitmw.pl upload_file "$@"
}

wiki_getpage () {
"$CURR_DIR"/test-gitmw.pl get_page "$@"
Expand Down
16 changes: 16 additions & 0 deletions contrib/mw-to-git/t/test-gitmw.pl
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,29 @@ sub wiki_getallpagename {
}
}

sub wiki_upload_file {
my $file_name = $_[0];
my $resultat = $mw->edit ( {
action => 'upload',
filename => $file_name,
comment => 'upload a file',
file => [ $file_name ],
ignorewarnings=>1,
}, {
skip_encoding => 1
} ) || die $mw->{error}->{code} . ' : ' . $mw->{error}->{details};
}



# Main part of this script: parse the command line arguments
# and select which function to execute
my $fct_to_call = shift;

wiki_login($wiki_admin, $wiki_admin_pass);

my %functions_to_call = qw(
upload_file wiki_upload_file
get_page wiki_getpage
delete_page wiki_delete_page
edit_page wiki_editpage
Expand Down

0 comments on commit eb63bfa

Please sign in to comment.