Benutzer-Werkzeuge

Webseiten-Werkzeuge


start

Most Recent Articles

Importing Mediawiki Content into Dokuwiki

Beware, all shell code listings here are for zsh on Debian!

You need:

  • A working Dokuwiki instance
  • API access to your mediawiki
  • For importing users: Access to the database of your Mediawiki installation
  • yamdwe: Github
    • As of 2018-11-05, using a MariaDB 10.2 and yamdwe with a virtualenv, I had to install libmariadb-dev and libmariadb-dev-compat in version 2.* to compile MySQL-python
  1. Import pages and media using yamdwe.py
  2. Import users using yamdwe_users.py
  3. cd into your Dokuwiki installation directory
  4. Add page titles from the page file names: for f in $(find data/pages/ -maxdepth 1 -type f) ; do t=$(echo $f | sed -E -e 's#^.+/(.+)\.txt$#\1#' -e 's#_# #g' -e 's#\b.#\u&#g'); cp „$f“ „$f.backup“ ; sed -i „1i====== $t ======\\n“ $f ; done
    1. I only had pages in the root namespace, find data/pages/ -maxdepth 1 -type f finds all those
    2. The first sed builds the page title and uses extended regex (-E):
      1. s#^.+/(.+)\.txt$#\1# strips .txt from the file name
      2. s#_# #g replaces underscores with spaces
      3. s#\b.#\u&#g converts the string to Title Case
    3. The second sed inserts (i) ====== $t ======\\n as the first line (1)
  5. Check your pages
  6. Maybe fix the page file permissions and page titles (title case doesn't work well for most abbreviations…)
  7. Delete backups: find data/pages -maxdepth 1 -type f -name \*.txt.backup -execdir rm \{\} \;
  8. yamdwe inserted a comment at the bottom of the imported mediawiki main page, delete that maybe

→ Weiterlesen...

fanir

Exim4 Tricks

Spam logging for analysis, and probably more in the future.

→ Weiterlesen...

fanir
start.txt · Zuletzt geändert: 2019-05-02 21:59 von fanir