Difference between revisions of "Mediawiki installation/Version 1.23.8"
m (→WIKI_SOURCE_LTS Extensions: fix empty ext) |
m |
||
(37 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
See also http://biowikifarm.net/meta/Mediawiki_installation#Cloning_a_new_wiki | See also http://biowikifarm.net/meta/Mediawiki_installation#Cloning_a_new_wiki | ||
Approach: | Approach: | ||
− | * have | + | * have a MediaWiki Git clone |
− | * | + | * extract from the MediaWiki Git clone MW version, e.g. a ''L''ong ''T''erm ''S''upport (LTS) |
− | * install WEB_WIKI | + | * extract (correct versions of) extensions for the wiki version |
− | Schema: | + | * install a new WEB_WIKI using a Database template |
+ | |||
+ | Schema and file structure on the server: | ||
<div class="pre-border-top-bottom-only pre-no-background"> | <div class="pre-border-top-bottom-only pre-no-background"> | ||
+ | Schema Path or Link: | ||
MW_WMF_CLONE /usr/share/mw-wmf-clone | MW_WMF_CLONE /usr/share/mw-wmf-clone | ||
├ core (Git) ─────────git-archive-export───┐ /usr/share/mw-wmf-clone/core | ├ core (Git) ─────────git-archive-export───┐ /usr/share/mw-wmf-clone/core | ||
└ extensions (Git) ───git-archive-export─→ ) ─┐ /usr/share/mw-wmf-clone/extensions | └ extensions (Git) ───git-archive-export─→ ) ─┐ /usr/share/mw-wmf-clone/extensions | ||
│ │ | │ │ | ||
− | + | USR_SHARE_WIKI (e.g. REL1_23) │ │ | |
┌ core-files (local git archive-export) ←┘ │ /usr/share/mediawiki23 | ┌ core-files (local git archive-export) ←┘ │ /usr/share/mediawiki23 | ||
├ extensions (mixed: │ /usr/share/mediawiki23/extensions | ├ extensions (mixed: │ /usr/share/mediawiki23/extensions | ||
│ svn biowikifarm, (repo: as svn-post-commit) | │ svn biowikifarm, (repo: as svn-post-commit) | ||
│ git-archive-export) ←──────────────────┘ | │ git-archive-export) ←──────────────────┘ | ||
− | |||
↓ | ↓ | ||
│ WEB_WIKI (as LTS web Wiki) | │ WEB_WIKI (as LTS web Wiki) | ||
− | ├─→ core-files (linked) /var/www/v- | + | ├─→ core-files (linked) /var/www/v-xxx/d/ |
− | └─→ extensions (linked) /var/www/v- | + | └─→ extensions (linked) /var/www/v-xxx/d/extensions |
− | composer-extensions must be dealt with /var/www/v- | + | composer-extensions must be dealt with /var/www/v-xxx/d/composer.json |
on level WEB_WIKI individually | on level WEB_WIKI individually | ||
</div> | </div> | ||
− | == Git | + | == Git Short Help == |
<syntaxhighlight lang="bash" class="pre-border-top-bottom-only pre-no-background"> | <syntaxhighlight lang="bash" class="pre-border-top-bottom-only pre-no-background"> | ||
Line 43: | Line 45: | ||
− | == Script(ed) | + | == Script(ed) Installation == |
− | + | The following scripts are not intended to be run at once but ''step'' by ''step'' or just partially!! | |
+ | * most scripts that follow depend on settings in section of [[#global_variables_settings|Global Variables]] | ||
− | === “Global Variables” === | + | Try to install it from scratch |
+ | * use the architecture of the provided MW version directly to install a WEB_WIKI instead of a directory template, because each MW version might have a new architecture | ||
+ | |||
+ | === Tips for an Upgrade === | ||
+ | |||
+ | This documentation is just for the first install ''not'' for an upgrade, but for an upgrade the following approach can be a good strategy: | ||
+ | * do not upgrade the old WEB_WIKI directly but | ||
+ | * install a new WEB_WIKI version that will replace later on the old production WEB_WIKI | ||
+ | * copy the old LocalSettings.php to your new WEB_WIKI and adjust it | ||
+ | * if you think you can upgrade: | ||
+ | *# rename the folders: old production WEB_WIKI becomes a backup WEB_WIKI, the new-WEB_WIKI becomes the new production WEB_WIKI | ||
+ | *# run the update.php script in maintenance folder for the new production WEB_WIKI | ||
+ | |||
+ | This upgrade strategy ensures, that the new production WEB_WIKI has a clean architecture and for any problems you can roll back rather easily. | ||
+ | |||
+ | |||
+ | === “Global Variables” {{anchor|global_variables_settings}} === | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 61: | Line 80: | ||
git_mw_basedir="/usr/share/mw-wmf-clone" | git_mw_basedir="/usr/share/mw-wmf-clone" | ||
git_mw_core_source_dir="${git_mw_basedir}/core" | git_mw_core_source_dir="${git_mw_basedir}/core" | ||
− | + | git_mw_extension_resource_dir="${git_mw_basedir}/extensions" | |
git_branch="origin/REL1_23" | git_branch="origin/REL1_23" | ||
git_tag="1.23.8" | git_tag="1.23.8" | ||
− | + | # naming convention | |
− | + | # path: is the absolute path, has NO trailing slash | |
− | + | # directory: a *single* directory | |
− | web_wiki_config_folder=" | + | # web_wiki_config_folder="/mw-config" # default /mw-config must e removed for security reasons |
− | + | vhost_path="/var/www/v-infoflora" | |
− | + | vhost_wiki_path="${vhost_path}/d" | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | usr_share_wiki_path="/usr/share/mediawiki23" | |
− | + | usr_share_extension_path="${usr_share_wiki_path}/extensions" | |
− | # echo "$ | + | # echo "$usr_share_extension_path" |
− | + | printf "\e[47mBase directory of the Wiki will be: \e[42m'%s'\e[0m\n" "${vhost_wiki_path}" | |
− | printf "\e[47mBase directory of the Wiki will be: \e[42m'%s'\e[0m\n" "${ | + | |
echo -e "\e[31m$install_notice\e[0m" | echo -e "\e[31m$install_notice\e[0m" | ||
# end of global variables | # end of global variables | ||
Line 91: | Line 104: | ||
Possible approaches after upgrading the MW_WMF_CLONE | Possible approaches after upgrading the MW_WMF_CLONE | ||
− | * checkout a LTS-branch and copy these sources to | + | * checkout a LTS-branch and copy these sources to USR_SHARE_WIKI |
− | * export by <code>git archive <tag-or-branch-or-tree-ish></code> to | + | * export by <code>git archive <tag-or-branch-or-tree-ish></code> to USR_SHARE_WIKI |
− | Upgrade wmf-git-clone | + | Upgrade wmf-git-clone manually |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ||
cd "${git_mw_core_source_dir}"; | cd "${git_mw_core_source_dir}"; | ||
sudo git pull; | sudo git pull; | ||
− | git branch - | + | echo "# List branches (${git_mw_core_source_dir}) …" |
− | git tag - | + | git branch --remotes | sort --version-sort # list branches |
− | cd "${ | + | echo "# List tags (${git_mw_core_source_dir}) …" |
− | sudo git pull; sudo git submodule update --init --recursive; | + | git tag --list | sort --version-sort # list tags |
− | git branch - | + | cd "${git_mw_extension_resource_dir}"; |
− | git tag - | + | sudo git pull; sudo git submodule update --init --recursive; # git submodule update does not fetch new branches but ./quick-update does |
+ | if [ -e ${git_mw_extension_resource_dir}/quick-update ];then | ||
+ | echo "# Update all extensions in ${git_mw_extension_resource_dir} …" | ||
+ | sudo ${git_mw_extension_resource_dir}/quick-update | ||
+ | fi; | ||
+ | echo "# List branches (${git_mw_extension_resource_dir}) …" | ||
+ | git branch --remotes | sort --version-sort # list branches | ||
+ | echo "# List tags (${git_mw_extension_resource_dir}) …" | ||
+ | git tag --list | sort --version-sort # list tags | ||
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | <blockquote> | ||
Checkout a branch | Checkout a branch | ||
− | + | '''can be skipped:''' this makes only sense, if you want to use just ''one'' MW version as source base. The subsequent approach instead uses an export of a specific branch or tag from the MW_WMF_CLONE. | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ||
Line 118: | Line 140: | ||
# git tag -l | sort --version-sort # list tags | # git tag -l | sort --version-sort # list tags | ||
if [ "$do_not_install_but_show_dry_run" == "" ]; then | if [ "$do_not_install_but_show_dry_run" == "" ]; then | ||
− | sudo -u root -g mwadmin git checkout -b $git_branch $git_tag | + | sudo -u root -g mwadmin git checkout -b $git_branch |
+ | # sudo -u root -g mwadmin git checkout $git_tag | ||
fi | fi | ||
printf "\e[47mgit clone in '\e[42m%s\e[47m' is checkout to branch: '%s' tag: '%s'\e[0m\n" "${git_mw_core_source_dir}" "$git_branch" "$git_tag" | printf "\e[47mgit clone in '\e[42m%s\e[47m' is checkout to branch: '%s' tag: '%s'\e[0m\n" "${git_mw_core_source_dir}" "$git_branch" "$git_tag" | ||
− | cd "${ | + | cd "${git_mw_extension_resource_dir}" |
# git branch -r | sort --version-sort # list branches | # git branch -r | sort --version-sort # list branches | ||
# git tag -l | sort --version-sort # list tags | # git tag -l | sort --version-sort # list tags | ||
# extensions seem to have no tags | # extensions seem to have no tags | ||
if [ "$do_not_install_but_show_dry_run" == "" ]; then | if [ "$do_not_install_but_show_dry_run" == "" ]; then | ||
− | sudo -u root -g mwadmin git checkout -b $git_branch | + | sudo -u root -g mwadmin git checkout -b "$git_branch" |
fi | fi | ||
− | printf "\e[47mgit clone in '\e[42m%s\e[47m' is checkout to branch: '%s' (extensions seem to have no global tags)\e[0m\n" "${ | + | printf "\e[47mgit clone in '\e[42m%s\e[47m' is checkout to branch: '%s' (extensions seem to have no global tags)\e[0m\n" "${git_mw_extension_resource_dir}" "$git_branch" |
# end checkout of git clone in git_mw_basedir | # end checkout of git clone in git_mw_basedir | ||
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | === MW_WMF_CLONE → | + | </blockquote> |
+ | |||
+ | === MW_WMF_CLONE → USR_SHARE_WIKI === | ||
* Create a MediaWiki versioned source (the source of a LTS-version) | * Create a MediaWiki versioned source (the source of a LTS-version) | ||
− | * Create extension sources, extract Git extensions to | + | * Create extension sources, extract Git extensions to USR_SHARE_WIKI |
** biowikifarm extensions | ** biowikifarm extensions | ||
** no further developed extension still necessary fro biowikifarm | ** no further developed extension still necessary fro biowikifarm | ||
** Git extensions from MW_WMF_CLONE | ** Git extensions from MW_WMF_CLONE | ||
− | ==== | + | ==== USR_SHARE_WIKI Core Files ==== |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ||
# create MediaWiki versioned source (the source of a LTS-version) | # create MediaWiki versioned source (the source of a LTS-version) | ||
− | if ! [ -d "${ | + | if ! [ -d "${usr_share_wiki_path}" ]; then |
if [ "$do_not_install_but_show_dry_run" == "" ]; then | if [ "$do_not_install_but_show_dry_run" == "" ]; then | ||
− | sudo -u root -g mwadmin mkdir --parent "${ | + | sudo -u root -g mwadmin mkdir --parent "${usr_share_wiki_path}" |
fi | fi | ||
− | echo -e "\e[47mCreate wiki source directory ($git_branch): \e[42m'${ | + | echo -e "\e[47mCreate wiki source directory ($git_branch): \e[42m'${usr_share_wiki_path}'\e[0m" |
else | else | ||
− | echo -e "\e[47mWiki wiki source directory ($git_branch) exits already: \e[42m'${ | + | echo -e "\e[47mWiki wiki source directory ($git_branch) exits already: \e[42m'${usr_share_wiki_path}'\e[0m" |
fi | fi | ||
− | echo -e "\e[47mCheck also release notes, e.g. \e[42m'${ | + | echo -e "\e[47mCheck also release notes, e.g. \e[42m'${usr_share_wiki_path}/RELEASE-NOTES-X.XX'\e[0m" |
# cd "${git_mw_core_source_dir}" | # cd "${git_mw_core_source_dir}" | ||
Line 164: | Line 189: | ||
if [ "$do_not_install_but_show_dry_run" == "" ]; then | if [ "$do_not_install_but_show_dry_run" == "" ]; then | ||
# EXAMPLE: sudo git archive origin/REL1_23 | sudo -u root -g mwadmin tar --extract --overwrite --directory=/usr/share/mediawiki23 | # EXAMPLE: sudo git archive origin/REL1_23 | sudo -u root -g mwadmin tar --extract --overwrite --directory=/usr/share/mediawiki23 | ||
− | cd "${git_mw_core_source_dir}" && sudo git archive $git_tag | sudo -u root -g mwadmin tar --extract --overwrite --directory="${ | + | cd "${git_mw_core_source_dir}" && sudo git archive "$git_tag" | sudo -u root -g mwadmin tar --extract --overwrite --directory="${usr_share_wiki_path}" |
− | if [ -d "${ | + | if [ -d "${usr_share_extension_path}" ]; then |
− | sudo chown root:www-data -R "${ | + | sudo chown root:www-data -R "${usr_share_extension_path}" |
fi | fi | ||
else | else | ||
− | echo "cd \"${git_mw_core_source_dir}\" && sudo git archive $git_tag | sudo -u root -g mwadmin tar --extract --overwrite --directory=\"${ | + | echo "cd \"${git_mw_core_source_dir}\" && sudo git archive \"$git_tag\" | sudo -u root -g mwadmin tar --extract --overwrite --directory=\"${usr_share_wiki_path}\"" |
fi | fi | ||
− | # cd "${ | + | # cd "${git_mw_extension_resource_dir}" |
# ls -l | # ls -l | ||
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | ==== | + | ==== USR_SHARE_WIKI Extensions ==== |
− | + | Get information on status of extensions, either git tags or git branch needed later for installation of a LTS-version. | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | # | + | #!/bin/bash |
− | # | + | # @name: write_wmf-shared_git-branches-tags2home_ext-tags-and-branches.sh |
− | + | # @description: 1. INFORMATION ONLY: (Run as a script not by copy and paste) | |
− | + | # LIST (and write to file) git tags / git branches of all extensions | |
− | + | # Write into file in the user's home folder | |
− | + | # (Note: Ignore error about /mw-wmf-clone/extensions/extensions) | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | if ! [ -d /usr/share/mw-wmf-clone/extensions ];then | |
− | # | + | echo "# Stop: /usr/share/mw-wmf-clone/extensions dos not exist (stop here. exit: 1)" |
− | IFS=$'\n'; # | + | exit 1; |
− | + | else | |
− | printf "%s" "$ | + | echo '# Write git tags and branches to ~/ext_tags_and_branches.txt' |
− | + | fi | |
− | + | ||
− | + | printf "\n" > ~/"ext_tags_and_branches.txt"; | |
+ | IFS=$'\n'; # change internal Field Separator to newline only; test: printf %q "$IFS"; default $' \t\n' | ||
+ | all_wmf_extensions=`find /usr/share/mw-wmf-clone/extensions -maxdepth 1 -type d -printf "%f\n" | sort` | ||
+ | n_maxchar_ext=`echo "$all_wmf_extensions" | wc --max-line-length` | ||
+ | n_ext=` echo "$all_wmf_extensions" | wc --lines` | ||
+ | i_ext=1 | ||
+ | for this_ext in `find /usr/share/mw-wmf-clone/extensions -maxdepth 1 -type d -printf "%f\n" | sort`; do | ||
+ | if [ -d "/usr/share/mw-wmf-clone/extensions/$this_ext" ]; then | ||
+ | printf "# extension (%3d of %3d) %-${n_maxchar_ext}s: append git branch/tag into your home directory: '~/ext_tags_and_branches.txt'\n" "$i_ext" "$n_ext" "'$this_ext'" | ||
+ | printf "\n%s" "$this_ext" >> ~/"ext_tags_and_branches.txt"; | ||
+ | cd "/usr/share/mw-wmf-clone/extensions/$this_ext"; | ||
+ | # List all extensions with their branches, write into same file | ||
+ | branches=""; branches=`git branch --remotes | sort --version-sort --ignore-case | sed 's@^ \+\(.\+\)[ ]*$@\1@;$!{ s@$@,@;}' | fmt - | sed 's@^\(.\+\)@ \1@;'` | ||
+ | if [ "$branches" != "" ]; then | ||
+ | printf "\n branches:\n%s" "$branches" >> ~/"ext_tags_and_branches.txt"; | ||
+ | else | ||
+ | printf "\n" >> ~/"ext_tags_and_branches.txt"; | ||
+ | fi | ||
+ | # List all extensions with their tags, write into same file | ||
+ | tags=""; tags=`git tag --list | sort --version-sort --ignore-case | sed 's@^ \+\(.\+\)[ ]*$@\1@;$!{ s@$@,@;}' | fmt - | sed 's@^\(.\+\)@ \1@;'` ; | ||
+ | if [ "$tags" != "" ]; then | ||
+ | printf "\n tags:\n%s" "$tags" >> ~/"ext_tags_and_branches.txt"; | ||
+ | else | ||
+ | printf "\n" >> ~/"ext_tags_and_branches.txt"; | ||
+ | fi | ||
+ | fi | ||
+ | i_ext=$((i_ext + 1)) | ||
done; | done; | ||
− | + | cd /usr/share/mw-wmf-clone/extensions | |
IFS=$' \t\n'; | IFS=$' \t\n'; | ||
− | # end | + | # end list extensions' tags and branches |
− | + | ||
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | Extract the right branch or tag of an extension from MW_WMF_CLONE for this | + | Extract the right branch or tag of an extension from MW_WMF_CLONE for this USR_SHARE_WIKI. Note, the list of EXTENSIONS may not be complete but it seems unnecessary to extract all 663 extensions shipped with the wmf git clone. |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
####################################### | ####################################### | ||
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ||
− | # create sources for LTS-MediaWiki | + | # create extensions sources for LTS-MediaWiki |
+ | # DEPENDENCIES: global variables | ||
# IMPORTANT: extensions managed by PHP script composer.phar | # IMPORTANT: extensions managed by PHP script composer.phar | ||
− | # must be dealt with individually on the level WEB_WIKI | + | # must be dealt with individually on the level WEB_WIKI |
− | # | + | # NOTE: this script part might be run better from a script file directly |
− | # basic extensions from a v1.23.8 tar.gz download are: | + | # because paste and copy can cause troubles: the terminal seams limited |
+ | # to a certain string length | ||
+ | # NOTE: basic extensions from a v1.23.8 tar.gz download are: | ||
# Cite, ConfirmEdit, Gadgets, ImageMap, InputBox, Interwiki, LocalisationUpdate, | # Cite, ConfirmEdit, Gadgets, ImageMap, InputBox, Interwiki, LocalisationUpdate, | ||
# Nuke, ParserFunctions, Poem, Renameuser, SpamBlacklist, SyntaxHighlight_GeSHi, | # Nuke, ParserFunctions, Poem, Renameuser, SpamBlacklist, SyntaxHighlight_GeSHi, | ||
Line 276: | Line 320: | ||
WikimediaMessages | WikimediaMessages | ||
" | " | ||
+ | |||
+ | # -------------------------------------- | ||
+ | # split extension on ", ". If extension sting contains only one value | ||
+ | # * export $git_branch, | ||
+ | # * else export the specified string above as $this_clone_version | ||
+ | # (the so-called tree-ish string, usually a tag or branch or anything the *developers* had defined) | ||
+ | # Example: | ||
+ | # SemanticMediaWiki, 1.8 | ||
+ | # ↓ ↓ | ||
+ | # $extension, $this_clone_version | ||
+ | # will export 1.8 (which the developers have defined as a tag) | ||
+ | # NOTE: check the line (similar to ternary operator: condition ? do-this : do-other-things) | ||
+ | # $( … ) substitutes/returns the command's output | ||
+ | # → if ext-check-with-comma == ext then (&&) "HEAD" else (||) version-string-from-above-list-of-EXTENSIONS | ||
+ | # ${ext%,*} from back of $ext → delete shortest (%) or longest (%%) match | ||
+ | # ${ext#*,* } from front of $ext → delete shortest (#) or longest (##) match | ||
+ | # -------------------------------------- | ||
this_ext_update_status="" | this_ext_update_status="" | ||
− | + | IFS=$'\n'; # set Internal Field Separator in for loop to newline '\n' only! Deafult $IFS is ' \t\n': «printf %q "$IFS"» | |
− | + | for ext in $EXTENSIONS; do | |
if [ "${ext}" ];then | if [ "${ext}" ];then | ||
− | + | this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext%%,*}"); | |
− | + | this_clone_version=$([ "${ext%,*}" == "$ext" ] && echo "$git_branch" || echo "${ext#*, }"); | |
− | + | if ! [ -d "${git_mw_extension_resource_dir}/${this_extension}" ]; then | |
− | + | echo "${git_mw_extension_resource_dir}/${this_extension} DOES NOT EXIST AS GIT SOURCE, check the extension's name or path!! (extension was skipped)"; | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext% | + | |
− | this_clone_version=$([ "${ext%,*}" == "$ext" ] && echo "$git_branch" || echo "${ext#*, | + | |
− | if ! [ -d "${ | + | |
− | echo "${ | + | |
else | else | ||
− | if [ ! -d "${ | + | if [ ! -d "${usr_share_extension_path}/${this_extension}" ]; then |
this_ext_update_status="+"; | this_ext_update_status="+"; | ||
if [ "$do_not_install_but_show_dry_run" == "" ]; then | if [ "$do_not_install_but_show_dry_run" == "" ]; then | ||
− | sudo mkdir --parents "${ | + | sudo mkdir --parents "${usr_share_extension_path}/${this_extension}"; |
− | sudo chown www-data:www-data "${ | + | sudo chown www-data:www-data "${usr_share_extension_path}/${this_extension}"; |
else | else | ||
− | echo "sudo mkdir --parents \"${ | + | echo "sudo mkdir --parents \"${usr_share_extension_path}/${this_extension}\"; # add $this_ext_update_status;" |
− | echo "sudo chown www-data:www-data \"${ | + | echo "sudo chown www-data:www-data \"${usr_share_extension_path}/${this_extension}\";" |
fi; | fi; | ||
else | else | ||
Line 312: | Line 361: | ||
printf "git archive export: %1s %-30s %s\n" $this_ext_update_status $this_extension $this_clone_version; | printf "git archive export: %1s %-30s %s\n" $this_ext_update_status $this_extension $this_clone_version; | ||
if [ "$do_not_install_but_show_dry_run" == "" ]; then | if [ "$do_not_install_but_show_dry_run" == "" ]; then | ||
− | # EXAMPLE: sudo git archive --prefix=AdminLinks/ HEAD | sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki23/extensions | + | if [ -d "${git_mw_extension_resource_dir}/${this_extension}" ];then |
− | + | cd "${git_mw_extension_resource_dir}/${this_extension}" | |
− | + | AVAILABLE_CLONE_VERSIONS=`git branch -r | sort --version-sort` | |
+ | if [ "`echo "$AVAILABLE_CLONE_VERSIONS" | grep --count "$this_clone_version" `" == "0" ]; then | ||
+ | echo "Clone version $this_clone_version not available!! Check these (git branch -r | sort --version-sort):"; | ||
+ | echo "$AVAILABLE_CLONE_VERSIONS"; | ||
+ | else | ||
+ | echo "No clone version available"; | ||
+ | fi; | ||
+ | # EXAMPLE: sudo git archive --prefix=AdminLinks/ HEAD | sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki23/extensions | ||
+ | sudo git archive --prefix="${this_extension}/" "$this_clone_version" | sudo -u www-data tar --extract --overwrite --directory="${usr_share_extension_path}"; | ||
+ | else | ||
+ | echo "Sorce not found: \"${git_mw_extension_resource_dir}/${this_extension}\" " | ||
+ | fi; | ||
else | else | ||
− | echo "cd \"${ | + | echo "cd \"${git_mw_extension_resource_dir}/${this_extension}\" && sudo git archive --prefix=\"${this_extension}/\" \"$this_clone_version\" | sudo -u www-data tar --extract --overwrite --directory=\"${usr_share_extension_path}\";" |
fi; | fi; | ||
fi; | fi; | ||
fi; | fi; | ||
− | + | done; | |
− | + | IFS=$' \t\n'; | |
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ||
− | ####################################### | + | ####################################### |
</syntaxhighlight> | </syntaxhighlight> | ||
===== Unsupported extensions (svn) ===== | ===== Unsupported extensions (svn) ===== | ||
− | + | https://www.mediawiki.org/wiki/Extension:StringFunctions is no more supported see [[#StringFunctions enable|Installation Issues, Problems, Transition form Older Wikis (StringFunctions)]]. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | # | + | |
− | + | ||
− | + | ||
===== Biowikifarm extensions (svn) ===== | ===== Biowikifarm extensions (svn) ===== | ||
Line 342: | Line 395: | ||
####################################### | ####################################### | ||
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ||
− | # subversion | + | # subversion STEP 1: biowikifarm extensions to ${usr_share_extension_path} |
− | cd "${ | + | cd "${usr_share_extension_path}"; |
− | sudo -u www-data -g www-data svn checkout file:///var/lib/svn/LocalSVNextensions "${ | + | sudo -u www-data -g www-data svn checkout file:///var/lib/svn/LocalSVNextensions "${usr_share_extension_path}"; |
− | # subversion | + | # subversion STEP 2 |
# create post hook commit to the MediaWiki LTS source | # create post hook commit to the MediaWiki LTS source | ||
− | # file sudo | + | # open file |
+ | # sudo nano /var/lib/svn/hooks/post-commit | ||
#!/bin/bash | #!/bin/bash | ||
if [ -d "/usr/share/mediawiki23/extensions" ]; then | if [ -d "/usr/share/mediawiki23/extensions" ]; then | ||
− | echo -en "\n\npost-commit mediawiki23/extensions (r${REV})\n" >> "${LOGFILE}" | + | echo -en "\n\npost-commit mediawiki23/extensions (r${REV})\n" >> "${LOGFILE}"; |
− | cd /usr/share/mediawiki23/extensions | + | cd /usr/share/mediawiki23/extensions; |
echo "try to get /usr/bin/svn update >> \"${LOGFILE}\"" >> "${LOGFILE}"; | echo "try to get /usr/bin/svn update >> \"${LOGFILE}\"" >> "${LOGFILE}"; | ||
− | /usr/bin/svn update >> "${LOGFILE}" | + | /usr/bin/svn update >> "${LOGFILE}"; |
− | echo -ne " (done)\n" >> "${LOGFILE}" | + | echo -ne " (done)\n" >> "${LOGFILE}"; |
fi | fi | ||
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ||
Line 361: | Line 415: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | === | + | === USR_SHARE_WIKI → WEB_WIKI === |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ||
# STEP create web wiki directory | # STEP create web wiki directory | ||
− | if ! [ -d "${ | + | if ! [ -d "${vhost_wiki_path}" ]; then |
− | echo -e "\e[47mCreate wiki web base directory (sudo): \e[42m'${ | + | echo -e "\e[47mCreate wiki web base directory (sudo): \e[42m'${vhost_wiki_path}'\e[0m" |
if [ "$do_not_install_but_show_dry_run" == "" ]; then | if [ "$do_not_install_but_show_dry_run" == "" ]; then | ||
− | sudo -u root -g mwadmin mkdir --parent "${ | + | sudo -u root -g mwadmin mkdir --parent "${vhost_wiki_path}" |
− | # sudo chown root:mwadmin "${ | + | # sudo chown root:mwadmin "${vhost_wiki_path}" -R |
else | else | ||
− | echo "sudo -u root -g mwadmin mkdir --parent \"${ | + | echo "sudo -u root -g mwadmin mkdir --parent \"${vhost_wiki_path}\"" |
fi | fi | ||
else | else | ||
− | echo -e "\e[47mWiki web base directory exits already: \e[42m'${ | + | echo -e "\e[47mWiki web base directory exits already: \e[42m'${vhost_wiki_path}'\e[0m" |
fi | fi | ||
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | ==== OpenMedia Symlink ==== | + | ==== OpenMedia, SpecialMedia Symlink ==== |
+ | |||
+ | This may be skipped, because the NGINX configuration can catch URLs and redirect directly to the OpenMedia directory without a symlink but due to the Same-Origin-Policy (SOP) it is done here. Extension:MultimediaViewer complains about Cross domoain origins of media. | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ||
# STEP create symlink to openmedia | # STEP create symlink to openmedia | ||
− | if ! [ -d "${ | + | if ! [ -d "${vhost_path}/o" ]; then |
− | echo -e "\e[47mCreate Openmedia-symlink \e[42m'${ | + | echo -e "\e[47mCreate Openmedia-symlink \e[42m'${vhost_path}/o'\e[47m → \e[42m'../v-species/o'\e[0m" |
if [ "$do_not_install_but_show_dry_run" == "" ]; then | if [ "$do_not_install_but_show_dry_run" == "" ]; then | ||
− | sudo ln -s "../v-species/o" "${ | + | sudo ln -s "../v-species/o" "${vhost_path}/o" |
− | sudo mkdir "${ | + | sudo mkdir "${vhost_path}/o = Openmedia-symlink" |
− | # sudo chown root:mwadmin "${ | + | # sudo chown root:mwadmin "${vhost_wiki_path}" -R |
else | else | ||
− | echo "sudo ln -s \"../v-species/o\" \"${ | + | echo "sudo ln -s \"../v-species/o\" \"${vhost_path}/o\";" |
fi | fi | ||
else | else | ||
− | echo -e "\e[47mOpenmedia-symlink exits already \e[42m'${ | + | echo -e "\e[47mOpenmedia-symlink exits already \e[42m'${vhost_path}/o'\e[0m" |
+ | fi | ||
+ | if ! [ -d "${vhost_path}/s" ]; then | ||
+ | echo -e "\e[47mCreate Specialmedia-symlink \e[42m'${vhost_path}/s'\e[47m → \e[42m'../v-species/s'\e[0m" | ||
+ | if [ "$do_not_install_but_show_dry_run" == "" ]; then | ||
+ | sudo ln -s "../v-species/s" "${vhost_path}/s" | ||
+ | sudo mkdir "${vhost_path}/s = Specialmedia-symlink" | ||
+ | # sudo chown root:mwadmin "${vhost_wiki_path}" -R | ||
+ | else | ||
+ | echo "sudo ln -s \"../v-species/s\" \"${vhost_path}/s\";" | ||
+ | fi | ||
+ | else | ||
+ | echo -e "\e[47mSpecialmedia-symlink exits already \e[42m'${vhost_path}/s'\e[0m" | ||
fi | fi | ||
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | ==== Link Folders and Files from | + | ==== Link Folders and Files from USR_SHARE_WIKI to WEB_WIKI ==== |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ||
# symbolic links of folders of LTS version | # symbolic links of folders of LTS version | ||
− | # for $ | + | # for $vhost_wiki_path to $usr_share_wiki_path |
− | cd "${ | + | cd "${usr_share_wiki_path}" |
# \( ! -name '.*' \) avoids finding hidden directories | # \( ! -name '.*' \) avoids finding hidden directories | ||
− | for | + | for this_dir in `find . -maxdepth 1 \( ! -name '.*' \) -type d -printf "%f\n"`; do |
− | if ! [ -e "${ | + | if ! [ -e "${vhost_wiki_path}/${this_dir}" ]; then |
− | echo "symbolic link to ${ | + | echo "symbolic link to ${vhost_wiki_path}/${this_dir}" |
− | sudo ln -s "${ | + | sudo ln -s "${usr_share_wiki_path}/${this_dir}" "${vhost_wiki_path}/${this_dir}" |
fi | fi | ||
done | done | ||
# symbolic links of files of LTS version | # symbolic links of files of LTS version | ||
− | cd "${ | + | cd "${usr_share_wiki_path}" |
# \( ! -name '.*' \) avoids finding hidden directories | # \( ! -name '.*' \) avoids finding hidden directories | ||
− | for | + | for this_file in `find . -maxdepth 1 \( ! -name '.*' \) -type f -printf "%f\n"`; do |
− | if ! [ -e "${ | + | if ! [ -e "${vhost_wiki_path}/${this_file}" ]; then |
− | echo "symbolic link to ${ | + | echo "symbolic link to ${vhost_wiki_path}/${this_file}" |
− | sudo ln -s "${ | + | sudo ln -s "${usr_share_wiki_path}/${this_file}" "${vhost_wiki_path}/${this_file}" |
fi | fi | ||
done | done | ||
Line 428: | Line 496: | ||
Cache & media is on a separate partition. Folder extension cannot be a symbolic link because of composer’s management on level WEB_WIKI. | Cache & media is on a separate partition. Folder extension cannot be a symbolic link because of composer’s management on level WEB_WIKI. | ||
+ | |||
+ | NOTE: for linking extensions there are two approches: | ||
+ | # linking the entire extension directory and let composer override some extensions folders managed by composer | ||
+ | # do not link the entire extension directory, take care manually for each extension directory wether it is managed by composer or comes from a USR_SHARE_WIKI-extension (i.e.: do no override USR_SHARE_WIKI-extensions. If composer manages extensions, then you must rename the symlink manually) | ||
+ | |||
+ | Both approaches seems be valid. The second approach was done here. | ||
+ | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ||
# extension: remove symbolic link to folder extensions | # extension: remove symbolic link to folder extensions | ||
− | # no symbolic link to | + | # no symbolic link to usr_share_extension_path |
# because composer.phar handles extension on level WEB_WIKI | # because composer.phar handles extension on level WEB_WIKI | ||
− | sudo rm -i "${ | + | sudo rm -i "${vhost_wiki_path}/extensions" # remove interactively |
− | echo "create ${ | + | echo "create ${vhost_wiki_path}/extensions" |
− | sudo -u root -g www-data mkdir "${ | + | sudo -u root -g www-data mkdir "${vhost_wiki_path}/extensions" |
− | # cache: reroute cache folder to a dump partition | + | # STEP 1 cache: reroute cache folder to a dump partition (specific to biowikifarm) |
− | + | dump_path_for_webwiki="/mnt/dump/var/www/v-infoflora-d-cache"; | |
− | + | vhost_wiki_path="/var/www/v-infoflora/d"; | |
− | echo "create ${ | + | echo "create ${dump_path_for_webwiki}"; |
− | sudo mkdir --parent "${ | + | if ! [ -d "${dump_path_for_webwiki}" ]; then sudo mkdir --parent "${dump_path_for_webwiki}"; fi; |
− | sudo chown www-data:www-data "${ | + | sudo chown www-data:www-data "${dump_path_for_webwiki}"; |
− | sudo chmod 775 -R "${ | + | sudo chmod 775 -R "${dump_path_for_webwiki}"; |
− | echo "remove current ${ | + | echo "remove current ${vhost_wiki_path}/cache"; |
− | sudo rm "${ | + | sudo rm "${vhost_wiki_path}/cache" -r; |
− | echo "make symbolic link ${ | + | echo "make symbolic link ${vhost_wiki_path}/cache → ${dump_path_for_webwiki}"; |
− | sudo ln -s "${ | + | sudo ln -s "${dump_path_for_webwiki}" "${vhost_wiki_path}/cache"; |
− | # images: use media instead, reroute to dump partition | + | # STEP 2 images: use media instead, reroute to dump partition (specific to biowikifarm) |
− | + | dump_path_for_webwiki="/mnt/storage/var-www-v-inflora-d-media"; | |
− | + | vhost_wiki_path="/var/www/v-infoflora/d"; | |
− | echo "remove current ${ | + | echo "remove current ${vhost_wiki_path}/images"; |
− | sudo rm -i "${ | + | sudo rm -i "${vhost_wiki_path}/images" # remove it interactively |
− | echo "create ${ | + | echo "create ${dump_path_for_webwiki}"; |
− | sudo mkdir --parent "${ | + | if ! [ -d "${dump_path_for_webwiki}" ]; then sudo mkdir --parent "${dump_path_for_webwiki}"; fi; |
− | sudo chown www-data:www-data "${ | + | sudo chown www-data:www-data "${dump_path_for_webwiki}"; |
− | sudo chmod 775 -R "${ | + | sudo chmod 775 -R "${dump_path_for_webwiki}"; |
− | echo "make symbolic link ${ | + | echo "make symbolic link ${vhost_wiki_path}/media → ${dump_path_for_webwiki}"; |
− | sudo ln -s "${ | + | sudo ln -s "${dump_path_for_webwiki}" "${vhost_wiki_path}/media"; |
+ | |||
+ | # STEP 3: remove mw-config symlink of web installation folder | ||
+ | sudo rm -i "/var/www/v-infoflora/d/mw-config"; | ||
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | ==== Link Extensions from | + | ==== Link Extensions from USR_SHARE_WIKI to WEB_WIKI ==== |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 482: | Line 560: | ||
TemplateParameterIndex | TemplateParameterIndex | ||
" | " | ||
− | LTS_EXTENSIONS=`echo "${EXTENSIONS}\n${SVN_BIOWIKIFARM_EXTENSIONS}" | sed 's@ *, .*@@g;/^$/d;' | sort --unique` | + | LTS_EXTENSIONS=`echo -e "${EXTENSIONS}\n${SVN_BIOWIKIFARM_EXTENSIONS}" | sed 's@ *, .*@@g;/^$/d;' | sort --unique` |
this_ext_update_status="" | this_ext_update_status="" | ||
− | IFS=$'\n'; # Internal Field Separator | + | IFS=$'\n'; # set Internal Field Separator in for loop to newline '\n' only! Deafult $IFS is ' \t\n': «printf %q "$IFS"» |
for ext in $LTS_EXTENSIONS; do | for ext in $LTS_EXTENSIONS; do | ||
+ | if [ "${ext}" ];then | ||
# ${ext%,*} from back of $ext → delete shortest (%) or (%%) longest match | # ${ext%,*} from back of $ext → delete shortest (%) or (%%) longest match | ||
# ${ext#*,* } from front of $ext → delete shortest (#) or (##) longest match | # ${ext#*,* } from front of $ext → delete shortest (#) or (##) longest match | ||
this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext%*,* *}"); | this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext%*,* *}"); | ||
− | if ! [ -d "${ | + | if ! [ -d "${usr_share_extension_path}/${this_extension}" ]; then |
− | echo "${ | + | echo "${usr_share_extension_path}/${this_extension} DOES NOT EXIST as LTS source, check '${usr_share_extension_path}' (extension was skipped)"; |
else | else | ||
− | if ! [ -e "${ | + | if ! [ -e "${vhost_wiki_path}/extensions/${this_extension}" ]; then |
this_ext_update_status="+"; | this_ext_update_status="+"; | ||
if [ "$do_not_install_but_show_dry_run" == "" ]; then | if [ "$do_not_install_but_show_dry_run" == "" ]; then | ||
− | sudo ln -s "${ | + | sudo ln -s "${usr_share_extension_path}/${this_extension}" "${vhost_wiki_path}/extensions/${this_extension}"; |
else | else | ||
− | echo "sudo ln -s \"${ | + | echo "sudo ln -s \"${usr_share_extension_path}/${this_extension}\" \"${vhost_wiki_path}/extensions/${this_extension}\";"; |
fi | fi | ||
else | else | ||
Line 504: | Line 583: | ||
fi; | fi; | ||
printf "symlink: %1s %-30s\n" $this_ext_update_status $this_extension; | printf "symlink: %1s %-30s\n" $this_ext_update_status $this_extension; | ||
+ | fi; | ||
fi; | fi; | ||
done; | done; | ||
Line 527: | Line 607: | ||
sudo mv composer.phar /usr/local/bin/ | sudo mv composer.phar /usr/local/bin/ | ||
− | # create ${ | + | # create ${vhost_wiki_path}/composer.json |
− | # see ${ | + | # see ${vhost_wiki_path}/composer-example.json |
− | sudo cp "${ | + | sudo cp "${vhost_wiki_path}/composer-example.json" "${vhost_wiki_path}/composer.json" |
− | sudo chown root:mwadmin "${ | + | sudo chown root:mwadmin "${vhost_wiki_path}/composer.json" |
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 546: | Line 626: | ||
# rename e.g. extension SemanticForms folder → SemanticForms_2015-01-15 | # rename e.g. extension SemanticForms folder → SemanticForms_2015-01-15 | ||
# create a file containing all composer commands to be installed manually later on | # create a file containing all composer commands to be installed manually later on | ||
− | cd "${ | + | cd "${vhost_wiki_path}" |
composer_command_file="composer_extensions_to_be_manually_installed.sh" | composer_command_file="composer_extensions_to_be_manually_installed.sh" | ||
# ExtensionName, composer-require-command | # ExtensionName, composer-require-command | ||
Line 558: | Line 638: | ||
PHPExcel, require phpoffice/phpexcel '1.8.0' | PHPExcel, require phpoffice/phpexcel '1.8.0' | ||
" | " | ||
− | echo "Install extensions manually, see '${ | + | echo "Install extensions manually, see '${vhost_wiki_path}/$composer_command_file'"; |
echo "You may check also dependencies manually and rename those extension folders manually too, e.g. SemanticMaps is dependent on Maps"; | echo "You may check also dependencies manually and rename those extension folders manually too, e.g. SemanticMaps is dependent on Maps"; | ||
if [ "$do_not_install_but_show_dry_run" == "" ]; then | if [ "$do_not_install_but_show_dry_run" == "" ]; then | ||
− | sudo /bin/su -c "echo '' > \"${ | + | sudo /bin/su -c "echo '' > \"${vhost_wiki_path}/$composer_command_file\"" |
else | else | ||
− | echo "sudo /bin/su -c \"echo '' > \\\"${ | + | echo "sudo /bin/su -c \"echo '' > \\\"${vhost_wiki_path}/$composer_command_file\\\"\" " |
fi | fi | ||
− | IFS=$'\n'; # Internal Field Separator | + | IFS=$'\n'; # set Internal Field Separator in for loop to newline '\n' only! Deafult $IFS is ' \t\n': «printf %q "$IFS"» |
for ext in $COMPOSER_EXTENSIONS; do | for ext in $COMPOSER_EXTENSIONS; do | ||
+ | if [ "${ext}" ];then | ||
# ${ext%,*} from back of $ext → delete shortest (%) or (%%) longest match | # ${ext%,*} from back of $ext → delete shortest (%) or (%%) longest match | ||
# ${ext#*,* } from front of $ext → delete shortest (#) or (##) longest match | # ${ext#*,* } from front of $ext → delete shortest (#) or (##) longest match | ||
this_composer_command=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext#*,* }"); | this_composer_command=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext#*,* }"); | ||
this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext%*,*}"); | this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext%*,*}"); | ||
− | if [ -h "${ | + | if [ -h "${vhost_wiki_path}/extensions/${this_extension}" ]; then |
− | old_extension_date=`stat --format="%y" "${ | + | old_extension_date=`stat --format="%y" "${vhost_wiki_path}/extensions/${this_extension}" | awk '{ print $1 }'` # e.g 2015-01-15 |
echo "There is already an extension: rename '${this_extension}' to '${this_extension}_${old_extension_date}' " | echo "There is already an extension: rename '${this_extension}' to '${this_extension}_${old_extension_date}' " | ||
if [ "$do_not_install_but_show_dry_run" == "" ]; then | if [ "$do_not_install_but_show_dry_run" == "" ]; then | ||
− | sudo mv "${ | + | sudo mv "${vhost_wiki_path}/extensions/${this_extension}" "${vhost_wiki_path}/extensions/${this_extension}_${old_extension_date}" |
else | else | ||
− | echo "sudo mv \"${ | + | echo "sudo mv \"${vhost_wiki_path}/extensions/${this_extension}\" \"${vhost_wiki_path}/extensions/${this_extension}_${old_extension_date}\"" |
fi | fi | ||
fi | fi | ||
printf "\e[0mFor \e[47m$this_extension\e[0m you may need to remove in \e[47mLocalSettings.php\e[0m the entry \e[42m%s\e[0m\n" "require_once '\$IP/extensions/$this_extension/$this_extension.php'; " | printf "\e[0mFor \e[47m$this_extension\e[0m you may need to remove in \e[47mLocalSettings.php\e[0m the entry \e[42m%s\e[0m\n" "require_once '\$IP/extensions/$this_extension/$this_extension.php'; " | ||
− | printf "Append composer command to \e[42m%s\e[0m\n" "'${ | + | printf "Append composer command to \e[42m%s\e[0m\n" "'${vhost_wiki_path}/$composer_command_file'" |
if [ "$do_not_install_but_show_dry_run" == "" ]; then | if [ "$do_not_install_but_show_dry_run" == "" ]; then | ||
− | sudo /bin/su -c "echo \"sudo php /usr/local/bin/composer.phar $this_composer_command\" >> \"${ | + | sudo /bin/su -c "echo \"sudo php /usr/local/bin/composer.phar $this_composer_command\" >> \"${vhost_wiki_path}/$composer_command_file\"" |
else | else | ||
− | echo "sudo /bin/su -c \"echo \\\"sudo php /usr/local/bin/composer.phar $this_composer_command\\\" >> \\\"${ | + | echo "sudo /bin/su -c \"echo \\\"sudo php /usr/local/bin/composer.phar $this_composer_command\\\" >> \\\"${vhost_wiki_path}/$composer_command_file\\\"\"" |
− | fi | + | fi; |
+ | fi; | ||
done | done | ||
IFS=$' \t\n'; | IFS=$' \t\n'; | ||
Line 592: | Line 674: | ||
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ | ||
− | # commands from manually created file in '${ | + | # commands from manually created file in '${vhost_wiki_path}/$composer_command_file' |
− | cd "${ | + | cd "${vhost_wiki_path}" |
sudo php /usr/local/bin/composer.phar require mediawiki/graph-viz '*' | sudo php /usr/local/bin/composer.phar require mediawiki/graph-viz '*' | ||
sudo php /usr/local/bin/composer.phar require mediawiki/image-map '@dev' | sudo php /usr/local/bin/composer.phar require mediawiki/image-map '@dev' | ||
Line 609: | Line 691: | ||
Set correct rights | Set correct rights | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | sudo chmod 664 "${ | + | if [ -e "${vhost_wiki_path}/LocalSettings.php" ];then |
− | sudo chown root:mwadmin "${ | + | sudo chmod 664 "${vhost_wiki_path}/LocalSettings.php" # rw-rw-r-- |
+ | sudo chown root:mwadmin "${vhost_wiki_path}/LocalSettings.php" | ||
+ | else | ||
+ | echo "Warning: The settings file does not exist yet '${vhost_wiki_path}/LocalSettings.php'" | ||
+ | fi | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 623: | Line 709: | ||
#* see [https://www.mediawiki.org/w/index.php?title=Manual:Shared_database&oldid=962549#Upgrading Manual:Shared database → Upgrading]. ?make use of command line option <code>--doshared</code>? | #* see [https://www.mediawiki.org/w/index.php?title=Manual:Shared_database&oldid=962549#Upgrading Manual:Shared database → Upgrading]. ?make use of command line option <code>--doshared</code>? | ||
# copy old database template (database z_en_template in https://biowikifarm.net/phpmyadmin_v3-3-7/) and adjust it as well as settings for LocalSettings.php | # copy old database template (database z_en_template in https://biowikifarm.net/phpmyadmin_v3-3-7/) and adjust it as well as settings for LocalSettings.php | ||
+ | #* User rightss in the database <code>GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON `my_database` . * TO 'wikiuser'@'localhost';</code> | ||
#* see in <code>MediaWikiCommonSettings.php</code> (some settings there might interfere with MW 1.23 due to software changes) | #* see in <code>MediaWikiCommonSettings.php</code> (some settings there might interfere with MW 1.23 due to software changes) | ||
#* see other files of <code>LocalSettings.php</code> | #* see other files of <code>LocalSettings.php</code> | ||
− | + | ===== Inter-Wiki Language Links ===== | |
+ | |||
+ | Linking to language variants is done by having set URL prefixes on [[Special:Interwiki]] correctly. By default a URL-prefix “de” will automatically add a Language link on the navigation bar of the Wikipage but bear in mind not to share the interwiki table then: | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
− | + | $wgSharedDB = "metawiki"; # Name of user database shared among all wikis. Provides single-identity only, not single-sign-on | |
+ | $wgSharedTables = array("user", "account_credentials", "account_requests"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 654: | Line 744: | ||
* Extension:ContacPage has special installation (MW1.23+) https://www.mediawiki.org/wiki/Extension:ContactPage#Installation | * Extension:ContacPage has special installation (MW1.23+) https://www.mediawiki.org/wiki/Extension:ContactPage#Installation | ||
* Extension:ExpandTemplates is now in MW1.23+ ''core'', separate installation is no longer necessary (<s><code>require_once("…")</code></s>) | * Extension:ExpandTemplates is now in MW1.23+ ''core'', separate installation is no longer necessary (<s><code>require_once("…")</code></s>) | ||
− | |||
* Extension:GlobalUsage has no more class names with underscore. Adjust configuration of $wgLBFactoryConf in LocalSettings.php see also http://noc.wikimedia.org/conf/highlight.php?file=db.php | * Extension:GlobalUsage has no more class names with underscore. Adjust configuration of $wgLBFactoryConf in LocalSettings.php see also http://noc.wikimedia.org/conf/highlight.php?file=db.php | ||
* Extension:Vector is in core MW 1.22+, separate installation is no longer necessary (<s><code>require_once("…")</code></s>) | * Extension:Vector is in core MW 1.22+, separate installation is no longer necessary (<s><code>require_once("…")</code></s>) | ||
Line 665: | Line 754: | ||
Composer extensions see [[#install composer and extensions|above]] | Composer extensions see [[#install composer and extensions|above]] | ||
− | No further development | + | No further development of StringFunctions {{anchor|StringFunctions enable}} |
− | * problem support https://www.mediawiki.org/wiki/Extension:StringFunctionsis terminated | + | * problem support https://www.mediawiki.org/wiki/Extension:StringFunctionsis terminated. Fix it by set <code>$wgPFEnableStringFunctions = true;</code> in ''LocalSettings.php''. |
+ | |||
+ | === Notes on Future Versions of MW === | ||
+ | [https://www.mediawiki.org/w/index.php?title=Download_from_Git&oldid=1390544 MediaWiki 1.24 and later don't include skins in the Git download.] | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | cd "$git_mw_basedir" | ||
+ | git clone https://gerrit.wikimedia.org/r/p/mediawiki/skins.git | ||
+ | # Switch to the skins folder, that was just cloned. To get all the skins use: | ||
+ | git submodule update --init --recursive | ||
+ | </syntaxhighlight> | ||
=== Installation Problems === | === Installation Problems === | ||
Line 681: | Line 779: | ||
*:: <code>$srfgFormats[] = 'exhibit'. in SemanticResultFormats v2.0 causes fatal error</code>, see https://phabricator.wikimedia.org/T59760 | *:: <code>$srfgFormats[] = 'exhibit'. in SemanticResultFormats v2.0 causes fatal error</code>, see https://phabricator.wikimedia.org/T59760 | ||
* Google Maps API Key neccessary? | * Google Maps API Key neccessary? | ||
− | * <gallery> needs a new setting in $wgGalleryOptions for 'mode' otherwise MWException | + | * MW 1.22+ <gallery> needs a new setting in $wgGalleryOptions for 'mode' otherwise MWException |
*: 'mode' => 'traditional', // One of "traditional", "nolines", "packed", "packed-hover", "packed-overlay" | *: 'mode' => 'traditional', // One of "traditional", "nolines", "packed", "packed-hover", "packed-overlay" | ||
+ | * if Extension:TitleKey is active you should run for the first time | ||
+ | <div class="pre-border-top-bottom-only pre-no-background"> | ||
+ | sudo -u www-data php /var/www/v-mywiki/w/extensions/TitleKey/rebuildTitleKeys.php --conf LocalSettings.php | ||
+ | </div> | ||
==== Installation Issues: Semantic MediaWiki ==== | ==== Installation Issues: Semantic MediaWiki ==== | ||
+ | |||
+ | * if you get a <code>*Fatal error*: Call to undefined function enableSemantics()</code> make sure to add it at the end of semantics settigs in <code>LocalSettings.php</code>. The composer’s autoload can fix it but may not be neccesary in later MW Versions (untested, or order in LocalSettings.php may be of importance): | ||
+ | <syntaxhighlight lang="php" style="margin-left:1.5em;"> | ||
+ | if (is_readable("$IP/vendor/autoload.php")) require( "$IP/vendor/autoload.php"); | ||
+ | </syntaxhighlight> | ||
* [https://www.mediawiki.org/wiki/Extension:Semantic_Forms/The_%22edit_with_form%22_tab#Getting_.22edit_with_form.22_to_appear Extension:SemanticForms 3.0+ (edit with form)] the implementation of forms has changed to <nowiki>{{#default_form:form}}</nowiki> | * [https://www.mediawiki.org/wiki/Extension:Semantic_Forms/The_%22edit_with_form%22_tab#Getting_.22edit_with_form.22_to_appear Extension:SemanticForms 3.0+ (edit with form)] the implementation of forms has changed to <nowiki>{{#default_form:form}}</nowiki> | ||
+ | * #set_internal saves differently on a property page "{{ns:property}}:property-name" not just "property-name", has consequences for querying. You could use a count check for the query to see if a property prefix is neccessary: | ||
+ | <div class="pre-border-top-bottom-only pre-no-background" style="margin-left:1.5em;"> | ||
+ | <nowiki>{{#ifexr: {{#ask: [[internal object::{{{property|}}}]]|format=count}}|<!-- no prefix: older SMW -->PAGENAME|<!-- prefix property -->FULLPAGENAME}}</nowiki> | ||
+ | </div> | ||
+ | * [https://www.mediawiki.org/wiki/Extension:Semantic_Drilldown Extension:Semantic Drilldown] 2.0+ sets up drill down by #drilldowninfo and #drilldownlink. Deprecated things: | ||
+ | ** namespace Filter | ||
+ | ** Constants for special properties | ||
+ | |||
+ | |||
[[Category:MediaWiki]] | [[Category:MediaWiki]] | ||
[[Category:MediaWiki Extensions]] | [[Category:MediaWiki Extensions]] | ||
+ | [[Category:Semantic Mediawiki]] | ||
+ | [[Category:Upgrade]] |
Latest revision as of 01:38, 8 February 2016
MediaWiki version 1.23.8 is a long term support version.
Contents
- 1 Architecture
- 2 Git Short Help
- 3 Script(ed) Installation
- 3.1 Tips for an Upgrade
- 3.2 “Global Variables”
- 3.3 MW_WMF_CLONE Upgrade
- 3.4 MW_WMF_CLONE → USR_SHARE_WIKI
- 3.5 USR_SHARE_WIKI → WEB_WIKI
- 4 Nginx Configuration
- 5 Installation Issues, Problems, Transition form Older Wikis
Architecture
See also http://biowikifarm.net/meta/Mediawiki_installation#Cloning_a_new_wiki Approach:
- have a MediaWiki Git clone
- extract from the MediaWiki Git clone MW version, e.g. a Long Term Support (LTS)
- extract (correct versions of) extensions for the wiki version
- install a new WEB_WIKI using a Database template
Schema and file structure on the server:
Schema Path or Link: MW_WMF_CLONE /usr/share/mw-wmf-clone ├ core (Git) ─────────git-archive-export───┐ /usr/share/mw-wmf-clone/core └ extensions (Git) ───git-archive-export─→ ) ─┐ /usr/share/mw-wmf-clone/extensions │ │ USR_SHARE_WIKI (e.g. REL1_23) │ │ ┌ core-files (local git archive-export) ←┘ │ /usr/share/mediawiki23 ├ extensions (mixed: │ /usr/share/mediawiki23/extensions │ svn biowikifarm, (repo: as svn-post-commit) │ git-archive-export) ←──────────────────┘ ↓ │ WEB_WIKI (as LTS web Wiki) ├─→ core-files (linked) /var/www/v-xxx/d/ └─→ extensions (linked) /var/www/v-xxx/d/extensions composer-extensions must be dealt with /var/www/v-xxx/d/composer.json on level WEB_WIKI individually
Git Short Help
#↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
git checkout <branch>
git checkout <tag-name>
git checkout -b <create-new-branch>
git branch -r|--remotes # list all branches
git tag -l|--list # list all tags
git tag -l|--list <pattern> # list tags matching the pattern
git archive <tag-or-branch-or-tree-ish> # extract an archive
#↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
Script(ed) Installation
The following scripts are not intended to be run at once but step by step or just partially!!
- most scripts that follow depend on settings in section of Global Variables
Try to install it from scratch
- use the architecture of the provided MW version directly to install a WEB_WIKI instead of a directory template, because each MW version might have a new architecture
Tips for an Upgrade
This documentation is just for the first install not for an upgrade, but for an upgrade the following approach can be a good strategy:
- do not upgrade the old WEB_WIKI directly but
- install a new WEB_WIKI version that will replace later on the old production WEB_WIKI
- copy the old LocalSettings.php to your new WEB_WIKI and adjust it
- if you think you can upgrade:
- rename the folders: old production WEB_WIKI becomes a backup WEB_WIKI, the new-WEB_WIKI becomes the new production WEB_WIKI
- run the update.php script in maintenance folder for the new production WEB_WIKI
This upgrade strategy ensures, that the new production WEB_WIKI has a clean architecture and for any problems you can roll back rather easily.
“Global Variables”
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# set global variables
do_not_install_but_show_dry_run="" # "" or "anything-but-non-empty"
if [ "$do_not_install_but_show_dry_run" != "" ]; then
install_notice="DRY RUN (nothing is done)";
else
install_notice="INSTALL";
fi
git_mw_basedir="/usr/share/mw-wmf-clone"
git_mw_core_source_dir="${git_mw_basedir}/core"
git_mw_extension_resource_dir="${git_mw_basedir}/extensions"
git_branch="origin/REL1_23"
git_tag="1.23.8"
# naming convention
# path: is the absolute path, has NO trailing slash
# directory: a *single* directory
# web_wiki_config_folder="/mw-config" # default /mw-config must e removed for security reasons
vhost_path="/var/www/v-infoflora"
vhost_wiki_path="${vhost_path}/d"
usr_share_wiki_path="/usr/share/mediawiki23"
usr_share_extension_path="${usr_share_wiki_path}/extensions"
# echo "$usr_share_extension_path"
printf "\e[47mBase directory of the Wiki will be: \e[42m'%s'\e[0m\n" "${vhost_wiki_path}"
echo -e "\e[31m$install_notice\e[0m"
# end of global variables
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
MW_WMF_CLONE Upgrade
Possible approaches after upgrading the MW_WMF_CLONE
- checkout a LTS-branch and copy these sources to USR_SHARE_WIKI
- export by
git archive <tag-or-branch-or-tree-ish>
to USR_SHARE_WIKI
Upgrade wmf-git-clone manually
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
cd "${git_mw_core_source_dir}";
sudo git pull;
echo "# List branches (${git_mw_core_source_dir}) …"
git branch --remotes | sort --version-sort # list branches
echo "# List tags (${git_mw_core_source_dir}) …"
git tag --list | sort --version-sort # list tags
cd "${git_mw_extension_resource_dir}";
sudo git pull; sudo git submodule update --init --recursive; # git submodule update does not fetch new branches but ./quick-update does
if [ -e ${git_mw_extension_resource_dir}/quick-update ];then
echo "# Update all extensions in ${git_mw_extension_resource_dir} …"
sudo ${git_mw_extension_resource_dir}/quick-update
fi;
echo "# List branches (${git_mw_extension_resource_dir}) …"
git branch --remotes | sort --version-sort # list branches
echo "# List tags (${git_mw_extension_resource_dir}) …"
git tag --list | sort --version-sort # list tags
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
Checkout a branch can be skipped: this makes only sense, if you want to use just one MW version as source base. The subsequent approach instead uses an export of a specific branch or tag from the MW_WMF_CLONE.
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ # STEP checkout git clone to git_branch for the subsequent export? # cd "${git_mw_core_source_dir}" # git branch -r | sort --version-sort # list branches # git tag -l | sort --version-sort # list tags if [ "$do_not_install_but_show_dry_run" == "" ]; then sudo -u root -g mwadmin git checkout -b $git_branch # sudo -u root -g mwadmin git checkout $git_tag fi printf "\e[47mgit clone in '\e[42m%s\e[47m' is checkout to branch: '%s' tag: '%s'\e[0m\n" "${git_mw_core_source_dir}" "$git_branch" "$git_tag" cd "${git_mw_extension_resource_dir}" # git branch -r | sort --version-sort # list branches # git tag -l | sort --version-sort # list tags # extensions seem to have no tags if [ "$do_not_install_but_show_dry_run" == "" ]; then sudo -u root -g mwadmin git checkout -b "$git_branch" fi printf "\e[47mgit clone in '\e[42m%s\e[47m' is checkout to branch: '%s' (extensions seem to have no global tags)\e[0m\n" "${git_mw_extension_resource_dir}" "$git_branch" # end checkout of git clone in git_mw_basedir ##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
MW_WMF_CLONE → USR_SHARE_WIKI
- Create a MediaWiki versioned source (the source of a LTS-version)
- Create extension sources, extract Git extensions to USR_SHARE_WIKI
- biowikifarm extensions
- no further developed extension still necessary fro biowikifarm
- Git extensions from MW_WMF_CLONE
USR_SHARE_WIKI Core Files
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# create MediaWiki versioned source (the source of a LTS-version)
if ! [ -d "${usr_share_wiki_path}" ]; then
if [ "$do_not_install_but_show_dry_run" == "" ]; then
sudo -u root -g mwadmin mkdir --parent "${usr_share_wiki_path}"
fi
echo -e "\e[47mCreate wiki source directory ($git_branch): \e[42m'${usr_share_wiki_path}'\e[0m"
else
echo -e "\e[47mWiki wiki source directory ($git_branch) exits already: \e[42m'${usr_share_wiki_path}'\e[0m"
fi
echo -e "\e[47mCheck also release notes, e.g. \e[42m'${usr_share_wiki_path}/RELEASE-NOTES-X.XX'\e[0m"
# cd "${git_mw_core_source_dir}"
# sudo -u root -g mwadmin git checkout -b origin/REL1_23 1.23.8 only from repo clone directly
###
# MediaWiki core files and directories
if [ "$do_not_install_but_show_dry_run" == "" ]; then
# EXAMPLE: sudo git archive origin/REL1_23 | sudo -u root -g mwadmin tar --extract --overwrite --directory=/usr/share/mediawiki23
cd "${git_mw_core_source_dir}" && sudo git archive "$git_tag" | sudo -u root -g mwadmin tar --extract --overwrite --directory="${usr_share_wiki_path}"
if [ -d "${usr_share_extension_path}" ]; then
sudo chown root:www-data -R "${usr_share_extension_path}"
fi
else
echo "cd \"${git_mw_core_source_dir}\" && sudo git archive \"$git_tag\" | sudo -u root -g mwadmin tar --extract --overwrite --directory=\"${usr_share_wiki_path}\""
fi
# cd "${git_mw_extension_resource_dir}"
# ls -l
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
USR_SHARE_WIKI Extensions
Get information on status of extensions, either git tags or git branch needed later for installation of a LTS-version.
#!/bin/bash
# @name: write_wmf-shared_git-branches-tags2home_ext-tags-and-branches.sh
# @description: 1. INFORMATION ONLY: (Run as a script not by copy and paste)
# LIST (and write to file) git tags / git branches of all extensions
# Write into file in the user's home folder
# (Note: Ignore error about /mw-wmf-clone/extensions/extensions)
if ! [ -d /usr/share/mw-wmf-clone/extensions ];then
echo "# Stop: /usr/share/mw-wmf-clone/extensions dos not exist (stop here. exit: 1)"
exit 1;
else
echo '# Write git tags and branches to ~/ext_tags_and_branches.txt'
fi
printf "\n" > ~/"ext_tags_and_branches.txt";
IFS=$'\n'; # change internal Field Separator to newline only; test: printf %q "$IFS"; default $' \t\n'
all_wmf_extensions=`find /usr/share/mw-wmf-clone/extensions -maxdepth 1 -type d -printf "%f\n" | sort`
n_maxchar_ext=`echo "$all_wmf_extensions" | wc --max-line-length`
n_ext=` echo "$all_wmf_extensions" | wc --lines`
i_ext=1
for this_ext in `find /usr/share/mw-wmf-clone/extensions -maxdepth 1 -type d -printf "%f\n" | sort`; do
if [ -d "/usr/share/mw-wmf-clone/extensions/$this_ext" ]; then
printf "# extension (%3d of %3d) %-${n_maxchar_ext}s: append git branch/tag into your home directory: '~/ext_tags_and_branches.txt'\n" "$i_ext" "$n_ext" "'$this_ext'"
printf "\n%s" "$this_ext" >> ~/"ext_tags_and_branches.txt";
cd "/usr/share/mw-wmf-clone/extensions/$this_ext";
# List all extensions with their branches, write into same file
branches=""; branches=`git branch --remotes | sort --version-sort --ignore-case | sed 's@^ \+\(.\+\)[ ]*$@\1@;$!{ s@$@,@;}' | fmt - | sed 's@^\(.\+\)@ \1@;'`
if [ "$branches" != "" ]; then
printf "\n branches:\n%s" "$branches" >> ~/"ext_tags_and_branches.txt";
else
printf "\n" >> ~/"ext_tags_and_branches.txt";
fi
# List all extensions with their tags, write into same file
tags=""; tags=`git tag --list | sort --version-sort --ignore-case | sed 's@^ \+\(.\+\)[ ]*$@\1@;$!{ s@$@,@;}' | fmt - | sed 's@^\(.\+\)@ \1@;'` ;
if [ "$tags" != "" ]; then
printf "\n tags:\n%s" "$tags" >> ~/"ext_tags_and_branches.txt";
else
printf "\n" >> ~/"ext_tags_and_branches.txt";
fi
fi
i_ext=$((i_ext + 1))
done;
cd /usr/share/mw-wmf-clone/extensions
IFS=$' \t\n';
# end list extensions' tags and branches
Extract the right branch or tag of an extension from MW_WMF_CLONE for this USR_SHARE_WIKI. Note, the list of EXTENSIONS may not be complete but it seems unnecessary to extract all 663 extensions shipped with the wmf git clone.
#######################################
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# create extensions sources for LTS-MediaWiki
# DEPENDENCIES: global variables
# IMPORTANT: extensions managed by PHP script composer.phar
# must be dealt with individually on the level WEB_WIKI
# NOTE: this script part might be run better from a script file directly
# because paste and copy can cause troubles: the terminal seams limited
# to a certain string length
# NOTE: basic extensions from a v1.23.8 tar.gz download are:
# Cite, ConfirmEdit, Gadgets, ImageMap, InputBox, Interwiki, LocalisationUpdate,
# Nuke, ParserFunctions, Poem, Renameuser, SpamBlacklist, SyntaxHighlight_GeSHi,
# TitleBlacklist, WikiEditor
EXTENSIONS="
Arrays
BetaFeatures
CategoryTree
CharInsert
Cite
Collection
ConfirmAccount
ConfirmEdit
ContactPage
DataTransfer, 0.6
DismissableSiteNotice
ExternalData, 1.8
Gadgets
HeaderTabs, 1.0.1
ImageMap
InputBox
Interwiki
LiquidThreads
LocalisationUpdate
Lockdown
MassEditRegex
Math
MediaFunctions
MwEmbedSupport
MultimediaViewer
Nuke
OpenID
PageTools, REL_2_0
ParserFunctions
Poem
PdfExport
PdfHandler
Quiz
Renameuser
ReplaceText
SemanticCompoundQueries
SemanticDrilldown
SemanticForms
SemanticFormsInputs
SemanticInternalObjects, 0.8.1
SpamBlacklist
SyntaxHighlight_GeSHi
TimedMediaHandler
TitleBlacklist
TitleKey
UploadWizard
Variables
Widgets
WikiEditor
WikimediaMessages
"
# --------------------------------------
# split extension on ", ". If extension sting contains only one value
# * export $git_branch,
# * else export the specified string above as $this_clone_version
# (the so-called tree-ish string, usually a tag or branch or anything the *developers* had defined)
# Example:
# SemanticMediaWiki, 1.8
# ↓ ↓
# $extension, $this_clone_version
# will export 1.8 (which the developers have defined as a tag)
# NOTE: check the line (similar to ternary operator: condition ? do-this : do-other-things)
# $( … ) substitutes/returns the command's output
# → if ext-check-with-comma == ext then (&&) "HEAD" else (||) version-string-from-above-list-of-EXTENSIONS
# ${ext%,*} from back of $ext → delete shortest (%) or longest (%%) match
# ${ext#*,* } from front of $ext → delete shortest (#) or longest (##) match
# --------------------------------------
this_ext_update_status=""
IFS=$'\n'; # set Internal Field Separator in for loop to newline '\n' only! Deafult $IFS is ' \t\n': «printf %q "$IFS"»
for ext in $EXTENSIONS; do
if [ "${ext}" ];then
this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext%%,*}");
this_clone_version=$([ "${ext%,*}" == "$ext" ] && echo "$git_branch" || echo "${ext#*, }");
if ! [ -d "${git_mw_extension_resource_dir}/${this_extension}" ]; then
echo "${git_mw_extension_resource_dir}/${this_extension} DOES NOT EXIST AS GIT SOURCE, check the extension's name or path!! (extension was skipped)";
else
if [ ! -d "${usr_share_extension_path}/${this_extension}" ]; then
this_ext_update_status="+";
if [ "$do_not_install_but_show_dry_run" == "" ]; then
sudo mkdir --parents "${usr_share_extension_path}/${this_extension}";
sudo chown www-data:www-data "${usr_share_extension_path}/${this_extension}";
else
echo "sudo mkdir --parents \"${usr_share_extension_path}/${this_extension}\"; # add $this_ext_update_status;"
echo "sudo chown www-data:www-data \"${usr_share_extension_path}/${this_extension}\";"
fi;
else
this_ext_update_status="u";
fi;
printf "git archive export: %1s %-30s %s\n" $this_ext_update_status $this_extension $this_clone_version;
if [ "$do_not_install_but_show_dry_run" == "" ]; then
if [ -d "${git_mw_extension_resource_dir}/${this_extension}" ];then
cd "${git_mw_extension_resource_dir}/${this_extension}"
AVAILABLE_CLONE_VERSIONS=`git branch -r | sort --version-sort`
if [ "`echo "$AVAILABLE_CLONE_VERSIONS" | grep --count "$this_clone_version" `" == "0" ]; then
echo "Clone version $this_clone_version not available!! Check these (git branch -r | sort --version-sort):";
echo "$AVAILABLE_CLONE_VERSIONS";
else
echo "No clone version available";
fi;
# EXAMPLE: sudo git archive --prefix=AdminLinks/ HEAD | sudo -u www-data tar --extract --overwrite --directory=/usr/share/mediawiki23/extensions
sudo git archive --prefix="${this_extension}/" "$this_clone_version" | sudo -u www-data tar --extract --overwrite --directory="${usr_share_extension_path}";
else
echo "Sorce not found: \"${git_mw_extension_resource_dir}/${this_extension}\" "
fi;
else
echo "cd \"${git_mw_extension_resource_dir}/${this_extension}\" && sudo git archive --prefix=\"${this_extension}/\" \"$this_clone_version\" | sudo -u www-data tar --extract --overwrite --directory=\"${usr_share_extension_path}\";"
fi;
fi;
fi;
done;
IFS=$' \t\n';
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
#######################################
Unsupported extensions (svn)
https://www.mediawiki.org/wiki/Extension:StringFunctions is no more supported see Installation Issues, Problems, Transition form Older Wikis (StringFunctions).
Biowikifarm extensions (svn)
#######################################
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# subversion STEP 1: biowikifarm extensions to ${usr_share_extension_path}
cd "${usr_share_extension_path}";
sudo -u www-data -g www-data svn checkout file:///var/lib/svn/LocalSVNextensions "${usr_share_extension_path}";
# subversion STEP 2
# create post hook commit to the MediaWiki LTS source
# open file
# sudo nano /var/lib/svn/hooks/post-commit
#!/bin/bash
if [ -d "/usr/share/mediawiki23/extensions" ]; then
echo -en "\n\npost-commit mediawiki23/extensions (r${REV})\n" >> "${LOGFILE}";
cd /usr/share/mediawiki23/extensions;
echo "try to get /usr/bin/svn update >> \"${LOGFILE}\"" >> "${LOGFILE}";
/usr/bin/svn update >> "${LOGFILE}";
echo -ne " (done)\n" >> "${LOGFILE}";
fi
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
#######################################
USR_SHARE_WIKI → WEB_WIKI
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# STEP create web wiki directory
if ! [ -d "${vhost_wiki_path}" ]; then
echo -e "\e[47mCreate wiki web base directory (sudo): \e[42m'${vhost_wiki_path}'\e[0m"
if [ "$do_not_install_but_show_dry_run" == "" ]; then
sudo -u root -g mwadmin mkdir --parent "${vhost_wiki_path}"
# sudo chown root:mwadmin "${vhost_wiki_path}" -R
else
echo "sudo -u root -g mwadmin mkdir --parent \"${vhost_wiki_path}\""
fi
else
echo -e "\e[47mWiki web base directory exits already: \e[42m'${vhost_wiki_path}'\e[0m"
fi
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
OpenMedia, SpecialMedia Symlink
This may be skipped, because the NGINX configuration can catch URLs and redirect directly to the OpenMedia directory without a symlink but due to the Same-Origin-Policy (SOP) it is done here. Extension:MultimediaViewer complains about Cross domoain origins of media.
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# STEP create symlink to openmedia
if ! [ -d "${vhost_path}/o" ]; then
echo -e "\e[47mCreate Openmedia-symlink \e[42m'${vhost_path}/o'\e[47m → \e[42m'../v-species/o'\e[0m"
if [ "$do_not_install_but_show_dry_run" == "" ]; then
sudo ln -s "../v-species/o" "${vhost_path}/o"
sudo mkdir "${vhost_path}/o = Openmedia-symlink"
# sudo chown root:mwadmin "${vhost_wiki_path}" -R
else
echo "sudo ln -s \"../v-species/o\" \"${vhost_path}/o\";"
fi
else
echo -e "\e[47mOpenmedia-symlink exits already \e[42m'${vhost_path}/o'\e[0m"
fi
if ! [ -d "${vhost_path}/s" ]; then
echo -e "\e[47mCreate Specialmedia-symlink \e[42m'${vhost_path}/s'\e[47m → \e[42m'../v-species/s'\e[0m"
if [ "$do_not_install_but_show_dry_run" == "" ]; then
sudo ln -s "../v-species/s" "${vhost_path}/s"
sudo mkdir "${vhost_path}/s = Specialmedia-symlink"
# sudo chown root:mwadmin "${vhost_wiki_path}" -R
else
echo "sudo ln -s \"../v-species/s\" \"${vhost_path}/s\";"
fi
else
echo -e "\e[47mSpecialmedia-symlink exits already \e[42m'${vhost_path}/s'\e[0m"
fi
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
Link Folders and Files from USR_SHARE_WIKI to WEB_WIKI
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# symbolic links of folders of LTS version
# for $vhost_wiki_path to $usr_share_wiki_path
cd "${usr_share_wiki_path}"
# \( ! -name '.*' \) avoids finding hidden directories
for this_dir in `find . -maxdepth 1 \( ! -name '.*' \) -type d -printf "%f\n"`; do
if ! [ -e "${vhost_wiki_path}/${this_dir}" ]; then
echo "symbolic link to ${vhost_wiki_path}/${this_dir}"
sudo ln -s "${usr_share_wiki_path}/${this_dir}" "${vhost_wiki_path}/${this_dir}"
fi
done
# symbolic links of files of LTS version
cd "${usr_share_wiki_path}"
# \( ! -name '.*' \) avoids finding hidden directories
for this_file in `find . -maxdepth 1 \( ! -name '.*' \) -type f -printf "%f\n"`; do
if ! [ -e "${vhost_wiki_path}/${this_file}" ]; then
echo "symbolic link to ${vhost_wiki_path}/${this_file}"
sudo ln -s "${usr_share_wiki_path}/${this_file}" "${vhost_wiki_path}/${this_file}"
fi
done
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
Fix Links of Folders (Cache, Media, Extensions …)
Cache & media is on a separate partition. Folder extension cannot be a symbolic link because of composer’s management on level WEB_WIKI.
NOTE: for linking extensions there are two approches:
- linking the entire extension directory and let composer override some extensions folders managed by composer
- do not link the entire extension directory, take care manually for each extension directory wether it is managed by composer or comes from a USR_SHARE_WIKI-extension (i.e.: do no override USR_SHARE_WIKI-extensions. If composer manages extensions, then you must rename the symlink manually)
Both approaches seems be valid. The second approach was done here.
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# extension: remove symbolic link to folder extensions
# no symbolic link to usr_share_extension_path
# because composer.phar handles extension on level WEB_WIKI
sudo rm -i "${vhost_wiki_path}/extensions" # remove interactively
echo "create ${vhost_wiki_path}/extensions"
sudo -u root -g www-data mkdir "${vhost_wiki_path}/extensions"
# STEP 1 cache: reroute cache folder to a dump partition (specific to biowikifarm)
dump_path_for_webwiki="/mnt/dump/var/www/v-infoflora-d-cache";
vhost_wiki_path="/var/www/v-infoflora/d";
echo "create ${dump_path_for_webwiki}";
if ! [ -d "${dump_path_for_webwiki}" ]; then sudo mkdir --parent "${dump_path_for_webwiki}"; fi;
sudo chown www-data:www-data "${dump_path_for_webwiki}";
sudo chmod 775 -R "${dump_path_for_webwiki}";
echo "remove current ${vhost_wiki_path}/cache";
sudo rm "${vhost_wiki_path}/cache" -r;
echo "make symbolic link ${vhost_wiki_path}/cache → ${dump_path_for_webwiki}";
sudo ln -s "${dump_path_for_webwiki}" "${vhost_wiki_path}/cache";
# STEP 2 images: use media instead, reroute to dump partition (specific to biowikifarm)
dump_path_for_webwiki="/mnt/storage/var-www-v-inflora-d-media";
vhost_wiki_path="/var/www/v-infoflora/d";
echo "remove current ${vhost_wiki_path}/images";
sudo rm -i "${vhost_wiki_path}/images" # remove it interactively
echo "create ${dump_path_for_webwiki}";
if ! [ -d "${dump_path_for_webwiki}" ]; then sudo mkdir --parent "${dump_path_for_webwiki}"; fi;
sudo chown www-data:www-data "${dump_path_for_webwiki}";
sudo chmod 775 -R "${dump_path_for_webwiki}";
echo "make symbolic link ${vhost_wiki_path}/media → ${dump_path_for_webwiki}";
sudo ln -s "${dump_path_for_webwiki}" "${vhost_wiki_path}/media";
# STEP 3: remove mw-config symlink of web installation folder
sudo rm -i "/var/www/v-infoflora/d/mw-config";
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
Link Extensions from USR_SHARE_WIKI to WEB_WIKI
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# create symlinks to extensions individually
# reason: composer-extensions must be dealt with
# on level WEB_WIKI individually
# @dependency $EXTENSIONS
# @dependency global variables
SVN_BIOWIKIFARM_EXTENSIONS="
CommonsMediaCaching
ContributorList
IdentificationTool
ListAllExternalLinks
MobileKeyV1
MobileKeyV2
TemplateParameterIndex
"
LTS_EXTENSIONS=`echo -e "${EXTENSIONS}\n${SVN_BIOWIKIFARM_EXTENSIONS}" | sed 's@ *, .*@@g;/^$/d;' | sort --unique`
this_ext_update_status=""
IFS=$'\n'; # set Internal Field Separator in for loop to newline '\n' only! Deafult $IFS is ' \t\n': «printf %q "$IFS"»
for ext in $LTS_EXTENSIONS; do
if [ "${ext}" ];then
# ${ext%,*} from back of $ext → delete shortest (%) or (%%) longest match
# ${ext#*,* } from front of $ext → delete shortest (#) or (##) longest match
this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext%*,* *}");
if ! [ -d "${usr_share_extension_path}/${this_extension}" ]; then
echo "${usr_share_extension_path}/${this_extension} DOES NOT EXIST as LTS source, check '${usr_share_extension_path}' (extension was skipped)";
else
if ! [ -e "${vhost_wiki_path}/extensions/${this_extension}" ]; then
this_ext_update_status="+";
if [ "$do_not_install_but_show_dry_run" == "" ]; then
sudo ln -s "${usr_share_extension_path}/${this_extension}" "${vhost_wiki_path}/extensions/${this_extension}";
else
echo "sudo ln -s \"${usr_share_extension_path}/${this_extension}\" \"${vhost_wiki_path}/extensions/${this_extension}\";";
fi
else
this_ext_update_status=".";
fi;
printf "symlink: %1s %-30s\n" $this_ext_update_status $this_extension;
fi;
fi;
done;
IFS=$' \t\n';
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
Install composer extensions
These extensions must be dealt with at level WEB_WIKI. Documentation
Extensions you want to remove you must do it with composer
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# get, install PHP composer tool
cd ~ # go to personal home directory
sudo curl -sS https://getcomposer.org/installer | php
sudo chown root:mwadmin composer.phar
sudo mv composer.phar /usr/local/bin/
# create ${vhost_wiki_path}/composer.json
# see ${vhost_wiki_path}/composer-example.json
sudo cp "${vhost_wiki_path}/composer-example.json" "${vhost_wiki_path}/composer.json"
sudo chown root:mwadmin "${vhost_wiki_path}/composer.json"
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
(Re)Move old Git extensions
The problem is, that extensions managed by git must be removed in favour of composer management. Composer installs also dependencies so take care also of dependent extensions documented by extension developers, e.g. SemanticMaps in composer will also install extension Maps. The following script just renames old extension folders to make room for the composer managed extensions. In case of SemanticMaps it’s only necessary to do …
sudo php /usr/local/bin/composer.phar require mediawiki/semantic-maps '3.1.3'
… but you must take care of the extension folder Maps (if present) manually.
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# rename e.g. extension SemanticForms folder → SemanticForms_2015-01-15
# create a file containing all composer commands to be installed manually later on
cd "${vhost_wiki_path}"
composer_command_file="composer_extensions_to_be_manually_installed.sh"
# ExtensionName, composer-require-command
COMPOSER_EXTENSIONS="
GraphViz, require mediawiki/graph-viz '*'
ImageMap, require mediawiki/image-map '@dev'
SemanticMediaWiki, require mediawiki/semantic-media-wiki '~2.0'
SemanticForms, require mediawiki/semantic-forms '3.1'
SemanticResultFormats, require mediawiki/semantic-result-formats '2.0'
SemanticMaps, require mediawiki/semantic-maps '3.1.3'
PHPExcel, require phpoffice/phpexcel '1.8.0'
"
echo "Install extensions manually, see '${vhost_wiki_path}/$composer_command_file'";
echo "You may check also dependencies manually and rename those extension folders manually too, e.g. SemanticMaps is dependent on Maps";
if [ "$do_not_install_but_show_dry_run" == "" ]; then
sudo /bin/su -c "echo '' > \"${vhost_wiki_path}/$composer_command_file\""
else
echo "sudo /bin/su -c \"echo '' > \\\"${vhost_wiki_path}/$composer_command_file\\\"\" "
fi
IFS=$'\n'; # set Internal Field Separator in for loop to newline '\n' only! Deafult $IFS is ' \t\n': «printf %q "$IFS"»
for ext in $COMPOSER_EXTENSIONS; do
if [ "${ext}" ];then
# ${ext%,*} from back of $ext → delete shortest (%) or (%%) longest match
# ${ext#*,* } from front of $ext → delete shortest (#) or (##) longest match
this_composer_command=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext#*,* }");
this_extension=$([ "${ext%,*}" == "$ext" ] && echo "$ext" || echo "${ext%*,*}");
if [ -h "${vhost_wiki_path}/extensions/${this_extension}" ]; then
old_extension_date=`stat --format="%y" "${vhost_wiki_path}/extensions/${this_extension}" | awk '{ print $1 }'` # e.g 2015-01-15
echo "There is already an extension: rename '${this_extension}' to '${this_extension}_${old_extension_date}' "
if [ "$do_not_install_but_show_dry_run" == "" ]; then
sudo mv "${vhost_wiki_path}/extensions/${this_extension}" "${vhost_wiki_path}/extensions/${this_extension}_${old_extension_date}"
else
echo "sudo mv \"${vhost_wiki_path}/extensions/${this_extension}\" \"${vhost_wiki_path}/extensions/${this_extension}_${old_extension_date}\""
fi
fi
printf "\e[0mFor \e[47m$this_extension\e[0m you may need to remove in \e[47mLocalSettings.php\e[0m the entry \e[42m%s\e[0m\n" "require_once '\$IP/extensions/$this_extension/$this_extension.php'; "
printf "Append composer command to \e[42m%s\e[0m\n" "'${vhost_wiki_path}/$composer_command_file'"
if [ "$do_not_install_but_show_dry_run" == "" ]; then
sudo /bin/su -c "echo \"sudo php /usr/local/bin/composer.phar $this_composer_command\" >> \"${vhost_wiki_path}/$composer_command_file\""
else
echo "sudo /bin/su -c \"echo \\\"sudo php /usr/local/bin/composer.phar $this_composer_command\\\" >> \\\"${vhost_wiki_path}/$composer_command_file\\\"\""
fi;
fi;
done
IFS=$' \t\n';
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
##↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
# commands from manually created file in '${vhost_wiki_path}/$composer_command_file'
cd "${vhost_wiki_path}"
sudo php /usr/local/bin/composer.phar require mediawiki/graph-viz '*'
sudo php /usr/local/bin/composer.phar require mediawiki/image-map '@dev'
sudo php /usr/local/bin/composer.phar require mediawiki/semantic-media-wiki '~2.0'
sudo php /usr/local/bin/composer.phar require mediawiki/semantic-forms '3.1'
sudo php /usr/local/bin/composer.phar require mediawiki/semantic-result-formats '2.0'
sudo php /usr/local/bin/composer.phar require mediawiki/semantic-maps '3.1.3'
sudo php /usr/local/bin/composer.phar require phpoffice/phpexcel '1.8.0'
##↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
#######################################
Settings for LocalSettings.php
Set correct rights
if [ -e "${vhost_wiki_path}/LocalSettings.php" ];then
sudo chmod 664 "${vhost_wiki_path}/LocalSettings.php" # rw-rw-r--
sudo chown root:mwadmin "${vhost_wiki_path}/LocalSettings.php"
else
echo "Warning: The settings file does not exist yet '${vhost_wiki_path}/LocalSettings.php'"
fi
There are alternative approaches:
- use web installer of the new Wiki
- NGINX configuration must be done
- correct rights for writing of the www-data user
- see Manual:Shared database → Upgrading
- use command line installer in maintenance/install.php
- ?does it try to override a LocalSettings.php?
- it seems to need an Admin User to be defined (problem with shared user tables?)
- see Manual:Shared database → Upgrading. ?make use of command line option
--doshared
?
- copy old database template (database z_en_template in https://biowikifarm.net/phpmyadmin_v3-3-7/) and adjust it as well as settings for LocalSettings.php
- User rightss in the database
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON `my_database` . * TO 'wikiuser'@'localhost';
- see in
MediaWikiCommonSettings.php
(some settings there might interfere with MW 1.23 due to software changes) - see other files of
LocalSettings.php
- User rightss in the database
Inter-Wiki Language Links
Linking to language variants is done by having set URL prefixes on Special:Interwiki correctly. By default a URL-prefix “de” will automatically add a Language link on the navigation bar of the Wikipage but bear in mind not to share the interwiki table then:
$wgSharedDB = "metawiki"; # Name of user database shared among all wikis. Provides single-identity only, not single-sign-on
$wgSharedTables = array("user", "account_credentials", "account_requests");
Nginx Configuration
See also Nginx Installation and Configuration. Tips:
- location in nginx path must match $wgScriptPath $wgArticlePath
- http://blog.bigdinosaur.org/mediawiki-on-nginx/
General architecture
/etc/nginx/nginx.conf - basic settings └→ include /etc/nginx/sites-enabled/* - actual sites configured ready for production * default file - for common settings of that server the no-URL-resolving redirects back to ┌→ * configuration files for each server │ (linked) /etc/nginx/sites-available/* - potentially available sites files for each server
Installation Issues, Problems, Transition form Older Wikis
- RELEASE-NOTES: read/check file mw-source/RELEASE-NOTES-X.XX, changes are described there, class changes, core changes and deprecated functions
- composer management: problem is that composer extensions are handled on the level WEB_WIKI by composer not by
require_once("…")
- Extension:Cite becomes extension CiteThisPage (MW 1.24+)
- Extension:ContacPage has special installation (MW1.23+) https://www.mediawiki.org/wiki/Extension:ContactPage#Installation
- Extension:ExpandTemplates is now in MW1.23+ core, separate installation is no longer necessary (
)require_once("…")
- Extension:GlobalUsage has no more class names with underscore. Adjust configuration of $wgLBFactoryConf in LocalSettings.php see also http://noc.wikimedia.org/conf/highlight.php?file=db.php
- Extension:Vector is in core MW 1.22+, separate installation is no longer necessary (
)require_once("…")
Dependencies:
- Extension:TimedMediaHandler dependent on Extension:MwEmbedSupport
- biowikifarm Extension:MobileKeyV1, Extension:MobileKeyV2 are dependent on Extension:TemplateParameterIndex
- Extension:BetaFeatures is a light dependency of Extension:MultimediaViewer
Composer extensions see above
No further development of StringFunctions
- problem support https://www.mediawiki.org/wiki/Extension:StringFunctionsis terminated. Fix it by set
$wgPFEnableStringFunctions = true;
in LocalSettings.php.
Notes on Future Versions of MW
MediaWiki 1.24 and later don't include skins in the Git download.
cd "$git_mw_basedir"
git clone https://gerrit.wikimedia.org/r/p/mediawiki/skins.git
# Switch to the skins folder, that was just cloned. To get all the skins use:
git submodule update --init --recursive
Installation Problems
- A user_password_expires column has been added to the user table
/usr/share/mediawiki23/maintenance/archives/patch-user_password_expire.sql # MYSQL-patch see release notes: ALTER TABLE user ADD COLUMN user_password_expires varbinary(14) DEFAULT NULL; -- done so far for biowikifarm
- location in nginx path must match $wgScriptPath $wgArticlePath
-
load.php
gave internal server error 500- debug on: nothing conclusive
- nginx logs:
PHP message: PHP Fatal error: Cannot override final method SMW\ResultPrinter::getResult() in /var/www/v-infoflora/d/extensions/SemanticResultFormats/formats/Exhibit/SRF_Exhibit.php on line 468
-
$srfgFormats[] = 'exhibit'. in SemanticResultFormats v2.0 causes fatal error
, see https://phabricator.wikimedia.org/T59760
-
- Google Maps API Key neccessary?
- MW 1.22+ <gallery> needs a new setting in $wgGalleryOptions for 'mode' otherwise MWException
- 'mode' => 'traditional', // One of "traditional", "nolines", "packed", "packed-hover", "packed-overlay"
- if Extension:TitleKey is active you should run for the first time
sudo -u www-data php /var/www/v-mywiki/w/extensions/TitleKey/rebuildTitleKeys.php --conf LocalSettings.php
Installation Issues: Semantic MediaWiki
- if you get a
*Fatal error*: Call to undefined function enableSemantics()
make sure to add it at the end of semantics settigs inLocalSettings.php
. The composer’s autoload can fix it but may not be neccesary in later MW Versions (untested, or order in LocalSettings.php may be of importance):
if (is_readable("$IP/vendor/autoload.php")) require( "$IP/vendor/autoload.php");
- Extension:SemanticForms 3.0+ (edit with form) the implementation of forms has changed to {{#default_form:form}}
- #set_internal saves differently on a property page "Property:property-name" not just "property-name", has consequences for querying. You could use a count check for the query to see if a property prefix is neccessary:
{{#ifexr: {{#ask: [[internal object::{{{property|}}}]]|format=count}}|<!-- no prefix: older SMW -->PAGENAME|<!-- prefix property -->FULLPAGENAME}}
- Extension:Semantic Drilldown 2.0+ sets up drill down by #drilldowninfo and #drilldownlink. Deprecated things:
- namespace Filter
- Constants for special properties