• strict warning: Non-static method view::load() should not be called statically in /home/saturn/public_html/blog/sites/all/modules/views/views.module on line 906.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/handlers/ on line 607.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/handlers/ on line 607.
  • strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/handlers/ on line 159.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /home/saturn/public_html/blog/sites/all/modules/views/plugins/ on line 24.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/plugins/ on line 134.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/plugins/ on line 134.
 * Drupal exporter tool
 * @copyright Saturn Laboratories 2010
 * @license GNU GPL2
 * @package VanillaPorter

class Drupal extends ExportController {

   /** @var array Required tables => columns */
   protected $SourceTables = array(
      'users' => array('uid', 'name', 'pass', 'mail', 'timezone', 'language', 'created', 'access'),
      'role' => array('rid', 'name'),
      'users_roles' => array('uid', 'rid'),
      'node' => array('nid', 'vid', 'type', 'title', 'uid', 'status', 'created', 'changed'),
      'node_revisions' => array('nid', 'vid', 'uid',  'title', 'body', 'teaser', 'log', 'timestamp', 'format'),
      'term_data' => array('tid', 'name', 'description', 'weight'),
      'term_node' => array('nid', 'tid', 'vid')

    * Forum-specific export format.
    * @param ExportModel $Ex
   protected function ForumExport($Ex) {
      // Begin
      $Ex->BeginExport('', 'Drupal 6.*', array('HashMethod' => 'Drupal'));

      // Users
      $User_Map = array(
      $Ex->ExportTable('User', "SELECT uid, name, pass, mail, timezone,
            FROM_UNIXTIME(nullif(created, 0)) AS DateFirstVisit,
            FROM_UNIXTIME(nullif(access, 0)) AS DateLastActive,
            FROM_UNIXTIME(nullif(created, 0)) AS DateInserted
         FROM :_users", $User_Map);  // ":_" will be replace by database prefix

      // Categories
      $Category_Map = array(
      $Ex->ExportTable('Category', "SELECT t.tid,
        IF(h.parent = 0, -1, h.parent) AS parent,,
        IF(h.parent = 0, 1, 2) AS Depth
        FROM :_term_data t
        JOIN :_vocabulary v ON t.vid = v.vid
        JOIN :_term_hierarchy h ON t.tid = h.tid
        WHERE v.module = 'forum'", $Category_Map);

      // Discussions
      $Discussion_Map = array(
         'body' => 'Body',
         'CountComments' => 'CountComments',
      $Ex->ExportTable('Discussion', "SELECT n.nid, t.tid, n.uid, n.title, r.body,
        (SELECT count(c.cid) FROM :_comments AS c WHERE c.nid = n.nid) + 1 AS CountComments,
        (SELECT count(c.cid) FROM :_comments AS c WHERE c.nid = n.nid) + 1 AS CountViews,
        'Html' AS Format,
        0 AS Closed,
        0 AS Announce,
        FROM_UNIXTIME(n.created) AS DateInserted
        FROM :_node AS n
        JOIN :_node_revisions AS r ON n.nid = r.nid AND n.vid = r.vid
        JOIN :_term_node AS t ON n.nid = t.nid
        WHERE n.type = 'forum'",

      // Comments
      $Comment_Map = array(
         'cid' => 'CommentID',
         'nid' => 'DiscussionID',
         'comment' => 'Body',
         'Format' => 'Format',
         'uid' => 'InsertUserID'
      $Ex->ExportTable('Comment', "SELECT c.cid, c.nid, c.comment,
         'Html' as Format,
         FROM_UNIXTIME(c.timestamp) as DateInserted,
         FROM_UNIXTIME(c.timestamp) as DateUpdated
         FROM :_comments c
         JOIN :_node  AS n ON c.nid = n.nid AND n.type = 'forum'",

      // End