Action: New InterWikiList
Current version: Credits: |
{{newinterwiki}}
/action/newinterwiki.php
<?php
// This action allows you to rewrite your localmap.conf using a wikipage
// For this action to work properly you have to create (a link from page InterWiki to) a page
// called for instance NewInterWiki. Copy the old interwiki.conf / localmap.conf to this page once. Do not forget to
// set rights for this page (permissions) to Read/Write/Comment = Admins.
if ($this->is_admin())
{
// select content between "~<[". Instead of "~]>" every other expression would do
preg_match_all("/<\[(.*)\]>/s", $this->page['body'], $match);
$body = $match[1][0];
// overwrites old file: localmap.conf
$fp = fopen('localmap.conf', 'w+');
fputs($fp, $body);
fclose($fp);
}