Assist Upgrade Actions

From Calidus HUB
Revision as of 16:08, 5 August 2024 by Anw (talk | contribs) (Minor correction)

Purpose

Reasons

  • Assist server (online-help) will be sunsetted.
  • Some Assist wikis are 16 years out of date and versions are not supported by MediaWiki for any further bug fixes.
  • Version of XAMPP (including Apache and PHP) have security vulnerabilities that cannot be resolved without upgrading.
  • QoL improvements.


What do we get:

  • Technical
    • Latest security patched Apache, MariaDB and PHP installations.
    • Latest security patched MediaWiki installations.
    • New server with supported Windows, hosted on new farm, security enhanced.
    • Enhanced security of edits through CAPTCHA.
  • Maintenance
    • Easier upgrade path in the future to maintained LTS MediaWiki releases.
    • Batch Editing/Replacement - through Extension:Nuke/Extension:ReplaceText
    • Code syntax and error highlighting - through Extension:CodeEditor/Extension:SyntaxHighlight
    • Email/2FA account registration
    • Easier page/document creation - through Extension:InputBox
    • Batch upload of images, easing creation of new pages - through Extension:SimpleBatchUpload.
  • QoL
    • Improved editor
      • On-line preview - through Extension:WikiEditor
      • Template inserting - through Extension:TemplateWizard and Extension:TemplateData
      • Visual Editor - through Extension:VisualEditor and Extension:Gadgets
    • Easier category navigation - through Extension:CategoryTree
    • Cleaner modern layout, compatible with Mobile - through Timeless/Vector skin
    • Searching of tables - through bespoke code
    • Better exporting to PDF in Aptean format- through Extension:PdfBook
    • Online translation of pages to multiple languages - through Extension:GoogleTranslator


Local Upgrades

See existing system locally hosted

http://localhost:8080/EPOD/index.php/Main_Page

U/P: anw/Liverpool123

Database password is blank!


Installs

Requires upgrade to PHP to 7.4.3 - current version of the XAMPP that I have s 7.4.2

  • Start with a XAMPP version that is compatible (see below) or start with the requirements from 1.34 and upgrade PHP
  • Upgrading PHP
    • Download the version of XAMPP with the version you're after (in this case xampp-portable-windows-x64-7.4.4-2-VC15.7z) - use latest v7.X installer
    • Rename xampp/php folder to keep it safe.
    • Extract php folder into xampp
    • Stop and start Apache.
    • Note: 7.4.4 works fine with 1.34 - tested locally
  • Enable Intl package for 1.39:
    • On XAMPP (Windows) open the php.ini by opening the control panel, selecting config on apache section and selecting PHP
    • Then add extension=php_intl and restart Apache
  • Add MySQL WorkBench - download latest version.


Configuration

  • Move 80/443 IIS hosting to a new port to avoid conflicts on Apache.
  • php: (php.ini)
    • intl and openssl.
      • php.ini - memory_limit = 128M, all the way up to 512 depending on the size of PDF documents. For example, CTMS User Guide PDF size when produced is nearly 60Mb, so needs checking
  • Restart Apache (or Apache and PHP changes will not be obeyed)


Creating a brand new MediaWiki installation

  • Just extract the MW zip file into a new folder under calidus-assist, rename to what you want
  • Run configuration (navigate to the site)
    • database name
    • table prefix (including underscore e.g. "oh_", "epod_")
    • Enter your DB password
    • Regenerate localSettings.php
    • Enter owner u/p
  • Enter the same username/password for the site for the admin user.
  • Default skin: Timeless (mobile-friendly)

Then follow MediaWiki Configuration and following sections


Upgrading existing MediaWiki

Copying

  • Pull HTDOC for wiki systems into server from existing implementation.
  • Also favicons and index.html (gateway).
    • Update the favicon to Aptean - use the one in my MTS wiki - C:\xampp\htdocs\favicon.ico
  • Copy all the images from the ROOT images folder (not the subfolders) e.g. C:\xampp\htdocs\MTS\images
    • ApteanPageBk.png
    • ApteanPageBk800.png
    • ApteanPageBk1000.png
    • Clear_Icon.png
    • ApteanHF.png
    • ApteanHF1.png
    • ApteanHF2.png
    • pdf.png
  • Also images from $wgResourceBasePath/resources/assets/
    • Aptean.png
  • Pull databases into MariaDB.


Upgrade MediaWiki

  • Upgrade MediaWiki
    • Download the version your after (in this case mediawiki-1.39.8.zip from https://releases.wikimedia.org/mediawiki/1.39/)
    • Backup the database with all procedures and users. Note your root password.
    • Backup your XAMPP/htdocs folder that you are upgrading e.g. htdocs/MTS)
    • Backup your localsettings.php to localsettings.v1.34.old (belt and braces - you can use the one in your backup instead if you like)
    • Extract new MW version to a local folder (you'll need it again for all your wikis, and it's faster this way)
    • Copy new MW version over existing MW folder e.g. htdocs/MTS
    • Put the localsettings.php back in place.
    • Go to your URL, plus mw-config e.g. http://localhost:8080/calidus-assist/MTS/mw-config/
    • Follow the instructions as before - stages as below:
      • Language - select language.
        • Existing Wiki - copy the $wgUpgradeKey value from localsettings.php into the screen
      • Welcome to MediaWiki! - does checks - resolve any issues, but should be OK to continue
      • Connect to database - not required when upgrading an existing wiki
      • Upgrade existing installation - click Continue - that should be it. Any error, you can probably just continue again
      • Database settings
      • Name
      • Options
      • Install
      • Complete!

