Improving Things Continues

1245447680|%e %B %Y
tags: api database dump

Today I worked on some really nice thing in Wikidot, which finally makes initial database dump more organized. Instead of one big single-wiki-dump.sql there are 6 files:

  • 0-schema.sql
  • 1-users.sql
  • 2-licenses.sql
  • 3-themes.sql
  • 4-main-site.sql
  • 5-template-site.sql

The fact that they are split is a bit artificial, because they are all executed at once, but still it is nice to have 6 shorter files than one long. In case we want to add a new license to the initial dump, we don't need to search and be really careful to not break anything else. We just edit licenses file.

Even more important thing is removing pages from initial dump. As pages are quite a complex thing in Wikidot removing them from SQL dump decreases the size (and complexness) of it drastically. But we still need to populate the first wiki. And this is done with API methods and a nice directory structure:

  • files/dump/sites
    • www
      • start.page
      • admin.manage.page
      • account.you.page
      • auth.login.page
    • template
      • start.page
      • admin.manage.page

Site is directory, page is a file in such a directory. A special script (that is called by make) browses the files/dump/sites directory and call page.save API method on each page, supplying the content of the file as the wiki source of the page to be saved. Such a one saving creates many database objects:

  • page
  • page_revision
  • page_source
  • page_metadata
  • category (if does not exist yet)

So as you see, we benefit in two ways:

  1. initial database dump is easier to understand and modify
  2. adding pages to initial dump is much much easier

This still needs some polishing, but is a lot better than before.

Previous post: Site Update

Next post: Bug Killing Day

Comments

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License