Thread:Help talk:Installation/MW 1.22 and SMW 1.9beta install/upgrade

Disclaimer: I ain't any of sysadmin, MW, or SMW expert. This is why I didn't dare creating a new page. On the other hand it seems to work on my test server and production wikis.

After mid-november 2013, you should learn how to use composer, a PHP dependency manager.

 Prerequisites 
 * PHP 5.3.2+
 * MySQL 5.0.2+
 * CURL (you should have that)
 * MediaWiki 1.22 (nov 2013)

 Install composer 

If you run several wikis, it's probably best to install composer on system level: cd /some/src curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer

 Prepare for updating SMW 

cd /your-mediawiki-install
 * Go to your MediaWiki installation (NOT the extension directory)

rm -r extensions/SemanticMediaWiki rm -r extensions/Validator rm -r extensions/DataValues
 * If you already got SMW installed, kill it

Changes to Localsettings.php

(1) kill all the lines that load SMW and required extensions. You really have to start clean, for example kill require_once( "$IP/extensions/DataValues/DataValues.php" ); require_once( "$IP/extensions/Validator/Validator.php" ); include_once("$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php")

(2) Keep the following: $smwgNamespaceIndex = 108; // In case other custom extensions were use before. Not necessary for fresh mediawiki installs enableSemantics('edutechwiki.unige.ch'); // adjust to yours


 * Make damn sure that  is the very first line of code that deals with SMW. E.g. if PHP sees the line   first, it will start numbering SMW extensions at 104 or something and you won't see your properties, forms, etc. defined in your existing wiki. You then may panic and do weird stuff that won't help your wiki very much.

(3) Comment out all other MediaWiki extensions

 (Re)install SMW  composer require mediawiki/semantic-media-wiki "dev-master"
 * Now get and install SemanticMediaWiki 1.9beta, plus its dependencies with composer


 * In your MediaWiki installations you now will have:
 * A vendor directory
 * Additions to the extensions directory


 * There is no need to edit LocalSetting.php. All extensions will auto-load, i.e. MW 1.22 provides direct support for composer !! However, you later can edit LocalSettings.php to change settings.

 (Re)configure SMW 

php maintenance/update.php

 Kill older SMW extensions 


 * Kill the following old versions (As of dec 12 2013, other extensions like SemanticForms have to be installed manually)

rm -r extensions/Maps/ rm -r extensions/SemanticMaps/ rm -r extensions/SemanticResultFormats

 Install (some) SMW extensions using the composer 

composer require mediawiki/maps "dev-master" composer require mediawiki/semantic-maps "dev-master" composer require mediawiki/semantic-result-formats "dev-master"


 * LocalSettings.php


 * Again, do not add any includes. These files are loaded (I believe) trough vendor/autoload.php

 Add other SMW extension through GIT 

Of course, you then have to edit LocalSettings.php to include these files, for example it could look like this:

Finally, consider refreshing the whole database. You likely messed up something, somwhere:

php SMW_refreshData.php -f -d 50 -v