tom.drastic.net

mediawiki run php code

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!
October 19th, 2007 | php, mediawiki, wiki |


2 Responses

  1. Robert Fleming Says:

    See also:

    http://www.mediawiki.org/wiki/Extensions_FAQ#How_do_I_disable_caching_for_pages_using_my_extension.3F

  2. Mario Says:

    Hi, that link http://bluecortex.com/index.php?title=Bluecortex:Runphp_page in not valid anymore :(

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.