-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitMediawiki.sh
132 lines (130 loc) · 5.81 KB
/
gitMediawiki.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
#title :gitMediawiki.sh
#description :This script is used to download (via 'git clone') a release of MediaWiki and extensions used at Mercy. It asks for the WMF branch to install, then installs MediaWiki and all extensions from their master branch into the directory it is run from.
#author :Chris Koerner
#date :20141103
#version :0.5
#usage :bash gitMediawiki.sh
#notes :This does not setup LocalSettings.php, Localsettings.js (parsoid) or any other config/tweaks. Those are handled seperately
# Check https://mtswiki.mercy.net/wiki/MediaWiki/2013_Upgrade for those settings.
# This is set to run from ~/ but should run from any directory.
#prerequisites :This script also assumes you have git, svn, composer and npm (for parsoid) installed :/
#prompt for release you'd like. We'll then use that as the name of our directory (without the period in the directory name)
echo "Which branch to you want? (i.e. 1.25wmf6 or REL1_26)"
read release
echo "getting $release"
#get rid of that nasty period for our install directory
releaseDir="$(echo "$release"|tr -d '.')"
mkdir "$releaseDir"
#ok, time to pull down the mediawiki core repository. Probably an easier way to do this without all of core.
git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git
cd core
git checkout -b origin/wmf/"$release"
git archive origin/wmf/"$release" | tar -x -C ~/"$releaseDir"
cd ..
#Now we're in the folder you ran this script from ~/
cd $releaseDir
#Now let's install mediawiki core dependencies via composer - https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries
composer install --no-dev
composer update
#now install extensions via git that don't require additional steps
repoDir=https://gerrit.wikimedia.org/r/p/mediawiki/extensions/
echo "Installing extensions in $releaseDir/extensions"
echo "from" $repoDir
echo "installing.."
#this is the long list of extensions - CamelCase, separated by a space
#Adding new extensions to your setup is easy as adding a new one to this list. Like what I've done for HitCounters
for extension in Arrays CategoryTree CirrusSearch Cite cldr ContributionScores CSS DataTransfer Echo ExternalData Flow Gadgets Graph googleAnalytics HeaderTabs InputBox Interwiki JsonConfig LdapAuthentication Lockdown MobileFrontend MultiBoilerplate MultimediaViewer NoTitle Nuke ParserFunctions Renameuser ReplaceText Scribunto SemanticCompoundQueries SemanticDrilldown SemanticForms SemanticFormsInputs SemanticInternalObjects SpamBlacklist SyntaxHighlight_GeSHi TemplateData TextExtracts Thanks TitleKey UniversalLanguageSelector UploadWizard Variables WatchSubpages WhoIsWatching WikiEditor HitCounters
do
git clone "$repoDir$extension.git" "extensions/$extension"
#Check and see if a composer.json file exists in the extension directory. If so, run install and update. If not, keep on going
FILE=composer.json
if [ -f $FILE ];
then
composer install
composer update
else
echo "File $FILE does not exist. Skipping composer install"
fi
done
cd ..
echo "Done installing vanilla extensions"
#now we're going to install the few that have submodules
echo "Installing extensions with submodules in /extensions"
echo "installing.."
cd $releaseDir/extensions/
#Widgets
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Widgets.git
cd Widgets
git submodule init
git submodule update
cd ..
#VisualEditor
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git
cd VisualEditor
git submodule update --init
cd ..
#Elastica
##Not used ATM
#git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Elastica.git
#cd elastica
#git submodule init
#git submodule update
#cd..
#let's go back up and take care of the few installed via composer
cd ..
echo "Done installing extensions with submodules!"
echo "Installing extensions via composer"
echo "installing..."
#similar to before, we have a list of extensions and a loop. these are the package (extension) names on packagist.org
for extension in image-map semantic-media-wiki semantic-maps maps semantic-result-formats parser-hooks semantic-watchlist
do
#this gets the latest 'dev' version of each extension
composer require mediawiki/"$extension" @dev --update-no-dev
done
#Validator
#Validator needs its own dependencies installed.
cd extensions/
cd Validator
composer install
cd ..
#how about those extensions that live in other corners of the web?
#ExternalLinks
git clone https://github.com/roman-1983/mediawiki-ExternalLinks.git ExternalLinks
#SemanticFormsSelect
git clone https://code.google.com/p/semanticformsselect/ SemanticFormsSelect
echo "Done installing odd-ball extensions"
#lets go get the Vector skin - make sure to initialize in LocalSettings.php!
cd ..
cd skins
git clone https://gerrit.wikimedia.org/r/p/mediawiki/skins/Vector.git
echo "Vector Installed!"
#Foreground too
git clone https://github.com/thingles/foreground.git
echo "Foreground Installed!"
#now get parsoid all setup - in the ~/ directory
cd ../../
git clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid
cd parsoid
npm install
#for some reason node-gyp always fails for me. Let's install it manually
#NOTE: Seems like running of node-gyp requires root access
#NOTE: Maybe node-gyp is no longer needed? https://www.mediawiki.org/wiki/Parsoid/Developer_Setup#Optional_help
npm install node-gyp
#
#Add some fancy script to create the /log directory
mkdir log
#
echo "Parsoid Installed!"
cat << "EOF"
__ __ _ _ __ ___ _ _
| \/ | ___ __| (_) __ \ \ / (_) | _(_)
| |\/| |/ _ \/ _` | |/ _` \ \ /\ / /| | |/ / |
| | | | __/ (_| | | (_| |\ V V / | | <| |
|_| |_|\___|\__,_|_|\__,_| \_/\_/ |_|_|\_\_|
___ _ _ _ _ _
|_ _|_ __ ___| |_ __ _| | | ___ __| | |
| || '_ \/ __| __/ _` | | |/ _ \/ _` | |
| || | | \__ \ || (_| | | | __/ (_| |_|
|___|_| |_|___/\__\__,_|_|_|\___|\__,_(_)
EOF