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.
- PHP 5.3.2+
- MySQL 5.0.2+
- CURL (you should have that)
- MediaWiki 1.22 (nov 2013)
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
- Go to your MediaWiki installation (NOT the extension directory)
- If you already got SMW installed, kill it
rm -r extensions/SemanticMediaWiki rm -r extensions/Validator rm -r extensions/DataValues
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
$smwgNamespaceIndex = 108;is the very first line of code that deals with SMW. E.g. if PHP sees the line
enableSemantics(...)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
- Now get and install SemanticMediaWiki 1.9beta, plus its dependencies with composer
composer require mediawiki/semantic-media-wiki "dev-master"
- 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.
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"
- Again, do not add any includes. These files are loaded (I believe) trough vendor/autoload.php
Add other SMW extension through GIT
cd extensions git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticForms.git git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticFormsInputs.git git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticDrilldown.git git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/AdminLinks.git
Of course, you then have to edit LocalSettings.php to include these files, for example it could look like this:
$smwgNamespaceIndex = 108; enableSemantics('edutechwiki.unige.ch'); // adjust to yours $smwgShowFactbox = SMW_FACTBOX_NONEMPTY; // $smwgShowFactbox = SMW_FACTBOX_HIDDEN; include_once("$IP/extensions/SemanticForms/SemanticForms.php"); # If one or more of your fields can contain internal links entered by users (e.g., "This is a [[cat]]") $smwgLinksInValues = true; # Semantic Drilldown. Needs yet another namespace $sdgNamespaceIndex = 118; include_once("$IP/extensions/SemanticDrilldown/SemanticDrilldown.php"); # Semantic Forms Inputs require_once("$IP/extensions/SemanticFormsInputs/SemanticFormsInputs.php"); # AdminLinks include_once("$IP/extensions/AdminLinks/AdminLinks.php");
Finally, consider refreshing the whole database. You likely messed up something, somwhere:
php SMW_refreshData.php -f -d 50 -v
Looks good to me. I will give it a shot. Just to emphasize: One really needs to use MW 1.22+ since using Composer is frankly imho not an option for earlier versions of MediaWiki. The Extension Installer extension sadly moves all the code into a subdirectory "extensions" of its own directory which will definitively create even more confusion on top of this already very big habitual change. I works but the next upgrade always dreads. :|
I completely messed up things with MW 1.21.x and the "ExtensionInstaller" extension. Apparently or luckily this approach works as expected, too. This should also work for MW 1.19.x and 1.20.x
Hello Daniel, I used the text in your post to start writing a more complete installation instruction for SMW 1.9 with Composer. It is not ready yet. Regards.
Yeah, these instructions inspired me to create the new page on installing and updating SWM. It is pretty difficult to do since you have to decide with reality to take into account here, e.g. Windows or Linux, shell access / no shell access, the user level etc., etc. So and educated guess what to cater for will always have to be done. You are using a Windows server for your SMW?
Hello. Yes, we are using Windows Server 2008 to run our Wiki's. The coming weeks I want to update MW & SMW and all other extensions. I am almost finished checking what needs to be done so that it works in one go and "nothing" goes wrong :). It is true that there are a lot of ways how to tackle an update but either Windows or Linux when you are using composer it works the same on both, well almost.