User:Rogerhc/upgrade 1.35.1 LTS to 1.39.1 LTS (2023)

Upgrade "production".com MW 1.35.1 to MW 1.39.1.

Manual:Upgrading << READ

https://shorturls.redwerks.org << DO

slowly

PHP version
MW 1.35.1 ("mostly -- may have report minor issues") and MW 1.39.1 are both compatible with PHP 8. So set server to PHP 8.1 now. (Or try PHP 7.4.3 which both are okay with.)

cPanel >> Software >> Select PHP Version (change from PHP 7.3 to 8.1).

Wget MW1.39.1
See Manual:Upgrading

$ cd /path/to/your/new/installation/ $ wget https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.1.tar.gz $ tar -xvzf mediawiki-1.39.1.tar.gz $ rm mediawiki-1.39.1.tar.gz

Short URL
Root level short URL as in exp.com/Page_Name


 * .htaccess docs
 * https://httpd.apache.org/docs/trunk/mod/mod_rewrite.html -- The Mod
 * https://httpd.apache.org/docs/trunk/rewrite/intro.html -- Intro
 * https://httpd.apache.org/docs/trunk/rewrite/remapping.html -- Remapping

Redwerks.org
https://shorturls.redwerks.org/

generated this from my production https://exp.com MW 1.35.1 today 2023.

[X] Include 404 thumbnail handler config

/LocalSettings.php

This configuration is meant to go into your LocalSettings.php. There should be a small block already in there that is similar to this, replace that with these settings to setup the MediaWiki side of the Short URL config.

$wgScriptPath = ""; $wgArticlePath = "/$1"; $wgUsePathInfo = true;
 * 1) The URL base path to the directory containing the wiki;
 * 2) defaults for all runtime URL paths are based off of this.
 * 3) For more information on customizing the URLs
 * 4) (like /w/index.php/Page_title to /wiki/Page_title) please see:
 * 5) https://www.mediawiki.org/wiki/Manual:Short_URL

$wgEnableUploads = true; $wgGenerateThumbnailOnParse = false;
 * 1) To enable image uploads, make sure the 'images' directory
 * 2) is writable, then set this to true:

/.htaccess

These rules go inside the .htaccess file at "/.htaccess". If a .htaccess file already exists there you should merge these rules in with it. However if you have any existing rewrite rules for your article path or thumbnail handler you should probably erase those to avoid conflicting with these.

RewriteEngine On RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php [L]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteRule ^/?images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2 [L,QSA,B]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteRule ^/?images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]

From MW 1.35.1 upgrade notes
First attempt using .htaccess and LocalSettings.php from production.com failed.

Fixed with .htaccess generated at https://shorturls.redwerks.org/

But that failed Visual Editor test, got error:

Error contacting the Parsoid/RESTBase server (HTTP 404)

Fixed by adding this to .htaccess:

RewriteCond %{HTTP_USER_AGENT} !^(VisualEditor)

See https://www.mediawiki.org/w/index.php?title=Topic:Vv35plp6g16qno0s&topic_showPostId=vv4jia2ip0swopod#flow-post-vv4jia2ip0swopod

Here's what the https://shorturls.redwerks.org config I'm using + that^ looks like, and it's working! :)

RewriteEngine On RewriteCond %{REQUEST_URI} !^(static) RewriteCond %{HTTP_USER_AGENT} !^(VisualEditor) RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php [L]

RewriteCond %{REQUEST_URI} !^(static) RewriteCond %{HTTP_USER_AGENT} !^(VisualEditor) RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteRule ^/?images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2 [L,QSA,B]

RewriteCond %{REQUEST_URI} !^(static) RewriteCond %{HTTP_USER_AGENT} !^(VisualEditor) RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteRule ^/?images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]

I also added per LapisLazuli33 "flying carpet" but can't see what it does: RewriteCond %{REQUEST_URI} !^(static)

My note on MW User:Dantman's talk page: https://www.mediawiki.org/wiki/Topic:W2ahzg3yi27mvp9y

Related links

 * https://www.mediawiki.org/wiki/Topic:W2ahzg3yi27mvp9y -- my notes to Dantman (of MW and Redwerks)
 * https://shorturls.redwerks.org -- Dantman's short URL config tool.
 * https://www.mediawiki.org/w/index.php?title=Topic:Vv35plp6g16qno0s&topic_showPostId=vv4jia2ip0swopod#flow-post-vv4jia2ip0swopod -- LapisLazuli33 on magic carpet who knew
 * https://www.mediawiki.org/wiki/VisualEditor/Feedback -- Visual Editor Feedback page
 * Phabricator
 * https://phabricator.wikimedia.org/T270376 VisualeEditor: Error contacting the Parsoid/RESTBase server (HTTP 404)
 * https://phabricator.wikimedia.org/T263928 VisualEditor in 1.35 not working (404 / Permanent Loading)
 * https://phabricator.wikimedia.org/T261921 Visual Editor + Apache bug. Visual Editor not working when editing or creating a page with : or / characters in the Title. e.g. http://localhost/w/index.php/User:John/Newpage

Note from MW 1.35.1 upgrade
Dang, above works for http:// but not for https://. When I switch to https:// I get this error when I click the VisualEditor "edit" link on a page:

Error contacting the Parsoid/RESTBase server: (curl error: 60) SSL peer certificate or SSH remote key was not OK

I am using a self-signed SSL certificate on dev.com. Don't know if that is an issue.

YES! Visual Editor works on my production wiki, which has a properly authorized SSL certificate. Visual Editor throws above error on my test wiki which only has self authorized SSL certificate. So I guess Visual Editor is not currently compatible with self authorized SSL certificate.

Related links

 * https://letsencrypt.org/getting-started/ -- free SSL certificate
 * https://certbot.eff.org/ -- tool to help with SSL certificate authentication

I'll just wget the new MW1.39.1 and then cut and paste in the relevant things, such as:
 * LocalSettings.php
 * .htaccess
 * images/.htaccess

Remember And it's permissions
 * /images

Stop editing
Set no-edit at bottom of LocalSettings.php.

Clear jobs que
see Manual:runJobs.php $ php maintenance/runJobs.php

cp
cp the files to exp.com.MW1.35.1-2023

dump
dump the database to exp.MW1.35.1-2023.sql

See Manual:Upgrading

$ mysqldump --user=wikidb_user --password=wikidb_userpassword wikidb > file.sql

Switch live MW1.35.1 with live MW1.39.1
$ mv wikidir wikidirOLD; mv wikidirNEW wikidir

Update database
$ maintenance/update.php

Start editing
Comment out no-edit lock at bottom of LocalSettings.php.

Test
Once the upgrade has been completed, browse to the wiki and check that the following operations work as expected:


 * [ .. ] Viewing pages
 * [ .. ] Editing pages
 * [ .. ] Uploading a file
 * [ .. ] Visit Special:Version and check that the version shown is correct and that the extensions are present.

User:Oh dear some should test this


 * If it fails,
 * did you put .htaccess in? (I forget this too often! My short URSs require it! Otherwise I get 404.)


 * If it still fails,
 * revert to backup of old version (and reset PHP version in cpanel if needed).