Skip to content

Commit 3e3d5fd

Browse files
Benoit Persongitster
authored andcommitted
git-remote-mediawiki: remove hardcoded version number in the test suite
Updates the code to make it more easy to switch mediawiki version when testing. Before that, the version number was partly hardcoded, partly in a var. Signed-off-by: Benoit Person <[email protected]> Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bdff0e3 commit 3e3d5fd

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

contrib/mw-to-git/t/test-gitmw-lib.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -336,20 +336,21 @@ wiki_install () {
336336
fi
337337

338338
# Fetch MediaWiki's archive if not already present in the TMP directory
339+
MW_FILENAME="mediawiki-$MW_VERSION_MAJOR.$MW_VERSION_MINOR.tar.gz"
339340
cd "$TMP"
340-
if [ ! -f "$MW_VERSION.tar.gz" ] ; then
341-
echo "Downloading $MW_VERSION sources ..."
342-
wget "http://download.wikimedia.org/mediawiki/1.19/mediawiki-1.19.0.tar.gz" ||
341+
if [ ! -f $MW_FILENAME ] ; then
342+
echo "Downloading $MW_VERSION_MAJOR.$MW_VERSION_MINOR sources ..."
343+
wget "http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/$MW_FILENAME" ||
343344
error "Unable to download "\
344-
"http://download.wikimedia.org/mediawiki/1.19/"\
345-
"mediawiki-1.19.0.tar.gz. "\
345+
"http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/"\
346+
"$MW_FILENAME. "\
346347
"Please fix your connection and launch the script again."
347-
echo "$MW_VERSION.tar.gz downloaded in `pwd`. "\
348+
echo "$MW_FILENAME downloaded in `pwd`. "\
348349
"You can delete it later if you want."
349350
else
350-
echo "Reusing existing $MW_VERSION.tar.gz downloaded in `pwd`."
351+
echo "Reusing existing $MW_FILENAME downloaded in `pwd`."
351352
fi
352-
archive_abs_path=$(pwd)/"$MW_VERSION.tar.gz"
353+
archive_abs_path=$(pwd)/$MW_FILENAME
353354
cd "$WIKI_DIR_INST/$WIKI_DIR_NAME/" ||
354355
error "can't cd to $WIKI_DIR_INST/$WIKI_DIR_NAME/"
355356
tar xzf "$archive_abs_path" --strip-components=1 ||
@@ -431,5 +432,5 @@ wiki_delete () {
431432
# Delete the wiki's SQLite database
432433
rm -f "$TMP/$DB_FILE" || error "Database $TMP/$DB_FILE could not be deleted."
433434
rm -f "$FILES_FOLDER/$DB_FILE"
434-
rm -rf "$TMP/$MW_VERSION"
435+
rm -rf "$TMP/mediawiki-$MW_VERSION_MAJOR.$MW_VERSION_MINOR.tar.gz"
435436
}

contrib/mw-to-git/t/test.config

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ WEB_WWW=$WEB/www
3030

3131
# The variables below are used by the script to install a wiki.
3232
# You should not modify these unless you are modifying the script itself.
33-
MW_VERSION=mediawiki-1.19.0
33+
# tested versions: 1.19.X -> 1.21.1
34+
MW_VERSION_MAJOR=1.21
35+
MW_VERSION_MINOR=1
3436
FILES_FOLDER=install-wiki
3537
DB_INSTALL_SCRIPT=db_install.php

0 commit comments

Comments
 (0)