Refactor code in ImportMediawiki.class.php.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>