Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

Adds drupalmigrate.py #115

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Adds drupalmigrate.py #115

wants to merge 2 commits into from

Conversation

kstrauser
Copy link

The drupalmigrate.py controller (and post_build hook) ease migration from Drupal to Blogofile (as per my writeup on how I did it. It has two parts:

  1. makeindex() builds an index of links to all of the nodes in the configured Drupal database where there's no Blogofile post with the same permalink.
  2. makerewriterules() creates a set of Apache RewriteRule directives so that you can install Blogofile and Drupal inside the same Apache domain, with Blogofile-generated files filling all possible requests and the rest "falling through" to Drupal.

I use this file to "overlay" my new Blogofile site over my thousand-node Drupal site so that they appear to be one and the same, and all old Drupal content is still fully accessible even as I add new Blogofile posts.

The first version of this script was something I wrote at 1AM to get my site
up and running quickly. This version is better integrated with Blogofile and
non-default setups:

  Lots more comments, particularly for configuration variables.

  makerewriterules():

    Hooks into config.post_build to run after all other processing.

    Creates rules for all files and directories under _site, not just blog
    posts.

    Generates better regular expressions to match only the wanted pathnames.

  makeindex():

    Selects only the columns it needs from the Drupal tables.

    Only one link is emitted for any given node (in case Drupal's Pathauto
    module has created multiple links to the same node - it happens).

    Drupal's path can be configured in case it's not in the root directory
    of the website.

    Links to nodes that didn't have Pathauto aliases were completely broken.

Everything:

    pylint and pep8 are happy.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant