1

We are trying to upgrade from MediaWiki 1.30 to 1.31. We downloaded mediawiki-1.31.0.tar.gz from the MediaWiki site. The tarball was unpacked overtop of the old MediaWiki installation after backing up files. After the unpack we restored the old LocalSettings.php.

We are at Step 6 of the MediaWiki upgrade instructions:

  • Run the update script to check the database

When we run the update script from the mediawiki directory we get:

# php maintenance/update.php

Notice: Undefined index: SERVER_NAME in /var/www/html/w/includes/GlobalFunctions.php on line 1432

Notice: Undefined index: SERVER_NAME in /var/www/html/w/includes/GlobalFunctions.php on line 1432
MediaWiki 1.31.0 Updater

oojs/oojs-ui: 0.23.0 installed, 0.26.4 required.
pear/mail: not installed, 1.4.1 required.
pear/mail_mime: not installed, 1.10.2 required.
pear/mail_mime-decode: not installed, 1.5.5.2 required.
wikimedia/at-ease: not installed, 1.2.0 required.
wikimedia/html-formatter: 1.0.1 installed, 1.0.2 required.
wikimedia/ip-set: 1.1.0 installed, 1.2.0 required.
wikimedia/object-factory: not installed, 1.0.0 required.
wikimedia/php-session-serializer: 1.0.4 installed, 1.0.6 required.
wikimedia/purtle: 1.0.6 installed, 1.0.7 required.
wikimedia/relpath: 2.0.0 installed, 2.1.1 required.
wikimedia/remex-html: 1.0.1 installed, 1.0.3 required.
wikimedia/running-stat: 1.1.0 installed, 1.2.1 required.
wikimedia/utfnormal: 1.1.0 installed, 2.0.0 required.
wikimedia/wrappedstring: 2.2.0 installed, 2.3.0 required.
Error: your composer.lock file is not up to date. Run "composer update --no-dev" to install newer dependencies

Followed by:

# composer update --no-dev
-bash: composer: command not found

I found one post about it on MediaWiki's help forum: update.php says composer.lock not up to date. It was not helpful.

This is a production web server and it is missing some of the dev tools. In fact, it is a CentOS 7 server with PHP 7.0 from a different repo so I am not even sure we can install the right version of composer.

(We had to use the external repo because the native PHP was 5.7 or 5.8, if I recall correctly. PHP 5.7 or 5.8 only supports MediaWiki 1.24 or so, so we had to update to get the latest MediaWiki with security fixes).

None of us are web developers or web server admins by trade. When problems crop up like a failed upgrade then we struggle if the upgrade notes don't include solutions that work for us.

I guess my first question is, is it possible to download a mediawiki-1.31.0 tarball with everything needed for the upgrade? If so, where is it?

If not, then what else can we do to finish this upgrade?

2 Answers 2

1

Follow the instructions on https://getcomposer.org/download/ to download composer, then run mv composer.phar /usr/local/bin/composer to move it to a system wide location. If you get a permissions error when running that, try sudo mv composer.phar /usr/local/bin/composer to run the command with elevated permissions instead.

After that run composer -V to see if it worked (you should get some output). If that looks good then you should be able to run the command in your question successfully.

