r89342 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89341‎ | r89342 | r89343 >
Date:15:11, 2 June 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Adding compat method
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php
@@ -315,4 +315,23 @@
316316 return $smwgSparqlDatabaseMaster;
317317 }
318318
319 -function
\ No newline at end of file
 319+/**
 320+ * Compatibility helper for using Linker methods.
 321+ * MW 1.16 has a Linker with non-static methods,
 322+ * where in MW 1.19 they are static, and a DummyLinker
 323+ * class is introduced, which can be instantaited for
 324+ * compat reasons.
 325+ *
 326+ * @since 1.6
 327+ *
 328+ * @return Linker or DummyLinker
 329+ */
 330+function smwfGetLinker() {
 331+ static $linker = false;
 332+
 333+ if ( $linker === false ) {
 334+ $linker = class_exists( 'DummyLinker' ) ? new DummyLinker() : new Linker();
 335+ }
 336+
 337+ return $linker;
 338+}
\ No newline at end of file

Status & tagging log