TEHCC Wiki:Maintenance

From TEHCC Wiki
Revision as of 07:52, 18 April 2020 by Tim (talk | contribs) (→‎Upgrade/Reinstall: add php version note)
Jump to navigation Jump to search

Note! On the command line, you no longer need to specify the location of the latest version of php. When it calls for php you simply use php.

System Maintenance

Upgrade/Reinstall

1.33 is last to use PHP v7.0 (host's current version)

Do not upgrade until confirmed that site can use PHP 7.2.9+

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

  1. 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 stable release number.tar.gz)
    3. Delete zipped tarball (e.g., rm mediawiki stable release number.tar.gz)
  2. Copy customized files to new install (per MediaWiki site)
    1. Copy Localsettings.php (e.g., cp public_html/clubwiki/LocalSettings.php ~/mediawiki stable release number/)
    2. Copy composer.local.json (e.g., cp public_html/clubwiki/composer.local.json ~/mediawiki stable release number/)
    3. Copy kml folder (e.g., cp -R public_html/clubwiki/kml/ ~/mediawiki stable release number/)
    4. Copy Images folder (e.g., cp -R public_html/clubwiki/images/ ~/mediawiki stable release number/)
  3. 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 stable release number ~/public_html/clubwiki
  4. Install extensions/handlers
    1. Composer - per Mediawiki site in wiki root folder, run Web host doesn't like my link to get composer command then php composer.phar self-update
    2. Add composer based extensions to requirements list, create as needed vi composer.local.json - Ensure you specify the most recent/desired versions
      1. Semantic MediaWiki - whole site revolves around it
      2. Maps - For the embedded interactive maps
      3. Semantic result formats - permits semantic queries to other formats, I know array type is used by complex templates but I'm sure others have been used as well
      4. Semantic Compound Queries - permits advanced queries notably used in complex map templates
    3. Update/install specified extensions using composer php composer.phar update --no-dev
    4. NumberFormat - Download extension and extract into the extension directory tar -xzf extension.tar.gz -C ~/public_html/clubwiki/extensions/
    5. Page Forms - Download extension and extract into the extension directory tar -xzf extension.tar.gz -C ~/public_html/clubwiki/extensions/
    6. Arrays - Simple extension download. Used for array manipulation in templates
    7. Header Tabs - Allows turning form pages (or really any page) into tabbed pages
    8. MyVariables - Allows referencing logged in user for form automation
    9. {https://www.mediawiki.org/wiki/Extension:SimpleTable SimpleTable] - Allows simple table definition, specifically easily working with a CSV list, install by creating file as specified
  5. Run Mediawiki upgrade or command line update (per MediaWiki site)
    1. Lessons of the past...
      1. If upgrade stalls to white screen, likely a specified extension is not installed, check list and add as needed
  6. 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 php composer.phar self-update
    3. Update using composer 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 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: php maintenance/update.php
  6. Finish any residual jobs - run manual maintenance runJobs from cd ~/public_html/clubwiki/ directory: 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) php maintenance/deleteArchivedRevisions.php for dry run, then execute php maintenance/deleteArchivedRevisions.php --delete
  3. Delete users older than 7 days with no edits php maintenance/removeUnusedAccounts.php --ignore-touched 7 for dry run, then execute php maintenance/removeUnusedAccounts.php --ignore-touched 7 --delete