3
  • Thanks Tim. I kind of cringe at the thought of installing developer tools on a production server. Is there another way to finish the upgrade.
    – user40589
    Commented Jun 16, 2018 at 22:09
  • You could do this on a development server and upload the resulting files and DB changes, but I don't know enough about Mediawiki to know what would be involved. Commented Jun 17, 2018 at 7:27
  • You can run the update script with --skip-external-dependencies to suppress that error. That said, if your project dependencies are in an inconsistent state, it will probably end badly. (And if they aren't, you should not get that error, even if Composer is not installed.)
    – Tgr
    Commented Jun 19, 2018 at 10:10
0

I'm going to add an answer that seems like it should work but does not work. It seems like it should work because it does what the error message says to do. But I get the same error when running update.php.

Others may find it more useful than we did.

[root@ftpit wiki]# cat update-composer.sh

#!/usr/bin/env bash

WIKI_DIR=/var/www/html/wiki
for file in $(find "$WIKI_DIR/" -name 'composer.json'); do
    CDIR=$(pwd)
    FDIR=$(dirname "$file")

    echo "Updating $file"

    cd "$FDIR"
    composer update --no-dev
    cd "$CDIR"
done

[root@ftpit wiki]# bash update-composer.sh
Updating /var/www/html/wiki/vendor/oyejorge/less.php/composer.json
Updating /var/www/html/wiki/vendor/composer/semver/composer.json
Updating /var/www/html/wiki/vendor/pear/mail_mime-decode/composer.json
Updating /var/www/html/wiki/vendor/pear/mail/composer.json
Updating /var/www/html/wiki/vendor/pear/console_getopt/composer.json
Updating /var/www/html/wiki/vendor/pear/pear_exception/composer.json
Updating /var/www/html/wiki/vendor/pear/net_socket/composer.json
Updating /var/www/html/wiki/vendor/pear/mail_mime/composer.json
Updating /var/www/html/wiki/vendor/pear/net_smtp/composer.json
Updating /var/www/html/wiki/vendor/pear/pear-core-minimal/composer.json
Updating /var/www/html/wiki/vendor/liuggio/statsd-php-client/composer.json
Updating /var/www/html/wiki/vendor/justinrainbowiki/json-schema/composer.json
Updating /var/www/html/wiki/vendor/pimple/pimple/composer.json
Updating /var/www/html/wiki/vendor/james-heinrich/getid3/composer.json
Updating /var/www/html/wiki/vendor/wikimedia/assert/composer.json
Updating /var/www/html/wiki/vendor/wikimedia/composer-merge-plugin/composer.json
Updating /var/www/html/wiki/vendor/wikimedia/purtle/composer.json
Updating /var/www/html/wiki/vendor/mustangostang/spyc/composer.json
Updating /var/www/html/wiki/vendor/symfony/process/composer.json
Updating /var/www/html/wiki/vendor/firebase/php-jwt/composer.json
Updating /var/www/html/wiki/vendor/zordius/lightncandy/composer.json
Updating /var/www/html/wiki/vendor/psr/log/composer.json
Updating /var/www/html/wiki/vendor/composer.json
Updating /var/www/html/wiki/vendor/cssjanus/cssjanus/composer.json
Updating /var/www/html/wiki/vendor/stil/gd-text/composer.json
Updating /var/www/html/wiki/vendor/ruflin/elastica/composer.json
Updating /var/www/html/wiki/vendor/monolog/monolog/composer.json
Updating /var/www/html/wiki/skins/Refreshed/composer.json
Updating /var/www/html/wiki/skins/Erudite/composer.json
Updating /var/www/html/wiki/skins/Truglass/composer.json
Updating /var/www/html/wiki/skins/MonoBook/composer.json
Updating /var/www/html/wiki/skins/WPtouch/composer.json
Updating /var/www/html/wiki/skins/CologneBlue/composer.json
Updating /var/www/html/wiki/skins/Dgraph/composer.json
Updating /var/www/html/wiki/skins/Splash/composer.json
Updating /var/www/html/wiki/skins/Bouquet/composer.json
Updating /var/www/html/wiki/skins/GreyStuff/composer.json
Updating /var/www/html/wiki/skins/DarkVector/composer.json
Updating /var/www/html/wiki/skins/Material/composer.json
Updating /var/www/html/wiki/skins/Daddio/composer.json
Updating /var/www/html/wiki/skins/Gamepress/composer.json
Updating /var/www/html/wiki/skins/Metrolook/composer.json
Updating /var/www/html/wiki/skins/Timeless/composer.json
Updating /var/www/html/wiki/skins/Nostalgia/composer.json
Updating /var/www/html/wiki/skins/Modern/composer.json
Updating /var/www/html/wiki/skins/Foreground/composer.json
Updating /var/www/html/wiki/skins/DeskMessMirrored/composer.json
Updating /var/www/html/wiki/skins/BlueSky/composer.json
Updating /var/www/html/wiki/skins/Vector/composer.json
Updating /var/www/html/wiki/extensions/Nuke/composer.json
Updating /var/www/html/wiki/extensions/CiteThisPage/composer.json
Updating /var/www/html/wiki/extensions/SyntaxHighlight_GeSHi/composer.json
Updating /var/www/html/wiki/extensions/ConfirmEdit/composer.json
Updating /var/www/html/wiki/extensions/ReplaceText/composer.json
Updating /var/www/html/wiki/extensions/Interwiki/composer.json
Updating /var/www/html/wiki/extensions/Gadgets/composer.json
Updating /var/www/html/wiki/extensions/OATHAuth/composer.json
Updating /var/www/html/wiki/extensions/CodeEditor/composer.json
Updating /var/www/html/wiki/extensions/ParserFunctions/composer.json
Updating /var/www/html/wiki/extensions/TitleBlacklist/composer.json
Updating /var/www/html/wiki/extensions/Recaptcha/composer.json
Updating /var/www/html/wiki/extensions/Bootstrap/composer.json
Updating /var/www/html/wiki/extensions/SpamBlacklist/composer.json
Updating /var/www/html/wiki/extensions/AllTimeZones/composer.json
Updating /var/www/html/wiki/extensions/MobileFrontend/composer.json
Updating /var/www/html/wiki/extensions/InputBox/composer.json
Updating /var/www/html/wiki/extensions/Poem/composer.json
Updating /var/www/html/wiki/extensions/Renameuser/composer.json
Updating /var/www/html/wiki/extensions/WikiEditor/composer.json
Updating /var/www/html/wiki/extensions/PdfHandler/composer.json
Updating /var/www/html/wiki/extensions/Cite/composer.json
Updating /var/www/html/wiki/extensions/AntiSpoof/composer.json
Updating /var/www/html/wiki/extensions/BlockAndNuke/composer.json
Updating /var/www/html/wiki/extensions/MultimediaViewer/composer.json
Updating /var/www/html/wiki/extensions/LocalisationUpdate/composer.json
Updating /var/www/html/wiki/extensions/CategoryTree/composer.json
Updating /var/www/html/wiki/extensions/ImageMap/composer.json
Updating /var/www/html/wiki/extensions/reCaptcha/composer.json
Updating /var/www/html/wiki/extensions/Math/composer.json
Updating /var/www/html/wiki/composer.json
1
  • That appears to just run composer update for each extension, which won't work if you don't have composer installed. Commented Jun 17, 2018 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.