Search code examples
phpsqlmediawiki

Determining MediaWiki version from the database only


Ok, so. My MediaWiki migration from a server in the U.S. to a server in Germany backfired, horribly, and I ended up with ONLY the database. The ENTIRE mediawiki installation was irrevocably lost.

I do NOT remember what version of MediaWiki the site was running, although it was semi-modern (sometime after January 2012).

The PostgreSQL database has been successfully restored in the new server.

Is there any SQL I can query to give me the version information? I have tried upgrading from 1.19 but it gives me all sorts of "columns already exist" errors and generally fails.


Solution

  • I recommends to simply upgrade to the latest version and not to worry about which version you had before.

    MediaWiki should upgrade gracefully from any version (after 1.5) to the current. However, it is possible that this is not as smooth with PostGres as it is with MySQL, and it's also possible that some extensions don't do this well.

    Please report any failures of the upgrade process to http://bugs.wikimedia.org.

    EDIT: to answer the original question: the best way to find the MediaWiki version by looking at the database would be this query:

    select max(ul_key) from updatelog where ul_key like 'updatelist-%';
    

    YMMV, however. This is not an official or recommended version check. It looks at a table used for logging database updates, and gives you the latest version found in entries that start with "updatelist". These entries may go away, or change appreance. Also, I'm not sure PG supports the LIKE syntax I gave.

    The best way to check your MediaWiki version is to look at Special:Version or, if the wiki isn't running, check $wgVersion in includes/DefaultSettings.php.