Difference between revisions of "Mediawiki subversion (SVN) to git migration"

From Biowikifarm Metawiki
Jump to: navigation, search
(intermediate save, unfinished)
Line 6: Line 6:
 
* http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html
 
* http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html
 
* http://developer.imagej.net/using-git
 
* http://developer.imagej.net/using-git
 +
 +
HINT: to see available branches/tags:
 +
<syntaxhighlight lang="bash">
 +
git branch -r | sort --version-sort
 +
git tag -l | sort --version-sort
 +
</syntaxhighlight>
  
  
===Comparing 1.20 git-extensions with 1.18 and above, Nov. 2012===
+
===Preparations: Comparing 1.20 git-extensions with 1.18 and above, Nov. 2012===
 
''' Local SVN are now in same folder as git checkout = OK'''
 
''' Local SVN are now in same folder as git checkout = OK'''
  
Line 40: Line 46:
 
: Memo: use "git tag -l | sort -V" um tags sortiert anzuzeigen
 
: Memo: use "git tag -l | sort -V" um tags sortiert anzuzeigen
  
===First installation only: Create normal git-clone===
+
===First installation only: Create git-clone on biowikifarm===
  
A biowikifarm git clone is updated Core and extensions are exported by a tar archive export out of a git clone. (HINT: before starting the script do a sudo command, e.g. <code>sudo ls</code> so the bash prompt knows your password and you don't have to give your password over and over again)
+
A biowikifarm git-clone (normal, not bare) of the WMF core and extension repo is created.
  
 
<syntaxhighlight lang="bash" style="font-size:105%">
 
<syntaxhighlight lang="bash" style="font-size:105%">
Line 55: Line 61:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===Update git and export versions to folders===
+
===Update git and export version to folder===
  
This works for creating the first version as well as updating.
+
Core and extensions are exported by a tar archive export out of a git clone. This works for creating the first version as well as updating. (HINT: before starting the script do a sudo command, e.g. <code>sudo ls</code> so the bash prompt knows your password and you don't have to give your password over and over again)
  
 
<syntaxhighlight lang="bash" style="font-size:105%;border-left:1px solid gray;padding-left:1em;">
 
<syntaxhighlight lang="bash" style="font-size:105%;border-left:1px solid gray;padding-left:1em;">
  # 1. Update LOCAL-git core and extensions from WMF-git:
+
  # 1. Update biowikifarm clone:
 
  cd /usr/share/mw-wmf-clone/core; sudo git fetch; cd ../extensions; sudo git pull; sudo git submodule update --init --recursive;
 
  cd /usr/share/mw-wmf-clone/core; sudo git fetch; cd ../extensions; sudo git pull; sudo git submodule update --init --recursive;
  
  # 2. now we export (git archive) a specific MediaWiki versions into other folders:
+
  # 2. Now export (git archive) a specific MediaWiki versions into other folders:
  sudo mkdir /usr/share/mw1.20
+
wikipath="/usr/share/mw1.20/"
  cd /usr/share/mw-wmf-clone/core
+
 
  sudo git archive 1.20.2 | sudo tar --extract --overwrite --directory=/usr/share/mw1.20
+
sudo mkdir ${wikipath}
 +
cd /usr/share/mw-wmf-clone/core; sudo git archive 1.20.2 | sudo tar --extract --overwrite --directory=${wikipath}
 
   # Note: tar provides a "--recursive-unlink" option for extract, which removes the content of the target folder
 
   # Note: tar provides a "--recursive-unlink" option for extract, which removes the content of the target folder
 
   #  However, our mediawiki installations require many additional files (svn, widget-right changes, smarty, commons-bot)
 
   #  However, our mediawiki installations require many additional files (svn, widget-right changes, smarty, commons-bot)
 
   #  which would have to be manually restored. Therefore, do not use --recursive-unlink
 
   #  which would have to be manually restored. Therefore, do not use --recursive-unlink
 
+
  # 3. Same for extensions.
  extpathto="/usr/share/mw1.20/extensions/"
+
  # In list of extensions desired version is specified like the following examples:
  extpathsrc="/usr/share/mw-wmf-clone/extensions/"
+
  # "SemanticMediaWiki"          → version HEAD + extension SemanticMediaWiki
# specify version control like this:
+
  # "tags/1.8, SemanticMediaWiki" → version  1.8 + extension SemanticMediaWiki
  #"SemanticMediaWiki"          → version HEAD + extension SemanticMediaWiki
+
  #"tags/1.8, SemanticMediaWiki" → version  1.8 + extension SemanticMediaWiki
+
 
  EXTENSIONS="AccessControl
 
  EXTENSIONS="AccessControl
 
AdminLinks
 
AdminLinks
Line 184: Line 189:
 
WikimediaMessages"
 
WikimediaMessages"
  
 +
extpathto=${wikipath}"extensions/"
 +
gitext="/usr/share/mw-wmf-clone/extensions/"
 
  IFS=$'\n' # set field separator to newline
 
  IFS=$'\n' # set field separator to newline
 
  for ext in $EXTENSIONS; do
 
  for ext in $EXTENSIONS; do
Line 190: Line 197:
 
   #      ↓            ↓
 
   #      ↓            ↓
 
   #  $cloneVersion  $extension
 
   #  $cloneVersion  $extension
   # will export tag 1.8.  
+
   #   will export tag 1.8.
 
+
   # NOTE: PLEASE COMMENT THE FOLLOWING TWO LINES HOW THEY WORK
   # get cloneVersion and extension (as part of the line-string)
+
 
   cloneVersion=$([ "${ext%,*}" == "$ext" ] && echo "HEAD" || echo "${ext%,*}")
 
   cloneVersion=$([ "${ext%,*}" == "$ext" ] && echo "HEAD" || echo "${ext%,*}")
 
   extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext##*,* }")
 
   extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext##*,* }")
Line 198: Line 204:
 
     sudo mkdir --parents "${extpathto}${extension}"
 
     sudo mkdir --parents "${extpathto}${extension}"
 
   fi
 
   fi
   if [ ! -d "${extpathsrc}${extension}" ]; then
+
   if [ ! -d "${gitext}${extension}" ]; then
     echo "${extpathsrc}${extension} DOES NOT EXIST to export a git archive from!! (Skip this step)"
+
     echo "${gitext}${extension} DOES NOT EXIST and COULD NOT BE CREATED!!"
 
   else
 
   else
     printf "Git archive export: %-30s %s\n" $extension $cloneVersion
+
     printf "git archive export: %-30s %s\n" $extension $cloneVersion
     # sudo git archive --prefix=AdminLinks/ HEAD | sudo tar --extract --overwrite --directory=/usr/share/mw1.20/extensions
+
     # EXAMPLE: sudo git archive --prefix=AdminLinks/ HEAD | sudo tar --extract --overwrite --directory=/usr/share/mw1.20/extensions
     cd "${extpathsrc}${extension}" && sudo git archive $cloneVersion  --prefix="${extension}/" | sudo tar --extract --recursive-unlink --directory="${extpathto}"
+
     cd "${gitext}${extension}" && sudo git archive --prefix="${extension}/" $cloneVersion | sudo tar --extract --overwrite --directory="${extpathto}"
 
   fi
 
   fi
 
  done
 
  done
Line 209: Line 215:
  
  
 
+
# 4.a ONLY FIRST TIME CREATION of SVN-Extensions:
 
+
  # Insert the local-svn-managed extensions into the same folder:
 
+
 
+
 
+
 
+
  # 3. Also insert the local-svn-managed extensions into the same folder:
+
 
  # Note: www-data cannot create the folders, but must be able to write the updates (svn-post-commit hook) -> temp folder
 
  # Note: www-data cannot create the folders, but must be able to write the updates (svn-post-commit hook) -> temp folder
 
  # Remaining Problem: when a new svn folder is added after this initial setup to the local subversion repo,
 
  # Remaining Problem: when a new svn folder is added after this initial setup to the local subversion repo,
 
  #  that folder must manually chown to www-data; else svn co post-commit errors will occur.
 
  #  that folder must manually chown to www-data; else svn co post-commit errors will occur.
  cd /usr/share/mediawiki20/
+
  cd ${wikipath}
 
  sudo mkdir TEMP-LOCAL-svn; ## temp folder
 
  sudo mkdir TEMP-LOCAL-svn; ## temp folder
 
  sudo svn checkout file:///var/lib/svn/LocalSVNextensions ./TEMP-LOCAL-svn
 
  sudo svn checkout file:///var/lib/svn/LocalSVNextensions ./TEMP-LOCAL-svn
Line 226: Line 227:
 
  sudo rm ./TEMP-LOCAL-svn -r
 
  sudo rm ./TEMP-LOCAL-svn -r
  
  # 4. Finishing touches. Widgets needs a writable folder:
+
  # 4.b LATER SVN-Extension UPDATING (required ALTERNATIVE to 4.a)
  cd /usr/share/mediawiki20/
+
# 3. Update from LOCAL-svn with:
 +
cd ${wikipath}extensions; sudo /usr/bin/svn update;
 +
 
 +
# 5. Finishing touches. Widgets needs a writable folder:
 +
  cd ${wikipath}
 
  sudo chown -R  www-data.www-data ./extensions/Widgets/compiled_templates;  
 
  sudo chown -R  www-data.www-data ./extensions/Widgets/compiled_templates;  
  # And widgets does not contain the necessary code:
+
  # Widgets does not contain all necessary code (-> Warning: require_once(/usr/share/mediawiki20/phase3/extensions/Widgets/smarty/Smarty.class.php): failed to open stream: No such file or directory...)
# (Warning: require_once(/usr/share/mediawiki20/phase3/extensions/Widgets/smarty/Smarty.class.php): failed to open stream: No such file or directory in /usr/share/mediawiki20/phase3/extensions/Widgets/Widgets.php on line 53 etc.)
+
  # In the absence of installation instructions, using previously saved code:  
  # In the absence of installation instructions, using the previous 1.18 code:  
+
  sudo cp -r /usr/share/mw-missing-code/Widgets/smarty ./extensions/Widgets
  cp -r /usr/share/mediawikistaging/ext-tagged-release/Widgets/smarty ./extensions/Widgets
+
  sudo cp -r /usr/share/mw-missing-code/Widgets/googlecode ./extensions/Widgets
  cp -r /usr/share/mediawikistaging/ext-tagged-release/Widgets/googlecode ./extensions/Widgets
+
<!--
# Note: a list of UNUSED extensions is available on earlier versions of this page
+
  # NOTE: in Dec. 2012 the parts were originally copied as seen below:
  # (before 9 Dec. 2012); may be useful for easy copying or checking additional extensions.
+
  sudo mkdir /usr/share/mw-missing-code
 
+
sudo mkdir /usr/share/mw-missing-code/Widgets
# A second clone:
+
  sudo cp -r /usr/share/mediawikistaging/ext-tagged-release/Widgets/smarty /usr/share/mw-missing-code/Widgets
  cd /usr/share; sudo git clone --local /usr/share/mediawiki-git/core mediawikiPP
+
  sudo cp -r /usr/share/mediawikistaging/ext-tagged-release/Widgets/googlecode /usr/share/mw-missing-code/Widgets
  cd /usr/share/mediawikiPP/extensions;
+
-->
  ## (EXECUTE EXTENSION CLONE-COMMANDS, SVN, AND FINISHING FROM ABOVE with modified path HERE AS WELL)
+
 
+
  
 
----
 
----
  
==Updating mediawiki (git+svn)==
 
 
<syntaxhighlight lang="bash">
 
# 2. Reset local mediawiki installations prior to the update:
 
# (Note: HEAD is head of current branch i.e. head after checkout REL1_20 is 1.20, not master.
 
# (Use "git branch" or "git branch -a" to check which branch is active.)
 
cd /usr/share/mediawikiPP; sudo git checkout origin/master; cd extensions; (for f in *; do cd "$f" && sudo git checkout origin/master && cd ..; done);
 
cd /usr/share/mediawiki20; sudo git checkout origin/master; cd extensions; (for f in *; do cd "$f" && sudo git checkout origin/master && cd ..; done);
 
# 3. Update local mediawiki20, mediawikiPP from LOCAL-git and LOCAL-svn with:
 
cd /usr/share/mediawiki20; sudo git pull; cd extensions; (for f in *; do cd "$f" && sudo git pull origin/master && cd ..; done); /usr/bin/svn update;
 
cd /usr/share/mediawikiPP; sudo git pull; cd extensions; (for f in *; do cd "$f" && sudo git pull origin/master && cd ..; done); /usr/bin/svn update;
 
## Note: LATER check whether the git pull commands above are really necessary. It always reports "already up-to-date" - perhaps due to the hardlinks?
 
 
# 4. switch to the desired version again (AFTER UPDATING), see next section...
 
</syntaxhighlight>
 
 
==Updating mediawiki to specific versions==
 
 
'''SWITCH INSTALLATIONS TO SPECIFIC TAGS:'''
 
<syntaxhighlight lang="bash">
 
# Note: to see all branches/tags do:
 
git branch -r | sort --version-sort
 
git tag -l | sort --version-sort
 
</syntaxhighlight>
 
  
 +
==Setting primary git clone checkout to version for testing==
  
 +
BELOW IS OLD CODE. PROBLEM: extension is not inside core, but side-by-side. needs probably symlink? Not yet installed as testwiki.
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
# Mediawiki core:
+
  cd /usr/share/mw-wmf-clone/core; sudo git checkout origin/REL1_20
  cd /usr/share/mediawikiPP; sudo git checkout origin/REL1_19
+
cd /usr/share/mediawiki20; sudo git checkout origin/REL1_20
+
 
  # SMW extensions:
 
  # SMW extensions:
 
  # find tags online: https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/SemanticMediaWiki.git;a=tags
 
  # find tags online: https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/SemanticMediaWiki.git;a=tags
  # on the commend line: git tag -l | sort --version-sort
+
  # or on command line: git tag -l | sort --version-sort
  cd /usr/share/mediawiki20/extensions/SemanticMediaWiki; sudo git checkout tags/1.8
+
  cd /usr/share/mw-wmf-clone/extensions/SemanticMediaWiki; sudo git checkout tags/1.8
  cd /usr/share/mediawiki20/extensions/SemanticCompoundQueries; sudo git checkout tags/0.3.4
+
  cd /usr/share/mw-wmf-clone/extensions/SemanticCompoundQueries; sudo git checkout tags/0.3.4
  cd /usr/share/mediawiki20/extensions/SemanticDrilldown; sudo git checkout tags/1.2.4
+
  cd /usr/share/mw-wmf-clone/extensions/SemanticDrilldown; sudo git checkout tags/1.2.4
cd /usr/share/mediawiki20/extensions/SemanticForms; sudo git checkout tags/2.5.1
+
# cd /usr/share/mediawiki20/extensions/SemanticFormsInputs; sudo git checkout tags/DOES NOT EXIST YET
+
cd /usr/share/mediawiki20/extensions/SemanticMaps; sudo git checkout tags/2.0
+
cd /usr/share/mediawiki20/extensions/SemanticInternalObjects; sudo git checkout tags/0.7
+
cd /usr/share/mediawiki20/extensions/SemanticResultFormats; sudo git checkout tags/1.8
+
cd /usr/share/mediawiki20/extensions/Maps; sudo git checkout tags/2.0
+
cd /usr/share/mediawiki20/extensions/Validator; sudo git checkout tags/0.5.1
+
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
 +
== NEW: Testing new wikis==
 +
 +
For the moment the testwiki_v20 symlinks go to /usr/share/mediawiki20, copy 1.20 version above to there (quicker than changing all symlinks...)
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 +
sudo cp -r /usr/share/mw1.20 /usr/share/mediawiki20
 
  cd /var/www/testwiki_v20;        sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php  
 
  cd /var/www/testwiki_v20;        sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php  
  cd /var/www/v-practicalplants/w; sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
+
  cd /var/www/testwiki_v20;        sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 +
## cd /var/www/v-practicalplants/w; sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 
  sudo /usr/sbin/apache2ctl -k graceful  && sudo /etc/init.d/nginx restart
 
  sudo /usr/sbin/apache2ctl -k graceful  && sudo /etc/init.d/nginx restart
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
Test location is
 +
http://biowikifarm.net/test_v20/Main_Page
 +
(temp also: also http://biowikifarm.net/test_v18/Main_Page = test with normal staging version, just for identical web server setup)
  
------
+
'''Possible errors that could be resolved (notes for migration of production wikis):'''
 +
* '''"Database returned error "1170: BLOB/TEXT column 'acr_email' used in key specification without a key length (localhost)"''' occurred in earlier test. This may or may not re-occur when migrating the production wikis!
 +
** creating a new db with all shared tables locally and a setting in LocalSettings: $wgSharedTables = array("interwiki"); did not help.
 +
** Changed field type, see [http://www.mediawiki.org/w/index.php?title=Extension_talk:ConfirmAccount&oldid=586787#SQL_Error_1170:_BLOB.2FTEXT_column_.27acr_email.27_used_in_key_specification_without_a_key_length_.28localhost.29]* ./maintenance/update.php running through.
  
 +
* Note: as of 2012-12-12: SemanticInternalObjects is now working.
 +
* SemanticForms was still breaking on main page and Special:Version with "Fatal error: Class 'SMWSQLStore3' not found in /usr/share/mediawiki20/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php on line 286. This was caused by enabledSemantic not being properly called for this specific test wiki (the other wikis were ok, so it was a config error).
  
After this:
+
* A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
cd /var/www/testwiki_v20; sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
+
SELECT smw_id,smw_sortkey FROM `smw_object_ids` WHERE smw_title = 'Ns:widget' AND smw_namespace = '10' AND smw_iw = '' AND smw_subobject = '' LIMIT 1 from within function "SMWSql3SmwIds::getDatabaseIdAndSort". Database returned error "1146: Table 'testwiki20.smw_object_ids' doesn't exist (localhost)". FIXED WITH:
started to run, but terminated with error: "Database returned error "1170: BLOB/TEXT column 'acr_email' used in key specification without a key length (localhost)""
+
* creating a new db with all shared tables locally and a setting in LocalSettings: $wgSharedTables = array("interwiki"); did not help.  
+
* Changed field type, see [http://www.mediawiki.org/w/index.php?title=Extension_talk:ConfirmAccount&oldid=586787#SQL_Error_1170:_BLOB.2FTEXT_column_.27acr_email.27_used_in_key_specification_without_a_key_length_.28localhost.29]* ./maintenance/update.php running through.
+
  
Main page loads, but Special pages cause error (in biowikifarm.net-error.log):
+
cd /var/www/testwiki_v20
2012/10/13 00:55:52 [error] 1546#0: *723661 FastCGI sent in stderr: "PHP message: PHP Fatal errorClass 'SMWSQLStore2' not found in /usr/share/mediawiki20/phase3/extensions/SemanticInternalObjects/SemanticInternalObjects_body.php on line 56" while reading response header from upstream, client...  
+
sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 +
sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -ftpv --conf ./LocalSettings.php
 +
# the next step can be time-consuming:
 +
  sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -v --conf ./LocalSettings.php
 +
sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
  
Source are SemanticForms and SemanticInternalObjects.
+
Testwiki 1.20 is working now.
 
+
TESTING: http://biowikifarm.net/test_v20/Main_Page versus http://biowikifarm.net/test_v18/Main_Page (test with normal staging version, just for identical web server setup)
+
  
 
----
 
----
  
After waiting several weeks, the bug did not go away. Submitted bug reports:
+
<!-- internal memo: the command shell 1-line update loop was:
https://bugzilla.wikimedia.org/show_bug.cgi?id=41640
+
cd /usr/share/mediawiki20; sudo git pull; cd extensions; (for f in *; do cd "$f" && sudo git pull origin/master && cd ..; done); /usr/bin/svn update;
https://bugzilla.wikimedia.org/show_bug.cgi?id=41641
+
-->

Revision as of 14:21, 12 December 2012

This is a planning document

How-to is here: https://www.mediawiki.org/wiki/Download_from_Git . Checking extensions: Which extensions previously obtained from WMF-Subversion (i.e. excluding those we have in local SVN) are Not in the following list of git-migrated mediawiki extensions? https://gerrit.wikimedia.org/r/#/admin/projects/

Useful resources for understanding git checkout, head, detached head, --track:

HINT: to see available branches/tags:

 git branch -r | sort --version-sort
 git tag -l | sort --version-sort


Preparations: Comparing 1.20 git-extensions with 1.18 and above, Nov. 2012

Local SVN are now in same folder as git checkout = OK

Manually copied i.e. now available in the 1.20git extension folder:

  • SMWAskAPI - only installed on offene-naturfuehrer = OK

Missing but no longer used = OK

  • AddMediaWizard (no longer found by find/grep)
  • ArrayExtension replaced by extension: Arrays (all seem to be updated)
  • SyntaxHighlight (no longer used, all occurrences refer to SyntaxHighlight_GeSHi)

Missing, now disabled in common/local settings = OK

  • Disabling MassEditRegex - Installed on all wikis, but not used because the currently installed version (r4) is not compatible with MediaWiki 1.18. We have tested this extension on 1.19 where it works. For some wikis this extension would be very useful.
  • Disabling MathStatFunctions - probably never used.
  • Disabling DynamicPageList - only installed 4 wiki, was deprecated a long time; all pages checked and function removed.
  • Disabling FileAttach: Used only as testing in testwikis, now removed there.


THE FOLLOWING probably may have to be disabled when migrating:


Installing mediawiki from git (1.20 and later)

Main source: mediawiki.org: Download from Git. See also overview of wikimedia projects in Git.

IMPORTANT CHANGE in comparison to earlier subversion setup: we directly clone all extensions into the /extension folder, instead of cloning elsewhere and then symlinking.

Memo: use "git tag -l | sort -V" um tags sortiert anzuzeigen

First installation only: Create git-clone on biowikifarm

A biowikifarm git-clone (normal, not bare) of the WMF core and extension repo is created.

# 1. FIRST create a biowikifarm git-clone (non-bare) for mediawiki-core and mw-extensions (submodules):
  cd /usr/share; sudo mkdir mw-wmf-clone; cd /usr/share/mw-wmf-clone
  sudo git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git core
  sudo git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions.git extensions
  cd /usr/share/mw-wmf-clone/extensions; sudo git submodule update --init --recursive
  # Note: with after init, one can use "git foreach". Example:
  #   git submodule foreach 'echo $path `git rev-parse HEAD`' 
  #   will show the path and currently checked out commit for each submodule.

Update git and export version to folder

Core and extensions are exported by a tar archive export out of a git clone. This works for creating the first version as well as updating. (HINT: before starting the script do a sudo command, e.g. sudo ls so the bash prompt knows your password and you don't have to give your password over and over again)

 # 1. Update biowikifarm clone:
 cd /usr/share/mw-wmf-clone/core; sudo git fetch; cd ../extensions; sudo git pull; sudo git submodule update --init --recursive;

 # 2. Now export (git archive) a specific MediaWiki versions into other folders:
 wikipath="/usr/share/mw1.20/"

 sudo mkdir ${wikipath}
 cd /usr/share/mw-wmf-clone/core; sudo git archive 1.20.2 | sudo tar --extract --overwrite --directory=${wikipath}
  # Note: tar provides a "--recursive-unlink" option for extract, which removes the content of the target folder
  #  However, our mediawiki installations require many additional files (svn, widget-right changes, smarty, commons-bot)
  #  which would have to be manually restored. Therefore, do not use --recursive-unlink
 # 3. Same for extensions.
 # In list of extensions desired version is specified like the following examples:
 #  "SemanticMediaWiki"           → version HEAD + extension SemanticMediaWiki
 #  "tags/1.8, SemanticMediaWiki" → version  1.8 + extension SemanticMediaWiki
 EXTENSIONS="AccessControl
AdminLinks
APC
Arrays
ArticleFeedback
ArticleFeedbackv5
AssertEdit
CategoryTree
CentralAuth
CentralNotice
CharInsert
CheckUser
Cite
cldr
ClickTracking
CodeEditor
Collection
ConditionalShowSection
Configure
ConfirmAccount
ConfirmEdit
ContactPage
Contest
ContributionReporting
DataTransfer
DiscussionThreading
DismissableSiteNotice
DoubleWiki
DumpHTML
DynamicPageList
EmailCapture
ExpandTemplates
ExternalData
FlaggedRevs
FormPreloadPostCache
Gadgets
GlobalBlocking
GlobalUsage
GlobalUserGroups
GraphViz
HeaderTabs
ImageMap
InputBox
Interlanguage
intersection
Interwiki
LabeledSectionTransclusion
LiquidThreads
Lockdown
Loops
Maintenance
tags/2.0, Maps
Math
MediaFunctions
MobileFrontend
MoodBar
MWSearch
Nuke
OAI
OggHandler
OpenID
OpenSearchXml
PagedTiffHandler
ParserFunctions
PdfHandler
Persona
Poem
ProofreadPage
Quiz
Renameuser
ReplaceText
RSS
Scribunto
tags/0.3.4, SemanticCompoundQueries
tags/1.2.4, SemanticDrilldown
tags/2.5.1, SemanticForms
SemanticFormsInputs
SemanticImageInput
tags/0.7, SemanticInternalObjects
tags/2.0, SemanticMaps
tags/1.8, SemanticMediaWiki
tags/1.8, SemanticResultFormats
SemanticSignup
SemanticWatchlist
SimpleSurvey
SocialProfile
SpamBlacklist
Sudo
Suhosin
SwiftCloudFiles
SyntaxHighlight_GeSHi
TimedMediaHandler
TitleKey
UploadLocal
UploadWizard
tags/0.5.1, Validator
Variables
Vector
VipsScaler
VisualEditor
WebFonts
Widgets
Wikibase
WikibaseSolr
WikiEditor
WikiLove
WikimediaMessages"

 extpathto=${wikipath}"extensions/"
 gitext="/usr/share/mw-wmf-clone/extensions/"
 IFS=$'\n' # set field separator to newline
 for ext in $EXTENSIONS; do
  # split line on ", ". If only one value, export HEAD, else first value is branch/tag. Example:
  #   "tags/1.8, SemanticMediaWiki"
  #      ↓             ↓
  #   $cloneVersion  $extension
  #   will export tag 1.8.
  # NOTE: PLEASE COMMENT THE FOLLOWING TWO LINES HOW THEY WORK
  cloneVersion=$([ "${ext%,*}" == "$ext" ] && echo "HEAD" || echo "${ext%,*}")
  extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext##*,* }")
  if [ ! -d "${extpathto}${extension}" ]; then
    sudo mkdir --parents "${extpathto}${extension}"
  fi
  if [ ! -d "${gitext}${extension}" ]; then
    echo "${gitext}${extension} DOES NOT EXIST and COULD NOT BE CREATED!!"
  else
    printf "git archive export: %-30s %s\n" $extension $cloneVersion
    # EXAMPLE: sudo git archive --prefix=AdminLinks/ HEAD | sudo tar --extract --overwrite --directory=/usr/share/mw1.20/extensions
    cd "${gitext}${extension}" && sudo git archive --prefix="${extension}/" $cloneVersion | sudo tar --extract --overwrite --directory="${extpathto}"
  fi
 done


# 4.a ONLY FIRST TIME CREATION of SVN-Extensions:
# Insert the local-svn-managed extensions into the same folder:
# Note: www-data cannot create the folders, but must be able to write the updates (svn-post-commit hook) -> temp folder
# Remaining Problem: when a new svn folder is added after this initial setup to the local subversion repo,
#   that folder must manually chown to www-data; else svn co post-commit errors will occur.
cd ${wikipath}
sudo mkdir TEMP-LOCAL-svn; ## temp folder
sudo svn checkout file:///var/lib/svn/LocalSVNextensions ./TEMP-LOCAL-svn
sudo chown -R  www-data.www-data ./TEMP-LOCAL-svn
sudo mv ./TEMP-LOCAL-svn/* ./extensions; sudo mv ./TEMP-LOCAL-svn/.svn ./extensions
sudo rm ./TEMP-LOCAL-svn -r
# 4.b LATER SVN-Extension UPDATING (required ALTERNATIVE to 4.a)
# 3. Update from LOCAL-svn with:
cd ${wikipath}extensions; sudo /usr/bin/svn update;
# 5. Finishing touches. Widgets needs a writable folder:
cd ${wikipath}
sudo chown -R  www-data.www-data ./extensions/Widgets/compiled_templates; 
# Widgets does not contain all necessary code (-> Warning: require_once(/usr/share/mediawiki20/phase3/extensions/Widgets/smarty/Smarty.class.php): failed to open stream: No such file or directory...)
# In the absence of installation instructions, using previously saved code: 
sudo cp -r /usr/share/mw-missing-code/Widgets/smarty ./extensions/Widgets
sudo cp -r /usr/share/mw-missing-code/Widgets/googlecode ./extensions/Widgets


Setting primary git clone checkout to version for testing

BELOW IS OLD CODE. PROBLEM: extension is not inside core, but side-by-side. needs probably symlink? Not yet installed as testwiki.

 cd /usr/share/mw-wmf-clone/core; sudo git checkout origin/REL1_20
 # SMW extensions:
 # find tags online: https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/SemanticMediaWiki.git;a=tags
 # or on command line: git tag -l | sort --version-sort
 cd /usr/share/mw-wmf-clone/extensions/SemanticMediaWiki; sudo git checkout tags/1.8
 cd /usr/share/mw-wmf-clone/extensions/SemanticCompoundQueries; sudo git checkout tags/0.3.4
 cd /usr/share/mw-wmf-clone/extensions/SemanticDrilldown; sudo git checkout tags/1.2.4


NEW: Testing new wikis

For the moment the testwiki_v20 symlinks go to /usr/share/mediawiki20, copy 1.20 version above to there (quicker than changing all symlinks...)

 sudo cp -r /usr/share/mw1.20 /usr/share/mediawiki20
 cd /var/www/testwiki_v20;        sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php 
 cd /var/www/testwiki_v20;        sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
 ## cd /var/www/v-practicalplants/w; sudo -u www-data php ./maintenance/update.php  --quick --conf ./LocalSettings.php
 sudo /usr/sbin/apache2ctl -k graceful  && sudo /etc/init.d/nginx restart

Test location is http://biowikifarm.net/test_v20/Main_Page (temp also: also http://biowikifarm.net/test_v18/Main_Page = test with normal staging version, just for identical web server setup)

Possible errors that could be resolved (notes for migration of production wikis):

  • "Database returned error "1170: BLOB/TEXT column 'acr_email' used in key specification without a key length (localhost)" occurred in earlier test. This may or may not re-occur when migrating the production wikis!
    • creating a new db with all shared tables locally and a setting in LocalSettings: $wgSharedTables = array("interwiki"); did not help.
    • Changed field type, see [1]* ./maintenance/update.php running through.
  • Note: as of 2012-12-12: SemanticInternalObjects is now working.
  • SemanticForms was still breaking on main page and Special:Version with "Fatal error: Class 'SMWSQLStore3' not found in /usr/share/mediawiki20/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php on line 286. This was caused by enabledSemantic not being properly called for this specific test wiki (the other wikis were ok, so it was a config error).
  • A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

SELECT smw_id,smw_sortkey FROM `smw_object_ids` WHERE smw_title = 'Ns:widget' AND smw_namespace = '10' AND smw_iw = AND smw_subobject = LIMIT 1 from within function "SMWSql3SmwIds::getDatabaseIdAndSort". Database returned error "1146: Table 'testwiki20.smw_object_ids' doesn't exist (localhost)". FIXED WITH:

cd /var/www/testwiki_v20
sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php
sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -ftpv --conf ./LocalSettings.php
# the next step can be time-consuming:
sudo -u www-data php ./extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -v --conf ./LocalSettings.php
sudo -u www-data php ./maintenance/runJobs.php -v --procs 4 --conf ./LocalSettings.php

Testwiki 1.20 is working now.