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

Comments

  1. Comment 8

    no good idea, it's better to create an additional custom interwiki list
    see bugs:27
    • EoNy
  2. Comment 9

    changed fopen parameter,

    in order to show the localmap.conf you have to

    1. open the interwikilist.php file in your /action folder
    2. replace "interwiki.conf" with "localmap.conf"
    3. save as e.g. interwikilocal.php
    4. open a wiki page and type {{interwikilocal}}
    • EoNy