r26390 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26389‎ | r26390 | r26391 >
Date:08:33, 4 October 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
+some extension hooks (needed by Halo extensions)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/maintenance/SMW_setup.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/maintenance/SMW_setup.php
@@ -20,6 +20,7 @@
2121 require_once($smwgIP . '/includes/SMW_GlobalFunctions.php');
2222
2323 smwfGetStore()->setup();
 24+wfRunHooks('smwInitializeTables');
2425
2526 print "\n\nDone.\n";
2627
Index: trunk/extensions/SemanticMediaWiki/specials/SMWAdmin/SMW_SpecialSMWAdmin.php
@@ -53,6 +53,7 @@
5454 print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\" dir=\"ltr\">\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Setting up Storage for Semantic MediaWiki</title></head><body><p><pre>";
5555 header( "Content-type: text/html; charset=UTF-8" );
5656 $result = smwfGetStore()->setup();
 57+ wfRunHooks('smwInitializeTables');
5758 print '</pre></p>';
5859 if ($result === true) {
5960 print '<p><b>The storage engine was set up successfully.</b></p>';
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php
@@ -113,8 +113,12 @@
114114 case SMW_SP_SUBPROPERTY_OF:
115115 $result = SMWDataValueFactory::newTypeIDValue('_wpg', $value, $caption);
116116 break;
117 - default: // special property was created but not added here; this is bad but we still are nice
118 - $result = SMWDataValueFactory::newTypeIDValue('_str', $value, $caption);
 117+ default:
 118+ /// NOTE: unstable hook, future versions might have better ways of enabling extensions to add properties
 119+ wfRunHooks('smwNewSpecialValue', array($specialprop, $value, $caption, &$result));
 120+ if (!isset($result)) { // special property was created but not added here; this is bad but we still are nice
 121+ $result = SMWDataValueFactory::newTypeIDValue('_str', $value, $caption);
 122+ }
119123 }
120124
121125 if ($value !== false) {

Status & tagging log