Notes from previous upgrades:

  • (May need to recreate users, specifically the owner from the previous site, as well as all other users.)
    • Create user, assign all privs for all databases to the admin user, other users don't need as much privilege - check an existing wiki for details
  • Reset passwords (must now be 10 mixed characters). Use either of the following:
    • Special:PasswordReset - enter username and email address.
    • "C:\xampp\php\php.exe" changePassword.php --user=example --password=example
  • Place wiki.png from skins/common/images into resources/common


MediaWiki Configuration

  • Enable all extensions, but be aware that some may need to be upgraded/have been upgraded by the wiki.
    • #wfLoadExtension( 'Variables' ); - doesn't work - not needed - comment out in the LocalSettings.php file
    • #wfLoadExtension( 'PdfBook' ); - doesn't work - needed - you will have to manually upgrade the PDF extension - see notes below.
  • Fix the logo and copyright icons again if required:
    • LocalSettings.php
      • $wgRightsIcon = "$wgResourceBasePath/resources/assets/Aptean.png";
      • $wgLogo = "$wgResourceBasePath/resources/assets/Aptean.png";
      • $wgRightsText = "Copyright ".html_entity_decode('©')." 2008-". date("Y")." Aptean ";
      • localsettings.php to override mail, for using gmail, check settings in C:\xampp\htdocs\EPOD\LocalSettings.php. Also have to set up an apppassword against the gmail account.
        • Add under $wgShowExceptionDetails: $wgDeprecationReleaseLimit = '1.0'; # Removes deprecation warnings from the system
  • Create the Privacy Policy page if it doesn't exist.
    • All content submitted to this documentation will be available to all customers of Aptean.
  • Use new version of PdfBook (see my MTS folder - old compatible versions are in Old Versions folder)
    • New PDF Book requires PHP8+ -
      • Reset the requirement to 7.4 in extension.json
  • MediaWiki:Pagetitle-view-mainpage - change this text to define the title of the wiki e.g. Assist - Calidus HUB
  • Update the main page - the MTS one in my PC is the one with all the best notes in.
  • Update the Did You Know page with the common Assist-based help topics - the MTS one in my PC is the one with all the best notes in, including reference to searchable tables below.
  • Create PageTemplate and DocTemplate pages - see local MTS assist for details
  • MediaWiki:Common.js - add searchable tables code
	// Javascript/jQuery code for searching tables
	function search_table(tableID, value){  
		$('#'+tableID+' tr').each(function(){  
			 var found = 'false';  
			 if (!$(this).hasClass('non-searchable')) {
				 $(this).each(function(){  
					if ($(this).find('td.non-searchable').length > 0) {
						   found = 'true';  
					} else if (!$(this).find('th').length > 0) {
					  if($(this).text().toLowerCase().indexOf(value.toLowerCase()) >= 0)  
					  {  
						   found = 'true';  
					  }
					} else {
						// Always keep the header row
						found = 'true';
					}
				 });  
				 if(found == 'true')  
				 {  
					  $(this).show();  
				 }  
				 else  
				 {  
					  $(this).hide();  
				 }  
			 }
		});  
	}  
	$(document).ready(function(){
		$("table.apt-searchable").each(function(index, element) {
			if (this.id !== '') {
				$('<input type="text" id="'+this.id+'_'+index+'" onkeyup="search_table(\''+this.id+'\',$(this).val())" placeholder="Search the table..."><input type="button" onclick="$(\'#'+this.id+'_'+index+'\').val(\'\');search_table(\''+this.id+'\',\'\')" title="Clear Entry" class="apt-search-clear">').insertBefore($(this));
			}
		});
	});
  • MediaWiki:Group-user.css - add user-show stuff
	.apt-user-show {display: block !important;} // code to hide creation of pages on main page if not logged in.
  • MediaWiki:Common.css - add searchable tables code and DocLink styles
	.apt-search-clear {background: url("images/Clear_Icon.png") no-repeat 5px center; padding:5px 5px 5px 30px; border:0; background-size: 1.0em;} // code to style the clear button for searchable tables
	.apt-doclink {box-sizing: border-box;font-family: "Google Sans", Roboto, Arial, sans-serif;line-height: normal;background: url(images/pdf.png) no-repeat 5px center;background-size: 1.0em;padding: 0.1em 0.5em 0.1em 1.5em;font-size: smaller;}
  • Change Template:DocLink to use class rather than inline style - see version in my MTS.
  • "Download as PDF" to "Print as PDF" - e.g. "Print as PDF tab in the tab bar, typically on the top of the screen".
  • Change Templates:
    • All templates - add TemplateData - see my wiki for annotated templates.
    • DocLink - new format.
      • Doc_TitleNew - change OBS logo so it has "|Logo|link=" at the end.
      • Doc_Title - change OBS logo so it has "|Logo|link=" at the end.
  • MediaWiki:Common.js - remove any editing toolbar js.
  • MediaWiki:Vector.js - fix left panel - check the existing code in EPOD
  • MediaWiki:Vector.css - h1, h2, h3, h4 {font-family: sans-serif !important;}.
  • MediaWiki:Timeless.css - h1,h2,h3,h4, #p-logo-text a {font-family: 'Segoe UI','Segoe UI Emoji','Segoe UI Symbol','Lato','Liberation Sans','Noto Sans','Helvetica Neue','Helvetica',sans-serif !important;} #p-logo-text a { font-variant: normal !important;}.
  • Site:About/General Disclaimer/Privacy Policy (from link in footer) - make sure links Aptean, including images. Copy from new MTS site.


