Benutzer-Werkzeuge

Webseiten-Werkzeuge


Action disabled: source
news:blogtng_page_move

blogtng page move

I'm just changing my dokuwiki, therefore I've changed the structure of the sites.
Unfortunately it isn't easy to redesign the namespaces and pages if you use blogtng because all entries, comments and tags are merged using an md5-hash as id and stored in a sqlite-database.

After some analysis of the database structure I was able to write a little bash line which moved the pages in the database:

cd /path/to/dokuwiki/data/meta
for page in $(sqlite blogtng.sqlite "select page from entries")
do
  # remove 'blog:' from path
  pagen=${page/blog:/}
  echo $pagen
  # calculate md5sum using php-md5 method of old path
  md5=$(php -r "print(md5('$page'));")
  # calculate md5sum of new path
  md5n=$(php -r "print(md5('$pagen'));")
  # update 'entries'-table and set new path and new pid
  sqlite blogtng.sqlite "update entries set pid='$md5n',page='$pagen' where pid='$md5'"
  # update 'comments'-table and set new pid
  sqlite blogtng.sqlite "update comments set pid='$md5n' where pid='$md5'"
  # update 'tags'-table and set new pid
  sqlite blogtng.sqlite "update tags set pid='$md5n' where pid='$md5'"
  # update 'subscriptions'-table and set new pid
  sqlite blogtng.sqlite "update subscriptions set pid='$md5n' where pid='$md5'"
done

If you want to modify other parts of the path just alter 'pagen'.

Comments



W N O Q E
news/blogtng_page_move.txt · Zuletzt geändert: 2011/01/30 14:31 von Andrwe Lord Weber