WackoWiki: Action: New InterWikiList

https://wackowiki.org/doc     Version: 7 (25.05.2022 14:52)

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);
}

1.1. Documentation

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. Do not forget to set rights for this page (acl) to Read/Write/Comment = Admins.

1.2. To Do