From MediaWiki.org
Jump to navigation Jump to search


  • Ensure your PHP has multibyte functions enabled. If you do not have the possibility to do that, you might decide to do without multibyte support. In that case, just delete all occurences of mb_ from StackFunctions.php.
  • Ensure your PHP is compiled with the mhash library which is needed to sign the serialized data with HMACs. If this is not possible to you, it is easy to patch the StackFunctions code to do without HMACs. However, this is strongly discouraged because anybody might upload serialzed PHP objects and use the __wakeup method to execute arbitrary PHP code on your server.


  • Unzip the distribution zipfile in the subdirectory extensions of your mediawiki installation.
  • Ensure $wgSecretKey is set in your LocalSettings.php (before the below mentioned require_once statement).
  • Add the following line to your LocalSettings.php:
require_once( "extensions/StackFunctions/StackFunctions.php" );
All parameters explained in the following must be set after this line.
  • If you want to use something different from $wgSecretKey to sign serialized code, set ExtStackFunctions::$mAuthKey to some random sequence of characters.
  • If you want to enable Database querying, also add the following line to your LocalSettings.php:
ExtStackFunctions::$mEnableQuery = true;
  • It is recommanded to set up a distinct tablespace for prologs. To do that, copy something like this to your LocalSettings.php:
# extra namespace for StackFunctions Prologs
define('NS_PROLOG', 200);
define('NS_PROLOG_TALK', 201);

$wgExtraNamespaces = array(
  NS_PROLOG => "Prolog",
  NS_PROLOG_TALK => "Prolog_Talk" );

ExtStackFunctions::$mPrologNamespace = NS_PROLOG;
  • By default, StackFunctions use gzdeflate with maximum compression to compress serialized code. If you want to use different compression functions and/or parameters, you may copy something like this to your LocalSettings.php:
ExtStackFunctions::$mCompress = 'gzcompress';
ExtStackFunctions::$mCompressArg = 1;
ExtStackFunctions::$mDecompress = 'gzuncompress';

Installation of the documentation[edit]

The package comes with a set of MediaWiki pages for documentation, which are the same you see under MW:Extension:StackFunctions. To install all documentation as subpages of Help:Extension:StackFunctions, simply import the file pages.xml into your MediaWiki. If you prefer another base page, replace Help:Extension:StackFunctions by something of your choice. The links between the pages work only if Help:Subpages are enabled for the namespace where the pages are imported, so you should either enable them for your Help namespace or put the pages elsewhere or edit the pages accordingly.

The base page (by default, Help:Extension:StackFunctions) itself is intentionally not provided becuase you will write it according to the needs of your local installation. The simplest way to do that is to put the following in your base page: