tom.drastic.net

Archives Posts

mediawiki run php code

October 19th, 2007 by tom

you can run php code in mediawiki using the runphp extension.
you can get it here

i used it to display some database content. but it did only update after re-saving the article.
you need to disable caching in mediawiki:

$wgMainCacheType = CACHE_NONE;
$wgMessageCacheType = CACHE_NONE;
$wgParserCacheType = CACHE_NONE;
$wgCachePages = false;

(taken from: here)

when accessing a database:

  1. do not use $handle
  2. do not use select_db() just use absolute database and table names, like “select * from databasename.tablename”

other problems:

  1. include the runphp file AT THE END OF localsettings.php, not at the beginning……..
  2. runphp only executes php from protected (sysop only) pages!
Filed under php, mediawiki, wiki having 2 Comments »