Jump to content

User:Rogerhc/upgrade 1.31.1 LTS to 1.35.1 LTS (2021)

From mediawiki.org

Upgrade of "production".com MW 1.31.1 to MW 1.35.1.

Manual:Upgrading << READ THAT FIRST, INSTEAD and BECAUSE.

https://shorturls.redwerks.org << DO -- Short URL (but root level short URL is not okay with Visual Editor so I will disable Extension:VisualEditor.

The following is a spiderweb intended to catch flys. Ym. Thoughts? No, flys.

First a dev.com wiki

[edit]

Setup "dev".com wiki.

I like to start with a fresh default install of the new MW version, then add the files (images, LocalSettings.php, extensions and configs) that production.com requires, then dump the production database in and test.


PHP version

[edit]

PHP version of production.com MW1.31.1 is PHP 7.2 but MW1.35.1 requires PHP 7.3 or higher. Well, MW1.31.1 is compatible with PHP 7.3 but not PHP 7.4. So set production.com webhost to PHP 7.3, which both versions are compatible with.

cPanel >> Software >> Select PHP Version (set to PHP 7.3).

Wget MW1.35.1

[edit]

See Manual:Upgrading#Command_line

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


Test

[edit]

Test the dev.com wiki.

Vanilla install works okay.

Short URL

[edit]

Root level short URL as in dev.com/Page_Name

.htaccess magic

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

[edit]

SSL

[edit]

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.

[edit]

Test

[edit]

Done testing.

Everything seems to work except Visual Editor. I will simply comment out the Extension:VisualEditor call in LocalSettings.php. We have never had Visual Editor. We will do without it for now. Maybe it will work next time.

Time to do upgrade on production.

Then the production.com wiki

[edit]

Do a full backup of production.com wiki (files AND database). Then replace production.com wiki files with the new dev.com wiki files, and update the database (maintenance/update.php). Don't bring the database over from dev.com. We don't want the testing cruft.

Send it over

[edit]

scp the new wiki files over to the production server.

ACtually, don't. The dev.com stuff now has testing footprints all over it. Not best.

I'll just wget the new MW1.35.1 and then cut and paste in the relevant things, such as:

  • LocalSettings.php stuff
  • .htaccess stuff
  • images/.htaccess stuff

Freeze the exp.com wiki

[edit]

Set no-edit at bottom of LocalSettings.php.

Clear jobs que

[edit]

see Manual:runJobs.php

$ php maintenance/runJobs.php

Backup exp.com

[edit]

cp

[edit]

cp the files to exp.com.MW1.31.1-20210101

dump

[edit]

dump the database to exp.MW1.31.1-20210101.sql

Switch MW1.31.1 to MW1.35.1

[edit]
$ mv wikidir wikidirOLD; mv wikidirNEW wikidir

Update database

[edit]

maintenance/update.php or something

Unfreeze exp.com

[edit]

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


Test

[edit]
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).