Extensions to enable in LocalSettings:

  • wfLoadExtension( 'CategoryTree' );
  • wfLoadExtension( 'CodeEditor' );
  • wfLoadExtension( 'ConfirmEdit' );
  • wfLoadExtension( 'InputBox' );
  • wfLoadExtension( 'Nuke' );
  • wfLoadExtension( 'PageImages' );
  • wfLoadExtension( 'ParserFunctions' );
  • wfLoadExtension( 'PdfHandler' );
  • wfLoadExtension( 'Renameuser' );
  • wfLoadExtension( 'ReplaceText' );
  • wfLoadExtension( 'TextExtracts' );
  • wfLoadExtension( 'WikiEditor' );
  • wfLoadExtension( 'PdfBook' );
  • wfLoadExtension( 'Variables' );
  • require_once "$IP/extensions/NumberFormat/NumberFormat.php";
  • require_once "$IP/extensions/GoogleTranslator/GoogleTranslator.php";
  • wfLoadExtension( 'TemplateData' );
  • wfLoadExtension( 'TemplateWizard' );
  • wfLoadExtension( 'VisualEditor' );
  • wfLoadExtension( 'Gadgets' );


Including all necessary settings for each - see MTS LocalSettings for details


Extensions to remove if enabled:

  • HistoryOfPage - just doesn't work - affects OBSHUB.
  • MakeArticle - replaced with InputBox
  • CreateArticle - replaced with InputBox
  • JSpoiler - partially replaced with Group-user.css
  • PasswordReset - doesn't work, archived
  • LocalisationUpdate - not used


Clean up the Extensions folder to get rid of unused extensions (above and any other old ones we may have )


Extensions to update if enabled:

  • PdfBook
  • Variables (will eventually be a problem as is deprecated, but not now)


Extensions to add if not present:

  • GoogleTranslator
  • TemplateWizard
  • VisualEditor
  • Gadgets


Consider the following new extensions:

  • Extension:InlineComments - could use in OBS HUB
  • Extension:SmartComments - could use in OBS HUB
  • Extension:SimpleBatchUpload - would make initial document image uploading much easier


Visual Editor Gadgets

See Assist Visual Editor Gadgets for details of how to do this.

Add the following gadgets:

  • center


Hack Fixes

These are a number of things that may be required on some or all Assists, but commonly OBSHUB is the one that will require most hacks.

  • SectionProfiler. Compare current local MW version to that on the install to see what this needs doing. SectionProfiler.php Location: includes/profiler/
  • OBS Hub:
    • Massive issues - Extension: variables might not work now or in the future. Will require a change to all existing specs to replace - a work in progress and can be ignored for now.
    • bulk replace (excluding templates):
      • "[[Category:{{#var:Client}} FS]]" with "[[Category:{{#var:Client}} FS]]\r\n[[Category:{{#var:SystemCode}}]]"
      • "{{#vardefine:System|''CALIDUS'' ePOD}}" with "{{#vardefine:System|''CALIDUS'' ePOD}}\r\n{{#vardefine:SystemCode|EPOD}}]]"
      • "{{#vardefine:System|''CALIDUS'' ePOD}}" with "{{#vardefine:System|''CALIDUS'' ePOD}}\r\n{{#vardefine:SystemCode|EPOD}}]]"
      • Force the bulk edits through from commandline. See extension Extension:Replace Text notes for how to do this (you can access this from Special:Version). Essentially, execute RunJobs.php (perhaps multiple times).
      • Update all FS/SDD/REQ with new appendix, or will not produce properly. Note that this may only be required on OBS Hub - others don't use HistoryOfPage.
      • Change Templates:
        • Doc_AppendixNew2 - new version, without HOP and authorisation.
        • Doc_AppendixAuth - new.
        • FS - new Doc_AppendixNew2/Doc_AppendixAuth format.
        • REQ - new Doc_AppendixNew2/Doc_AppendixAuth format.
        • EstmateCostDetails2020 - £ sign.