Sunday, August 17, 2008

Semantic Mediawiki Problems

This morning I installed Semantic Mediawiki on a server for the first time and encountered a few problems with permissions. This is a very brief rundown on how I got it installed and how I fixed the problems I encountered...

First off, on installation, I had problems when clicking Initialise or upgrade tables button. To get around these problems, I used the database's root user to install Semantic mediawiki by changing the $wgDBuser and $wgDBpassword parameters in teh LocalSettings.php file.

After this, nothing worked. Whenever I tried to execute a semantic query, I got the following error:

...from within function "SMW::getCategoryTable". MySQL returned error "1142: DROP command denied to user ... for table 'smw_newcats' (localhost)".


The solution to this problem is to cd to $WIKIMEDIAROOT/extensions/SemanticMediaWiki/includes/storage and edit SMW_SQLStore.php to make the following modifications...

In function getCategoryTable (~line 1644 in my version):
  • #$db->query('DROP TABLE smw_newcats', 'SMW::getCategoryTable');
  • #$db->query('DROP TABLE smw_rescats', 'SMW::getCategoryTable');
  • $db->query('DROP TEMPORARY TABLE smw_newcats', 'SMW::getCategoryTable');
  • $db->query('DROP TEMPORARY TABLE smw_rescats', 'SMW::getCategoryTable');

In function getPropertyTable (~line 1706 in my version):
  • #$db->query('DROP TABLE smw_new','SMW::getPropertyTable');
  • #$db->query('DROP TABLE smw_res','SMW::getPropertyTable');
  • $db->query('DROP TEMPORARY TABLE smw_new', 'SMW::getPropertyTable');
  • $db->query('DROP TEMPORARY TABLE smw_res', 'SMW::getPropertyTable');

Save the changes, re-execute the query, and everything should be hunky dory.

No comments: