Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ForumAccess (Drupal 8) source support #82

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/sources.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'ExpressionEngine',
'Flarum',
'FluxBb',
'ForumAccess',
'FuseTalk',
'IpBoard3',
'IpBoard4',
Expand Down
145 changes: 145 additions & 0 deletions src/Source/ForumAccess.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<?php

/**
* Forum Access (Drupal 8) export support.
*
* @author Lincoln Russell
*/

namespace Porter\Source;

use Porter\Source;
use Porter\ExportModel;

class ForumAccess extends Source
{
public const SUPPORTED = [
'name' => 'Forum Access (Drupal 8)',
'prefix' => '',
'charset_table' => 'comment',
'options' => [

],
'features' => [
'Users' => 1,
'Passwords' => 0,
'Categories' => 1,
'Discussions' => 1,
'Comments' => 1,
'Polls' => 0,
'Roles' => 1,
'Avatars' => 0,
'PrivateMessages' => 0,
'Signatures' => 0,
'Attachments' => 0,
]
];

/**
* @param ExportModel $ex
*/
public function run($ex)
{
$this->users($ex);
//$this->roles($ex); // user__roles
$this->categories($ex);
$this->discussions($ex);
$this->comments($ex);
// private messages // private_message__field_subject, etc

// nid=node, tid=taxonomy, rid=redirect, vid=node_revision??
}

/**
* @param ExportModel $ex
*/
protected function users(ExportModel $ex): void
{
$map = [
'uid' => 'UserID',
'name' => 'Name',
'mail' => 'Email',
'created' => ['Column' => 'DateInserted', 'Filter' => 'timestampToDate'],
'changed' => ['Column' => 'DateUpdated', 'Filter' => 'timestampToDate'],
'access' => ['Column' => 'DateLastActive', 'Filter' => 'timestampToDate'],
];
$ex->export(
'User',
"select * from :_users_field_data",
$map
);
}

/**
* @param ExportModel $ex
*/
protected function roles(ExportModel $ex): void
{
$ex->export(
'Role',
"select rid as RoleID, name as Name from :_role"
);

// User Role.
$ex->export(
'UserRole',
"select uid as UserID, rid as RoleID from :_users_roles"
);
}

/**
* @param ExportModel $ex
*/
protected function categories(ExportModel $ex): void
{
$map = [
'entity_id' => '',
'revision_id' => '',
'taxonomy_forums_target_id' => '', // what does this target?
];
$ex->export(
'Category',
"select * from :_node__taxonomy_forums",
$map
);
}
// node_revision__taxonomy_forums

/**
* @param ExportModel $ex
*/
protected function discussions(ExportModel $ex): void
{
$discussionMap = array(
//
);
$ex->export(
'Discussion',
"select * from :_node",
$discussionMap
);
// node,
// node__body, entity_id, revision_id, body_value, body_summary
// body_format (full_html, filtered_html, fckeditor_full)
// bundle (page, book, library, story, forum)
// node_field_data — nid, vid, type (forum), uid, created, changed - title 'New member "X"'
}

/**
* @param ExportModel $ex
*/
protected function comments(ExportModel $ex): void
{
$map = array(
//
);
$ex->export(
'Comment',
"select * from :_node__comment_forum", // 7K
$map
);
// entity_id, revision_id

// node_revision__comment_forum
}
}
Loading