TEHCC Wiki:Maintenance: Difference between revisions

From TEHCC Wiki
Jump to navigation Jump to search
(→‎Upgrade/Reinstall: update based on recent upgrade)
(switch to php v7.3 and use array for installed mediawiki version)
Line 1: Line 1:
{{#arraydefine:phpcommand|php}}<!-- Load with any special directory specifying required to access desired version of php -->
{{#arraydefine:phpcommand|/opt/cpanel/ea-php73/root/usr/bin/php}}<!-- Load with any special directory specifying required to access desired version of php -->
'''Note!''' On the command line, you no longer need to specify the location of the latest version of php. When it calls for <kbd>php</kbd> you simply use <kbd>{{#arrayprint:phpcommand}}</kbd>.
{{#arraydefine:mwInstallVersion|mediawiki-1.34.1}}<!-- Use to update examples to be useful -->
'''Note!''' While using <kbd>php</kbd> uses PHP v7.0 which appears sufficient, the site actually runs on PHP v7.3. To ensure no oddity of running update scripts with a different version of php, when instructions call for <kbd>php</kbd> you instead use <kbd>{{#arrayprint:phpcommand}}</kbd>.
 


==System Maintenance==
==System Maintenance==
Line 6: Line 8:
===Upgrade/Reinstall===
===Upgrade/Reinstall===
Use to upgrade across major versions or to reinstall a borked install
Use to upgrade across major versions or to reinstall a borked install
<p>'''Note!''' The examples below are using a page array variable. Edit the page to update the variable for your target installation to ease copy-n-paste of commands. Examples currently using <kbd>{{#arrayprint:mwInstallVersion}}</kbd>.
# Precheck!
# Precheck!
## These steps have worked for upgrades in the past, but a reality check with any new versions is always prudent.
## These steps have worked for upgrades in the past, but a reality check with any new versions is always prudent.
Line 13: Line 16:
# Get MediaWiki (per [https://www.mediawiki.org/wiki/Manual:Upgrading MediaWiki site])
# Get MediaWiki (per [https://www.mediawiki.org/wiki/Manual:Upgrading MediaWiki site])
## Download desired version [https://www.mediawiki.org/wiki/Download MediaWiki Site] using <kbd>wget</kbd> to the home directory
## Download desired version [https://www.mediawiki.org/wiki/Download MediaWiki Site] using <kbd>wget</kbd> to the home directory
## Unpack using <kbd>tar -xvzf</kbd> (''e.g.'', <code>tar -xvzf ''mediawiki stable release number.tar.gz''</code>)
## Unpack using <kbd>tar -xvzf</kbd> (''e.g.'', <code>tar -xvzf ''{{#arrayprint:mwInstallVersion}}.tar.gz''</code>)
## Delete zipped tarball (''e.g.'', <code>rm ''mediawiki stable release number.tar.gz''</code>)
## Delete zipped tarball (''e.g.'', <code>rm '{{#arrayprint:mwInstallVersion}}.tar.gz''</code>)
# Copy customized files to new install (per [https://www.mediawiki.org/wiki/Manual:Upgrading MediaWiki site])
# Copy customized files to new install (per [https://www.mediawiki.org/wiki/Manual:Upgrading MediaWiki site])
## Copy Localsettings.php (''e.g.'', <code>cp public_html/clubwiki/LocalSettings.php ~/''mediawiki stable release number''/</code>)
## Copy Localsettings.php (''e.g.'', <code>cp public_html/clubwiki/LocalSettings.php ~/''{{#arrayprint:mwInstallVersion}}''/</code>)
## Copy kml folder (''e.g.'', <code>cp -R public_html/clubwiki/kml/ ~/''mediawiki stable release number''/</code>)
## Copy kml folder (''e.g.'', <code>cp -R public_html/clubwiki/kml/ ~/''{{#arrayprint:mwInstallVersion}}''/</code>)
## Copy Images folder (''e.g.'', <code>cp -R public_html/clubwiki/images/ ~/''mediawiki stable release number''/</code>)
## Copy Images folder (''e.g.'', <code>cp -R public_html/clubwiki/images/ ~/''{{#arrayprint:mwInstallVersion}}''/</code>)
# Migrate manual extensions (Confirm this list is still accurate with the more actively used update procedure below)
# Migrate manual extensions (Confirm this list is still accurate with the more actively used update procedure below)
## Copy Arrays (''e.g.'', <code>cp -R public_html/clubwiki/extensions/Arrays/ ~/mediawiki-1.34.1/extensions/</code>)
## Copy Arrays (''e.g.'', <code>cp -R public_html/clubwiki/extensions/Arrays/ ~/{{#arrayprint:mwInstallVersion}}/extensions/</code>)
## Copy HeaderTabs (''e.g.'', <code>cp -R public_html/clubwiki/extensions/HeaderTabs/ ~/mediawiki-1.34.1/extensions/</code>)
## Copy HeaderTabs (''e.g.'', <code>cp -R public_html/clubwiki/extensions/HeaderTabs/ ~/{{#arrayprint:mwInstallVersion}}/extensions/</code>)
## Copy MyVariables (''e.g.'', <code>cp -R public_html/clubwiki/extensions/MyVariables/ ~/mediawiki-1.34.1/extensions/</code>)
## Copy MyVariables (''e.g.'', <code>cp -R public_html/clubwiki/extensions/MyVariables/ ~/{{#arrayprint:mwInstallVersion}}/extensions/</code>)
## Copy NumberFormat (''e.g.'', <code>cp -R public_html/clubwiki/extensions/NumberFormat/ ~/mediawiki-1.34.1/extensions/</code>)
## Copy NumberFormat (''e.g.'', <code>cp -R public_html/clubwiki/extensions/NumberFormat/ ~/{{#arrayprint:mwInstallVersion}}/extensions/</code>)
## Copy PageForms (''e.g.'', <code>cp -R public_html/clubwiki/extensions/PageForms/ ~/mediawiki-1.34.1/extensions/</code>)
## Copy PageForms (''e.g.'', <code>cp -R public_html/clubwiki/extensions/PageForms/ ~/{{#arrayprint:mwInstallVersion}}/extensions/</code>)
## Copy SimpleTabs (''e.g.'', <code>cp public_html/clubwiki/extensions/SimpleTable.php ~/mediawiki-1.34.1/extensions/</code>)
## Copy SimpleTabs (''e.g.'', <code>cp public_html/clubwiki/extensions/SimpleTable.php ~/{{#arrayprint:mwInstallVersion}}/extensions/</code>)
# Migrate Composer (can also follow Mediawiki recommendations, but if you updated extensions first, this should be fine)
# Migrate Composer (can also follow Mediawiki recommendations, but if you updated extensions first, this should be fine)
## Copy composer.local.json (''e.g.'', <code>cp public_html/clubwiki/composer.local.json ~/''mediawiki stable release number''/</code>)
## Copy composer.local.json (''e.g.'', <code>cp public_html/clubwiki/composer.local.json ~/''{{#arrayprint:mwInstallVersion}}''/</code>)
## Copy composer.phar (''e.g.'', <code>cp public_html/clubwiki/composer.phar ~/''mediawiki stable release number''/</code>)
## Copy composer.phar (''e.g.'', <code>cp public_html/clubwiki/composer.phar ~/''{{#arrayprint:mwInstallVersion}}''/</code>)
# Move over to new install (per [https://www.mediawiki.org/wiki/Manual:Upgrading MediaWiki site])
# Move over to new install (per [https://www.mediawiki.org/wiki/Manual:Upgrading MediaWiki site])
##Move the existing installation to a temporary backup folder <code>mv ~/public_html/clubwiki/ ~/OLD.yyyymmdd.clubwiki</code>
##Move the existing installation to a temporary backup folder <code>mv ~/public_html/clubwiki/ ~/OLD.yyyymmdd.clubwiki</code>
## Move the new installation to the public folder <code>mv ~/''mediawiki stable release number'' ~/public_html/clubwiki</code>
## Move the new installation to the public folder <code>mv ~/''{{#arrayprint:mwInstallVersion}}'' ~/public_html/clubwiki</code>
# Finish by repeating [[#Update extensions]] again. This will force composer to install needed dependencies, then the maintenance update will perform the database migration.  
# Finish by repeating [[#Update extensions]] again. This will force composer to install needed dependencies, then the maintenance update will perform the database migration.  
# Check [[Special:Version]] and a page or two to confirm things are still working.
# Check [[Special:Version]] and a page or two to confirm things are still working.

Revision as of 09:46, 18 April 2020


Note! While using php uses PHP v7.0 which appears sufficient, the site actually runs on PHP v7.3. To ensure no oddity of running update scripts with a different version of php, when instructions call for php you instead use /opt/cpanel/ea-php73/root/usr/bin/php.


System Maintenance

Upgrade/Reinstall

Use to upgrade across major versions or to reinstall a borked install

Note! The examples below are using a page array variable. Edit the page to update the variable for your target installation to ease copy-n-paste of commands. Examples currently using mediawiki-1.34.1.

  1. Precheck!
    1. These steps have worked for upgrades in the past, but a reality check with any new versions is always prudent.
    2. Check requirements! Primarily PHP as the host updating and PHP's aggressive deprecation are a problem.
    3. Run the #Update extensions procedure below. We will move Composer and manual extensions from there for ease of upgrade.
    4. Include running the maintenance update and runJobs.
  2. Get MediaWiki (per MediaWiki site)
    1. Download desired version MediaWiki Site using wget to the home directory
    2. Unpack using tar -xvzf (e.g., tar -xvzf mediawiki-1.34.1.tar.gz)
    3. Delete zipped tarball (e.g., rm 'mediawiki-1.34.1.tar.gz)
  3. Copy customized files to new install (per MediaWiki site)
    1. Copy Localsettings.php (e.g., cp public_html/clubwiki/LocalSettings.php ~/mediawiki-1.34.1/)
    2. Copy kml folder (e.g., cp -R public_html/clubwiki/kml/ ~/mediawiki-1.34.1/)
    3. Copy Images folder (e.g., cp -R public_html/clubwiki/images/ ~/mediawiki-1.34.1/)
  4. Migrate manual extensions (Confirm this list is still accurate with the more actively used update procedure below)
    1. Copy Arrays (e.g., cp -R public_html/clubwiki/extensions/Arrays/ ~/mediawiki-1.34.1/extensions/)
    2. Copy HeaderTabs (e.g., cp -R public_html/clubwiki/extensions/HeaderTabs/ ~/mediawiki-1.34.1/extensions/)
    3. Copy MyVariables (e.g., cp -R public_html/clubwiki/extensions/MyVariables/ ~/mediawiki-1.34.1/extensions/)
    4. Copy NumberFormat (e.g., cp -R public_html/clubwiki/extensions/NumberFormat/ ~/mediawiki-1.34.1/extensions/)
    5. Copy PageForms (e.g., cp -R public_html/clubwiki/extensions/PageForms/ ~/mediawiki-1.34.1/extensions/)
    6. Copy SimpleTabs (e.g., cp public_html/clubwiki/extensions/SimpleTable.php ~/mediawiki-1.34.1/extensions/)
  5. Migrate Composer (can also follow Mediawiki recommendations, but if you updated extensions first, this should be fine)
    1. Copy composer.local.json (e.g., cp public_html/clubwiki/composer.local.json ~/mediawiki-1.34.1/)
    2. Copy composer.phar (e.g., cp public_html/clubwiki/composer.phar ~/mediawiki-1.34.1/)
  6. Move over to new install (per MediaWiki site)
    1. Move the existing installation to a temporary backup folder mv ~/public_html/clubwiki/ ~/OLD.yyyymmdd.clubwiki
    2. Move the new installation to the public folder mv ~/mediawiki-1.34.1 ~/public_html/clubwiki
  7. Finish by repeating #Update extensions again. This will force composer to install needed dependencies, then the maintenance update will perform the database migration.
  8. Check Special:Version and a page or two to confirm things are still working.
  9. Lessons of the past...
    1. If upgrade stalls to white screen, likely a specified extension is not installed, check list and add as needed
  10. Done! (May need to ctrl-shift-R to force reload pages to avoid seeing errors)

Update MediaWiki

Patch - Available for point releases. Details on the MediaWiki site

  1. Download patch from the dumps site
  2. cd to cd ~/public_html/clubwiki/ directory (the one with LocalSettings.php).
  3. Download (wget) the patch file from the dumps site and gunzip it gunzip mediawiki stable release number.patch.gz.
  4. Use patch -p1 --dry-run to check what will be changed (e.g., patch -p1 --dry-run -i mediawiki stable release number.patch)
  5. If all is well, run patch again without --dry-run.
  6. Check Special:Version and you should see the new version number in place.
  7. Delete patch files rm mediawiki stable release number.patch*

Update extensions

NOTE: I have often got errors or configuration screens from the site after updating extensions. These are typically resolved by running the maintenance routine below. Sometimes a single browser temporarily refused to work, yet a different browser behaved normally.

  1. Composer based (Semantic MediaWiki, Maps, and Semantic Result Formats)
    1. cd to cd ~/public_html/clubwiki/ directory (the one with LocalSettings.php).
    2. Update composer /opt/cpanel/ea-php73/root/usr/bin/php composer.phar self-update
    3. Update using composer /opt/cpanel/ea-php73/root/usr/bin/php composer.phar update --no-dev
  2. Composer extensions that need version number updated in composer.local.json vi composer.local.json
    1. Semantic MediaWiki
    2. Maps
    3. Semantic Result Formats
    4. Semantic Compound Queries
    5. Rerun composer update if there were any updates to perform /opt/cpanel/ea-php73/root/usr/bin/php composer.phar update --no-dev
  3. Manual extensions - Go to Special:Version and compare what's shown on extension page
    1. NumberFormat - Download needed updates and extract into the extension directory tar -xzf extension.tar.gz -C public_html/clubwiki/extensions/
    2. Page Forms - Download extension and extract into the extension directory tar -xzf extension.tar.gz -C public_html/clubwiki/extensions/
    3. Arrays - Upload new version into extension folder
    4. Header Tabs - Upload new version into extension folder
    5. MyVariables - Upload new version into extension folder
    6. SimpleTable - Upload new version into extension folder
  4. Remaining extensions are part of MediaWiki and upgraded with it
  5. Update completion - run maintenance routine from cd ~/public_html/clubwiki/ directory: /opt/cpanel/ea-php73/root/usr/bin/php maintenance/update.php
  6. Finish any residual jobs - run manual maintenance runJobs from cd ~/public_html/clubwiki/ directory: /opt/cpanel/ea-php73/root/usr/bin/php maintenance/runJobs.php --maxjobs 1000

Site Maintenance

Cleanup after a spam/vandalism battle

  1. cd to cd ~/public_html/clubwiki/ directory (the one with LocalSettings.php)
  2. Delete archived revisions (deleted page revisions) /opt/cpanel/ea-php73/root/usr/bin/php maintenance/deleteArchivedRevisions.php for dry run, then execute /opt/cpanel/ea-php73/root/usr/bin/php maintenance/deleteArchivedRevisions.php --delete
  3. Delete users older than 7 days with no edits /opt/cpanel/ea-php73/root/usr/bin/php maintenance/removeUnusedAccounts.php --ignore-touched 7 for dry run, then execute /opt/cpanel/ea-php73/root/usr/bin/php maintenance/removeUnusedAccounts.php --ignore-touched 7 --delete