« HS-CMS documentation home

Migration Tool: Drupal to HS-CMS

Will use a combination of wget and access to the database.

Will want to capture the following:

  • Node IDs (Save as drupal_node_id)
  • Node creation & update dates
  • Node titles
  • Comments
  • Contents & type (usually raw HTML)
  • Tags
  • Category (Tip/Conversation/etc)
  • Aliases
  • Taxonomy (see Gotchas)
  • View Count
  • Referrers/log, if possible? :-/

Other “Gotchas” to look out for

  • /node is the homepage for drupal
  • /tags/# — the # should then give a redirection message (inform) of the actual tag (e.g. CSS). God Drupal sucks.
  • /taxonomy/term/ needs to permanently redirect to /tags/, with a tag instead of a stupid number, usually (but not always.) This could be an HS-CMS app.
  • If something is not categorized properly in the new categories, it should probably be at least labeled “Miscellaneous” so as to not to disappear

Steps to Success

  • Move pages.

    Here is code to select pages from Drupal.

    Showing rows 0 - 29 (45 total, Query took 0.0057 sec)
    SQL query: 
    SELECT n.nid AS id, n.title, (
    IFNULL( ua.dst, CONCAT( "node/", n.nid ) )
    ) AS url, nr.body AS content, n.status AS
    STATUS , (

    CASE
    WHEN n.comment =0
    THEN -1
    ELSE COMMENT
    END
    ) AS comments_enabled, (

    CASE
    WHEN n.promote =0
    THEN -1
    ELSE 0
    END
    ) AS robot_friendly, (

    CASE
    WHEN f.name = ‘Coolfilter / Raw HTML’
    THEN ‘xhtml’
    WHEN f.name = ‘PHP, then Coolfilter (Raw HTML)’
    THEN ‘php’
    WHEN f.name = ‘Raw HTML’
    THEN ‘xhtml’
    WHEN f.name = ‘Full HTML’
    THEN ‘markdown’
    WHEN f.name = ‘Auto-HTML’
    THEN ‘markdown’
    WHEN f.name = ‘PHP code’
    THEN ‘php’
    ELSE f.name
    END
    ) AS format, (

    IF (
    n.type = ‘page’, ‘static’, ‘authored’
    )
    ) AS
    TYPE , (
    FROM_UNIXTIME( n.created )
    ) AS created, (
    FROM_UNIXTIME( n.changed )
    ) AS updated, nr.teaser AS description, ncount.totalcount AS hits
    FROM ajh_drupal_node AS n
    LEFT JOIN ajh_drupal_node_revisions AS nr ON n.vid = nr.vid
    LEFT JOIN ajh_drupal_filter_formats AS f ON f.format = nr.format
    LEFT JOIN ajh_drupal_node_counter AS ncount ON ncount.nid = n.nid
    LEFT JOIN ajh_drupal_url_alias AS ua ON ua.src = CONCAT( "node/", n.nid )
    LIMIT 0 , 30
  • Save content into a file and link to file with “file” attribute

  • Strip html tags < > out of description
  • Probably most robot_friendly entries need reviewed
  • Check pages for consistency
  • Create a /tags/ application
  • For every node, there should be a redirecting (changes browser address) alias from the stupid node/x URLs to the very/nice/cool URLs
  • Finally, at the end, check each node from 1 up to the highest (70’s maybe) to see if it survived
  • See if there is anything at all not transferred over
  • Then redirect everything to HS-CMS (no longer just the whitelist)