MediaWIKI Upgrade: Difference between revisions
Line 23: | Line 23: | ||
</syntaxhighlight>Copy previous version of MediaWiki website files into the new directory: cp -R -n -v WhatEverSource WhatEverDestination (This will not overwrite any new files, IE "upgraded" files, but has the effect of copying all the extensions, images, and any other files from the old website version, while paying deference to the newer files. | </syntaxhighlight>Copy previous version of MediaWiki website files into the new directory: cp -R -n -v WhatEverSource WhatEverDestination (This will not overwrite any new files, IE "upgraded" files, but has the effect of copying all the extensions, images, and any other files from the old website version, while paying deference to the newer files. | ||
=== Modification of Files === | ===Modification of Files=== | ||
Of course if any MediaWiki code files have been modified, the same modifications should be made to the new files, but this is rare.). Below are some examples;<syntaxhighlight lang="text"> | Of course if any MediaWiki code files have been modified, the same modifications should be made to the new files, but this is rare.). Below are some examples;<syntaxhighlight lang="text"> | ||
To remove the "This page was lasted edited on..." from the bottom of each Wiki page: In /PathToWikiWebFiles/languages/i18n/en.json, empty the data field for "lastmodifiedat" "lastmodifiedatby" | To remove the "This page was lasted edited on..." from the bottom of each Wiki page: In /PathToWikiWebFiles/languages/i18n/en.json, empty the data field for "lastmodifiedat" "lastmodifiedatby" | ||
Line 30: | Line 30: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Alternative for Modifying Files (CSS) === | ===Alternative for Modifying Files (CSS)=== | ||
Instead of changing code in files, CSS can be used to modify visibility of elements on a MediaWiki Site. The below script can be placed in the LocalSettings.php file and modify what appears for anonymous users and logged in users (probably not necessary to change anything for logged in users.<syntaxhighlight lang="text"> | Instead of changing code in files, CSS can be used to modify visibility of elements on a MediaWiki Site. The below script can be placed in the LocalSettings.php file and modify what appears for anonymous users and logged in users (probably not necessary to change anything for logged in users.<syntaxhighlight lang="text"> | ||
function efAddSkinStyles(OutputPage &$out, Skin &$skin) { | function efAddSkinStyles(OutputPage &$out, Skin &$skin) { | ||
Line 44: | Line 44: | ||
$out->addInlineStyle('#ca-talk { display:none; }'); | $out->addInlineStyle('#ca-talk { display:none; }'); | ||
$out->addInlineStyle('#ca-viewsource { display:none; }'); | $out->addInlineStyle('#ca-viewsource { display:none; }'); | ||
# $out->addInlineStyle('#footer-info-lastmod { display:none; }'); | |||
} | } | ||
} else { | } else { | ||
Line 53: | Line 54: | ||
} | } | ||
$wgHooks['BeforePageDisplay'][] = 'efAddSkinStyles'; | $wgHooks['BeforePageDisplay'][] = 'efAddSkinStyles'; | ||
</syntaxhighlight> | </syntaxhighlight>The "#footer-info-lastmod" ID that is commented out above will disable the display of "Last edited / Last modified" for anonymous users. | ||
=== Extensions === | ===Extensions=== | ||
Upgrade extensions (if there are upgrades). Visual Editor is one that needs to be kept up. Hopefully nothing breaks for extensions that don't have upgrades available. | Upgrade extensions (if there are upgrades). Visual Editor is one that needs to be kept up. Hopefully nothing breaks for extensions that don't have upgrades available. | ||
<br /> | <br /> |
Revision as of 19:00, 24 January 2020
There are all sorts of tutorials on upgrading MediaWiki. Here's the "down and dirty" version.
BACKUP!
Don't take a chance that the upgrade will mess something up. Make a backup. For MediaWiki, that consists of two items: The website files and the data base.
Backup the website files (actually make a copy)
mv WebSiteDirectory WebSiteDirectory.VERSION-WORKING (my naming convention)
The above is the quickest way to make an exact copy of the website files (unlike NTFS, Linux permissions are simple and will be copied with the above command) and also test as you go. IE, the copied files can be checked for functionality by going to the web site.
Upgrade (Actually Install and Copy)
Get the latest version (FULL version, not upgrade) of MediaWiki:https://www.mediawiki.org/wiki/Download
Unpack the TAR File: tar -xvzf mediawiki-1.xy.0.tar.gz -C /var/www/html/WhatEverDirectory (Don't worry about making a mess with a lot of files as the TAR File's first item is a Directory, as it should be)
Rename it to the original WebSiteDirectory (as that Directory name was changed): mv mediawiki-1.xy.0 WebSiteDirectory
Set the proper file permissions for Apache (adjust as necessary for your environment);
chown -R apache:apache /var/www/html/WhatEverDirectory
find /var/www/html/WhatEverDirectory -type d -exec chmod 755 {} \;
find /var/www/html/WhatEverDirectory -type f -exec chmod 644 {} \;
find /var/www/html/WhatEverDirectory/images -type d -exec chmod 755 {} \;
Copy previous version of MediaWiki website files into the new directory: cp -R -n -v WhatEverSource WhatEverDestination (This will not overwrite any new files, IE "upgraded" files, but has the effect of copying all the extensions, images, and any other files from the old website version, while paying deference to the newer files.
Modification of Files
Of course if any MediaWiki code files have been modified, the same modifications should be made to the new files, but this is rare.). Below are some examples;
To remove the "This page was lasted edited on..." from the bottom of each Wiki page: In /PathToWikiWebFiles/languages/i18n/en.json, empty the data field for "lastmodifiedat" "lastmodifiedatby"
Which contains this: "This page was last edited on $1, at $2."
Alternative for Modifying Files (CSS)
Instead of changing code in files, CSS can be used to modify visibility of elements on a MediaWiki Site. The below script can be placed in the LocalSettings.php file and modify what appears for anonymous users and logged in users (probably not necessary to change anything for logged in users.
function efAddSkinStyles(OutputPage &$out, Skin &$skin) {
if(!$skin->getUser()->isLoggedIn()) {
if ($skin->getSkinName() == 'vector') {
$out->addInlineStyle('#ca-history { display:none; }');
$out->addInlineStyle('#t-info { display:none; }');
$out->addInlineStyle('#n-recentchanges { display:none; }');
$out->addInlineStyle('#n-help-mediawiki { display:none; }');
$out->addInlineStyle('#t-whatlinkshere { display:none; }');
$out->addInlineStyle('#t-cite { display:none; }');
$out->addInlineStyle('#t-recentchangeslinked { display:none; }');
$out->addInlineStyle('#ca-talk { display:none; }');
$out->addInlineStyle('#ca-viewsource { display:none; }');
# $out->addInlineStyle('#footer-info-lastmod { display:none; }');
}
} else {
if ($skin->getSkinName() == 'vector') {
# $out->addInlineStyle('#ca-view { }');
}
}
return true;
}
$wgHooks['BeforePageDisplay'][] = 'efAddSkinStyles';
The "#footer-info-lastmod" ID that is commented out above will disable the display of "Last edited / Last modified" for anonymous users.
Extensions
Upgrade extensions (if there are upgrades). Visual Editor is one that needs to be kept up. Hopefully nothing breaks for extensions that don't have upgrades available.