Page MenuHomePhabricator

Make update.php output some extra debugging information
Open, Needs TriagePublic

Description

It'd be useful at the top of update.php if we dumped extra useful information for people dumping update.php for bug reports. Basically the "Installed software" part of Special:Version should be dumped so they don't have to provide the information separately

We currently get the following from update.php

MediaWiki 1.31.0 Updater

Your composer.lock file is up to date with current dependencies!
Going to run database updates for my_wiki
Depending on the size of your database this may take a while!
Abort with control-c in the next five seconds (skip this countdown with --quick) ... 0

But this info on Special:Version

MediaWiki	1.34.0-wmf.10 (5b7d3f4)
16:43, 25 June 2019
HHVM	3.18.6-dev (srv)
MariaDB	10.1.39-MariaDB
ICU	57.1
LilyPond	2.18.2
Elasticsearch	6.5.4
LuaSandbox	2.0.14
Lua	5.1.5

Basically re-implement/steal SpecialVersion::softwareInformation() into update.php header. I dunno if it's worth refactoring out the HTML stuff, or just copy out, simplify and make sure we're still calling the hooks SoftwareInfo

	public static function softwareInformation() {
		$dbr = wfGetDB( DB_REPLICA );

		// Put the software in an array of form 'name' => 'version'. All messages should
		// be loaded here, so feel free to use wfMessage in the 'name'. Raw HTML or
		// wikimarkup can be used.
		$software = [];
		$software['[https://www.mediawiki.org/ MediaWiki]'] = self::getVersionLinked();
		if ( wfIsHHVM() ) {
			$software['[https://hhvm.com/ HHVM]'] = HHVM_VERSION . " (" . PHP_SAPI . ")";
		} else {
			$software['[https://php.net/ PHP]'] = PHP_VERSION . " (" . PHP_SAPI . ")";
		}
		$software[$dbr->getSoftwareLink()] = $dbr->getServerInfo();

		if ( defined( 'INTL_ICU_VERSION' ) ) {
			$software['[http://site.icu-project.org/ ICU]'] = INTL_ICU_VERSION;
		}

		// Allow a hook to add/remove items.
		Hooks::run( 'SoftwareInfo', [ &$software ] );

		$out = Xml::element(
				'h2',
				[ 'id' => 'mw-version-software' ],
				wfMessage( 'version-software' )->text()
			) .
				Xml::openElement( 'table', [ 'class' => 'wikitable plainlinks', 'id' => 'sv-software' ] ) .
				"<tr>
					<th>" . wfMessage( 'version-software-product' )->text() . "</th>
					<th>" . wfMessage( 'version-software-version' )->text() . "</th>
				</tr>\n";

		foreach ( $software as $name => $version ) {
			$out .= "<tr>
					<td>" . $name . "</td>
					<td dir=\"ltr\">" . $version . "</td>
				</tr>\n";
		}

		return $out . Xml::closeElement( 'table' );
	}

Event Timeline

Change 519235 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/core@master] Output more MW version info in update.php

https://gerrit.wikimedia.org/r/519235

Change 519235 merged by jenkins-bot:
[mediawiki/core@master] Output more MW version info in update.php

https://gerrit.wikimedia.org/r/519235

Nikerabbit subscribed.

The output looks like this to me:

php maintenance/update.php 
MediaWiki 1.34.0-alpha Updater

[https://www.mediawiki.org/ MediaWiki]: [https://www.mediawiki.org/wiki/MediaWiki_1.34 1.34.0-alpha] [https://gerrit.wikimedia.org/g/mediawiki/core.git/+/70af2266067c79d99be6e171e975c8dfaedf9a58 (70af226)]<br/>10:45, 15 July 2019
[https://php.net/ PHP]: 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 (cli)
[{{int:version-db-mariadb-url}} MariaDB]: 10.0.38-MariaDB-0ubuntu0.16.04.1
[http://site.icu-project.org/ ICU]: 64.1
[https://www.elastic.co/products/elasticsearch Elasticsearch]: 5.5.2

The output looks like this to me:

php maintenance/update.php 
MediaWiki 1.34.0-alpha Updater

[https://www.mediawiki.org/ MediaWiki]: [https://www.mediawiki.org/wiki/MediaWiki_1.34 1.34.0-alpha] [https://gerrit.wikimedia.org/g/mediawiki/core.git/+/70af2266067c79d99be6e171e975c8dfaedf9a58 (70af226)]<br/>10:45, 15 July 2019
[https://php.net/ PHP]: 7.1.30-1+ubuntu16.04.1+deb.sury.org+1 (cli)
[{{int:version-db-mariadb-url}} MariaDB]: 10.0.38-MariaDB-0ubuntu0.16.04.1
[http://site.icu-project.org/ ICU]: 64.1
[https://www.elastic.co/products/elasticsearch Elasticsearch]: 5.5.2

It was supposed to, just giving the basic debugging information

Anyway, reverted to fix T227489, so it doesn't land partially/potentially broken into 1.34

We should still do something like this in some form, but without invoking l10n cache type stuff. Ideally, without adding a separate additional hook to do the same as SoftwareInfo to do the same job

For better output, doing some sort of string parsing might work... but there's no standard formats; both sides can potentially be a url... Depends if/how much of the information we want to keep

Maybe render to html and strip tags as a starters? The links are not so important imho.

Maybe render to html and strip tags as a starters? The links are not so important imho.

I'd agree. It's just getting the text/display string of the url, and the version number output in the update.php output