Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added kunena, webwiz, yaf support.

  • Loading branch information...
commit 7243b2cf4e0d013c75ee184178020be626c37db6 1 parent bda79db
@tburry tburry authored
Showing with 851 additions and 0 deletions.
  1. +163 −0 class.kunena.php
  2. +348 −0 class.webwiz.php
  3. +340 −0 class.yaf.php
View
163 class.kunena.php
@@ -0,0 +1,163 @@
+<?php
+/**
+ * Joomla Kunena exporter tool
+ *
+ * @copyright Vanilla Forums Inc. 2010
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU GPL2
+ * @package VanillaPorter
+ */
+
+$Supported['kunena'] = array('name'=> 'Joomla Kunena', 'prefix'=>'jos_');
+
+class Kunena extends ExportController {
+ /**
+ * @param ExportModel $Ex
+ */
+ public function ForumExport($Ex) {
+ $Ex->DestPrefix = 'jos';
+
+ $Ex->BeginExport('', 'Joomla Kunena', array('HashMethod' => 'joomla'));
+
+ // User.
+ $User_Map = array(
+ 'id'=>'UserID',
+ 'name'=>'Name',
+ 'email'=>'Email',
+ 'registerDate'=>'DateInserted',
+ 'lastvisitDate'=>'DateLastActive',
+ 'password' => 'Password',
+ 'showemail'=>'ShowEmail',
+ 'birthdate'=>'DateOfBirth',
+ 'banned'=>'Banned',
+// 'DELETED'=>'Deleted',
+ 'admin'=>array('Column'=>'Admin','Type'=>'tinyint(1)'),
+ 'Photo'=>'Photo'
+ );
+ $Ex->ExportTable('User', "
+ SELECT
+ u.*,
+ case when ku.avatar <> '' then concat('kunena/avatars/', ku.avatar) else null end as `Photo`,
+ case u.usertype when 'superadministrator' then 1 else 0 end as admin,
+ coalesce(ku.banned, 0) as banned,
+ ku.birthdate,
+ !ku.hideemail as showemail
+ FROM jos_users u
+ left join jos_kunena_users ku
+ on ku.userid = u.id", $User_Map);
+
+ // Role.
+ $Role_Map = array(
+ 'rank_id'=>'RoleID',
+ 'rank_title'=>'Name',
+ );
+ $Ex->ExportTable('Role', "select * from jos_kunena_ranks", $Role_Map);
+
+ // UserRole.
+ $UserRole_Map = array(
+ 'id' => 'UserID',
+ 'rank' => 'RoleID');
+ $Ex->ExportTable('UserRole', "
+ select *
+ from jos_users u", $UserRole_Map);
+
+ // Permission.
+// $Ex->ExportTable('Permission',
+// "select 2 as RoleID, 'View' as _Permissions
+// union
+// select 3 as RoleID, 'View' as _Permissions
+// union
+// select 16 as RoleID, 'All' as _Permissions", array('_Permissions' => array('Column' => '_Permissions', 'Type' => 'varchar(20)')));
+
+ // Category.
+ $Category_Map = array(
+ 'id' => 'CategoryID',
+ 'parent' => 'ParentCategoryID',
+ 'name' => 'Name',
+ 'ordering' => 'Sort',
+ 'description' => 'Description',
+
+ );
+ $Ex->ExportTable('Category', "
+ select * from jos_kunena_categories", $Category_Map);
+
+ // Discussion.
+ $Discussion_Map = array(
+ 'id' => 'DiscussionID',
+ 'catid' => 'CategoryID',
+ 'userid' => 'InsertUserID',
+ 'subject' => array('Column' => 'Name', 'Filter' => array($Ex, 'HTMLDecoder')),
+ 'time' => array('Column' => 'DateInserted', 'Filter' => array($Ex, 'TimestampToDate')),
+ 'ip' => 'InsertIPAddress',
+ 'locked' => 'Closed',
+ 'hits' => 'CountViews',
+ 'modified_by' => 'UpdateUserID',
+ 'modified_time' => array('Column' => 'DateUpdated', 'Filter' => array($Ex, 'TimestampToDate')),
+ 'message' => 'Body',
+ 'Format' => 'Format'
+ );
+ $Ex->ExportTable('Discussion', "
+ select
+ t.*,
+ txt.message,
+ 'BBCode' as Format
+ from jos_kunena_messages t
+ left join jos_kunena_messages_text txt
+ on t.id = txt.mesid
+ where t.thread = t.id", $Discussion_Map);
+
+ // Comment.
+ $Comment_Map = array(
+ 'id' => 'CommentID',
+ 'thread' => 'DiscussionID',
+ 'userid' => 'InsertUserID',
+ 'time' => array('Column' => 'DateInserted', 'Filter' => array($Ex, 'TimestampToDate')),
+ 'ip' => 'InsertIPAddress',
+ 'modified_by' => 'UpdateUserID',
+ 'modified_time' => array('Column' => 'DateUpdated', 'Filter' => array($Ex, 'TimestampToDate')),
+ 'message' => 'Body',
+ 'Format' => 'Format'
+ );
+ $Ex->ExportTable('Comment', "
+ select
+ t.*,
+ txt.message,
+ 'BBCode' as Format
+ from jos_kunena_messages t
+ left join jos_kunena_messages_text txt
+ on t.id = txt.mesid
+ where t.thread <> t.id", $Comment_Map);
+
+ // UserDiscussion.
+ $UserDiscussion_Map = array(
+ 'thread' => 'DiscussionID',
+ 'userid' => 'UserID');
+ $Ex->ExportTable('UserDiscussion', "
+ select t.*, 1 as Bookmarked
+ from jos_kunena_subscriptions t", $UserDiscussion_Map);
+
+ // Media.
+ $Media_Map = array(
+ 'id' => 'MediaID',
+ 'mesid' => 'ForeignID',
+ 'userid' => 'InsertUserID',
+ 'size' => 'Size',
+ 'path2' => array('Column' => 'Path', 'Filter' => array($Ex, 'UrlDecode')),
+ 'filetype' => 'Type',
+ 'filename' => array('Column' => 'Name', 'Filter' => array($Ex, 'UrlDecode')),
+ 'time' => array('Column' => 'DateInserted', 'Filter' => array($Ex, 'TimestampToDate')),
+ );
+ $Ex->ExportTable('Media', "
+ select
+ a.*,
+ concat(a.folder, '/', a.filename) as path2,
+ 'local' as StorageMethod,
+ case when m.id = m.thread then 'discussion' else 'comment' end as ForeignTable,
+ m.time
+ from jos_kunena_attachments a
+ join jos_kunena_messages m
+ on m.id = a.mesid", $Media_Map);
+
+ $Ex->EndExport();
+ }
+}
+?>
View
348 class.webwiz.php
@@ -0,0 +1,348 @@
+<?php
+/**
+ * Invision Powerboard exporter tool
+ *
+ * @copyright Vanilla Forums Inc. 2010
+ * @license Proprietary
+ * @package VanillaPorter
+ */
+
+$Supported['webwiz'] = array('name'=> 'Web Wiz Forums', 'prefix'=>'tbl');
+
+class WebWiz extends ExportController {
+ /**
+ *
+ * @param ExportModel $Ex
+ */
+ public function ForumExport($Ex) {
+ // Get the characterset for the comments.
+ $CharacterSet = $Ex->GetCharacterSet('tblTopic');
+ if ($CharacterSet)
+ $Ex->CharacterSet = $CharacterSet;
+
+ $Ex->BeginExport('', 'Web Wiz Forums');
+ $Ex->SourcePrefix = 'tbl';
+
+// // Permissions.
+// $Permission_Map = array(
+// 'group_id' => 'RoleID',
+// 'can_access_cp' => 'Garden.Settings.View',
+// 'can_access_edit' => 'Vanilla.Discussions.Edit',
+// 'can_edit_all_comments' => 'Vanilla.Comments.Edit',
+// 'can_access_admin' => 'Garden.Settings.Manage',
+// 'can_admin_members' => 'Garden.Users.Edit',
+// 'can_moderate_comments' => 'Garden.Moderation.Manage',
+// 'can_edit_categories' => 'Vanilla.Categories.Manage',
+// 'can_view_profiles' => 'Garden.Profiles.View',
+// 'can_post_comments' => 'Vanilla.Comments.Add',
+// 'can_view_online_system' => 'Vanilla.Discussions.View',
+// 'can_sign_in' => 'Garden.SignIn.Allow',
+// 'can_view_profiles3' => 'Garden.Activity.View',
+// 'can_post_comments2' => 'Vanilla.Discussions.Add'
+// );
+// $Permission_Map = $Ex->FixPermissionColumns($Permission_Map);
+// foreach ($Permission_Map as $Column => &$Info) {
+// if (is_array($Info) && isset($Info['Column']))
+// $Info['Filter'] = array($this, 'Bool');
+// }
+//
+// $Ex->ExportTable('Permission', "
+// select
+// g.can_view_profiles as can_view_profiles2,
+// g.can_view_profiles as can_view_profiles3,
+// g.can_post_comments as can_post_comments2,
+// g.can_post_comments as can_sign_in,
+// case when can_access_admin = 'y' then 'all' when can_view_online_system = 'y' then 'view' end as _Permissions,
+// g.*
+// from forum_member_groups g
+// ", $Permission_Map);
+
+
+ // User.
+ $User_Map = array(
+ 'Author_ID' => 'UserID',
+ 'Username' => array('Column' => 'Name', 'Filter' => array($Ex, 'HTMLDecoder')),
+ 'Real_name' => array('Column' => 'FullName', 'Type' => 'varchar(50)', 'Filter' => array($Ex, 'HTMLDecoder')),
+ 'Password2' => 'Password',
+ 'Gender2' => 'Gender',
+ 'Author_email' => 'Email',
+ 'Photo2' => array('Column' => 'Photo', 'Filter' => array($Ex, 'HTMLDecoder')),
+ 'Login_IP' => 'LastIPAddress',
+ 'Banned' => 'Banned',
+ 'Join_date' => array('Column' => 'DateInserted'),
+ 'last_visit' => array('Column' => 'DateLastActive'),
+ 'Location' => array('Column' => 'Location', 'Filter' => array($Ex, 'HTMLDecoder')),
+ 'DOB' => 'DateOfBirth',
+ 'Show_email' => 'ShowEmail'
+ );
+ $Ex->ExportTable('User', "
+ select
+ concat(Salt, '$', Password) as Password2,
+ case u.Gender when 'Male' then 'm' when 'Female' then 'f' else 'u' end as Gender2,
+ case when Avatar like 'http%' then Avatar when length(coalesce(Avatar, '')) > 0 then concat('webwiz/', Avatar) else null end as Photo2,
+ 'webwiz' as HashMethod,
+ u.*
+ from tblAuthor u
+ ", $User_Map);
+
+
+ // Role.
+ $Role_Map = array(
+ 'Group_ID' => 'RoleID',
+ 'Name' => 'Name'
+ );
+ $Ex->ExportTable('Role', "
+ select *
+ from tblGroup", $Role_Map);
+
+ // User Role.
+ $UserRole_Map = array(
+ 'Author_ID' => 'UserID',
+ 'Group_ID' => 'RoleID'
+ );
+ $Ex->ExportTable('UserRole', "
+ select u.*
+ from tblAuthor u", $UserRole_Map);
+
+ // UserMeta
+ $Ex->ExportTable('UserMeta', "
+ select
+ Author_ID as UserID,
+ 'Plugin.Signatures.Sig' as `Name`,
+ Signature as `Value`
+ from tblAuthor
+ where Signature <> ''");
+
+ // Category.
+ $Category_Map = array(
+ 'Forum_ID' => 'CategoryID',
+ 'Forum_name' => 'Name',
+ 'Forum_description' => 'Description',
+ 'Parent_ID' => 'ParentCategoryID',
+ 'Forum_order' => 'Sort'
+ );
+ $Ex->ExportTable('Category', "
+ select
+ f.Forum_ID,
+ f.Cat_ID * 1000 as Parent_ID,
+ f.Forum_order,
+ f.Forum_name,
+ f.Forum_description
+ from tblForum f
+
+ union all
+
+ select
+ c.Cat_ID * 1000,
+ null,
+ c.Cat_order,
+ c.Cat_name,
+ null
+ from tblCategory c
+ ", $Category_Map);
+
+ // Discussion.
+ $Discussion_Map = array(
+ 'Topic_ID' => 'DiscussionID',
+ 'Forum_ID' => 'CategoryID',
+ 'Author_ID' => 'InsertUserID',
+ 'Subject' => array('Column' => 'Name', 'Filter' => array($Ex, 'HTMLDecoder')),
+ 'IP_addr' => 'InsertIPAddress',
+ 'Message' => array('Column' => 'Body'),
+ 'Format' => 'Format',
+ 'Message_date' => array('Column' => 'DateInserted'),
+ 'No_of_views' => 'CountViews',
+ 'Locked' => 'Closed',
+
+ );
+ $Ex->ExportTable('Discussion', "
+ select
+ th.Author_ID,
+ th.Message,
+ 'Html' as Format,
+ t.*
+ from tblTopic t
+ join tblThread th
+ on t.Start_Thread_ID = th.Thread_ID", $Discussion_Map);
+
+ // Comment.
+ $Comment_Map = array(
+ 'Thread_ID' => 'CommentID',
+ 'Topic_ID' => 'DiscussionID',
+ 'Author_ID' => 'InsertUserID',
+ 'IP_addr' => 'InsertIPAddress',
+ 'Message' => array('Column' => 'Body'),
+ 'Format' => 'Format',
+ 'Message_date' => array('Column' => 'DateInserted')
+ );
+ $Ex->ExportTable('Comment', "
+ select
+ th.*,
+ 'Html' as Format
+ from tblThread th
+ join tblTopic t
+ on t.Topic_ID = th.Topic_ID
+ where th.Thread_ID <> t.Start_Thread_ID", $Comment_Map);
+
+ $this->ExportConversations();
+
+ $Ex->EndExport();
+ }
+
+ public function ExportConversations() {
+ $Ex = $this->Ex;
+
+ $this->_ExportConversationTemps();
+
+ // Conversation.
+ $Conversation_Map = array(
+ 'PM_ID' => 'ConversationID',
+ 'Title' => array('Column' => 'Subject', 'Type' => 'varchar(255)'),
+ 'Author_ID' => 'InsertUserID',
+ 'PM_Message_Date' => array('Column' => 'DateInserted')
+ );
+ $Ex->ExportTable('Conversation', "
+ select
+ pm.*,
+ g.Title
+ from tblPMMessage pm
+ join z_pmgroup g
+ on pm.PM_ID = g.Group_ID;
+ ", $Conversation_Map);
+
+ // User Conversation.
+ $UserConversation_Map = array(
+ 'Group_ID' => 'ConversationID',
+ 'User_ID' => 'UserID');
+ $Ex->ExportTable('UserConversation', "
+ select
+ g.Group_ID,
+ t.User_ID
+ from z_pmto t
+ join z_pmgroup g
+ on g.Group_ID = t.PM_ID;", $UserConversation_Map);
+
+ // Conversation Message.
+ $Message_Map = array(
+ 'Group_ID' => 'ConversationID',
+ 'PM_ID' => 'MessageID',
+ 'PM_Message' => 'Body',
+ 'Format' => 'Format',
+ 'PM_Message_Date' => array('Column' => 'DateInserted'),
+ 'Author_ID' => 'InsertUserID'
+ );
+ $Ex->ExportTable('ConversationMessage', "
+ select
+ pm.*,
+ pm2.Group_ID,
+ 'Html' as Format
+ from tblPMMessage pm
+ join z_pmtext pm2
+ on pm.PM_ID = pm2.PM_ID;", $Message_Map);
+ }
+
+ protected function _ExportConversationTemps() {
+ $Sql = "
+ drop table if exists z_pmto;
+
+ create table z_pmto (
+ PM_ID int unsigned,
+ User_ID int,
+ primary key(PM_ID, User_ID)
+ );
+
+ insert ignore z_pmto (
+ PM_ID,
+ User_ID
+ )
+ select
+ PM_ID,
+ Author_ID
+ from tblPMMessage;
+
+ insert ignore z_pmto (
+ PM_ID,
+ User_ID
+ )
+ select
+ PM_ID,
+ From_ID
+ from tblPMMessage;
+
+ drop table if exists z_pmto2;
+ create table z_pmto2 (
+ PM_ID int unsigned,
+ UserIDs varchar(250),
+ primary key (PM_ID)
+ );
+
+ replace z_pmto2 (
+ PM_ID,
+ UserIDs
+ )
+ select
+ PM_ID,
+ group_concat(User_ID order by User_ID)
+ from z_pmto
+ group by PM_ID;
+
+ drop table if exists z_pmtext;
+ create table z_pmtext (
+ PM_ID int unsigned,
+ Title varchar(250),
+ Title2 varchar(250),
+ UserIDs varchar(250),
+ Group_ID int unsigned
+ );
+
+ insert z_pmtext (
+ PM_ID,
+ Title,
+ Title2
+ )
+ select
+ PM_ID,
+ PM_Tittle,
+ case when PM_Tittle like 'Re:%' then trim(substring(PM_Tittle, 4)) else PM_Tittle end as Title2
+ from tblPMMessage;
+
+ create index z_idx_pmtext on z_pmtext (PM_ID);
+
+ update z_pmtext pm
+ join z_pmto2 t
+ on pm.PM_ID = t.PM_ID
+ set pm.UserIDs = t.UserIDs;
+
+ drop table if exists z_pmgroup;
+
+ create table z_pmgroup (
+ Group_ID int unsigned,
+ Title varchar(250),
+ UserIDs varchar(250)
+ );
+
+ insert z_pmgroup (
+ Group_ID,
+ Title,
+ UserIDs
+ )
+ select
+ min(pm.PM_ID),
+ pm.Title2,
+ t2.UserIDs
+ from z_pmtext pm
+ join z_pmto2 t2
+ on pm.PM_ID = t2.PM_ID
+ group by pm.Title2, t2.UserIDs;
+
+ create index z_idx_pmgroup on z_pmgroup (Title, UserIDs);
+ create index z_idx_pmgroup2 on z_pmgroup (Group_ID);
+
+ update z_pmtext pm
+ join z_pmgroup g
+ on pm.Title2 = g.Title and pm.UserIDs = g.UserIDs
+ set pm.Group_ID = g.Group_ID;";
+
+ $this->Ex->QueryN($Sql);
+ }
+}
View
340 class.yaf.php
@@ -0,0 +1,340 @@
+<?php
+/**
+ * Invision Powerboard exporter tool
+ *
+ * @copyright Vanilla Forums Inc. 2010
+ * @license Proprietary
+ * @package VanillaPorter
+ */
+
+$Supported['yaf'] = array('name'=> 'YAF.NET (Yet Another Forum)', 'prefix'=>'yaf_');
+
+class Yaf extends ExportController {
+ static $PasswordFormats = array(0 => 'md5', 1 => 'sha1', 2 => 'sha256', 3 => 'sha384', 4 => 'sha512');
+
+ /**
+ *
+ * @param ExportModel $Ex
+ */
+ public function ForumExport($Ex) {
+ $CharacterSet = $Ex->GetCharacterSet('yaf_Topic');
+ if ($CharacterSet)
+ $Ex->CharacterSet = $CharacterSet;
+
+ $Ex->BeginExport('', 'YAF.NET (Yet Another Forum)');
+ $Ex->SourcePrefix = 'yaf_';
+
+ // User.
+ $User_Map = array(
+ 'UserID' => 'UserID',
+ 'Name' => 'Name',
+ 'Email' => 'Email',
+ 'Joined' => 'DateInserted',
+ 'LastVisit' => array('Column' => 'DateLastVisit', 'Type' => 'datetime'),
+ 'IP' => 'InsertIPAddress',
+ 'Avatar' => 'Photo',
+ 'RankID' => array('Column' => 'RankID', 'Type' => 'int'),
+ 'Points' => array('Column' => 'Points', 'Type' => 'int'),
+ 'LastActivity' => 'DateLastActive',
+ 'Password2' => array('Column' => 'Password', 'Filter' => array($this, 'ConvertPassword')),
+ 'HashMethod' => 'HashMethod'
+ );
+ $Ex->ExportTable('User', "
+ select
+ u.*,
+ m.Password as Password2,
+ m.PasswordSalt,
+ m.PasswordFormat,
+ m.LastActivity,
+ 'yaf' as HashMethod
+ from yaf_User u
+ left join yaf_prov_Membership m
+ on u.ProviderUserKey = m.UserID;", $User_Map);
+
+ // Role.
+ $Role_Map = array(
+ 'GroupID' => 'RoleID',
+ 'Name' => 'Name');
+ $Ex->ExportTable('Role', "
+ select *
+ from yaf_Group;", $Role_Map);
+
+ // UserRole.
+ $UserRole_Map = array(
+ 'UserID' => 'UserID',
+ 'GroupID' => 'RoleID');
+ $Ex->ExportTable('UserRole', 'select * from yaf_UserGroup', $UserRole_Map);
+
+ // Rank.
+ $Rank_Map = array(
+ 'RankID' => 'RankID',
+ 'Level' => 'Level',
+ 'Name' => 'Name',
+ 'Label' => 'Label');
+ $Ex->ExportTable('Rank', "
+ select
+ r.*,
+ RankID as Level,
+ Name as Label
+ from yaf_Rank r;", $Rank_Map);
+
+ // Signatures.
+ $Ex->ExportTable('UserMeta', "
+ select
+ UserID,
+ 'Plugin.Signatures.Sig' as `Name`,
+ Signature as `Value`
+ from yaf_User
+ where Signature <> ''
+
+ union all
+
+ select
+ UserID,
+ 'Plugin.Signatures.Format' as `Name`,
+ 'BBCode' as `Value`
+ from yaf_User
+ where Signature <> '';");
+
+ // Category.
+ $Category_Map = array(
+ 'ForumID' => 'CategoryID',
+ 'ParentID' => 'ParentCategoryID',
+ 'Name' => 'Name',
+ 'Description' => 'Description',
+ 'SortOrder' => 'Sort');
+
+ $Ex->ExportTable('Category', "
+ select
+ f.ForumID,
+ case when f.ParentID = 0 then f.CategoryID * 1000 else f.ParentID end as ParentID,
+ f.Name,
+ f.Description,
+ f.SortOrder
+ from yaf_Forum f
+
+ union all
+
+ select
+ c.CategoryID * 1000,
+ null,
+ c.Name,
+ null,
+ c.SortOrder
+ from yaf_Category c;", $Category_Map);
+
+ // Discussion.
+ $Discussion_Map = array(
+ 'TopicID' => 'DiscussionID',
+ 'ForumID' => 'CategoryID',
+ 'UserID' => 'InsertUserID',
+ 'Posted' => 'DateInserted',
+ 'Topic' => 'Name',
+ 'Views' => 'CountViews',
+ 'Announce' => 'Announce'
+ );
+ $Ex->ExportTable('Discussion', "
+ select
+ case when t.Priority > 0 then 1 else 0 end as Announce,
+ t.Flags & 1 as Closed,
+ t.*
+ from yaf_Topic t
+ where t.IsDeleted = 0;", $Discussion_Map);
+
+ // Comment.
+ $Comment_Map = array(
+ 'MessageID' => 'CommentID',
+ 'TopicID' => 'DiscussionID',
+ 'ReplyTo' => array('Column' => 'ReplyToCommentID', 'Type' => 'int'),
+ 'UseID' => 'InsertUserID',
+ 'Posted' => 'DateInserted',
+ 'Message' => 'Body',
+ 'Format' => 'Format',
+ 'IP' => 'InsertIPAddress',
+ 'Edited' => array('Column' => 'DateUpdated', 'Filter' => array($this, 'CleanDate')),
+ 'EditedBy' => 'UpdateUserID');
+ $Ex->ExportTable('Comment', "
+ select
+ case when m.Flags & 1 = 1 then 'Html' else 'BBCode' end as Format,
+ m.*
+ from yaf_Message m
+ where IsDeleted = 0;", $Comment_Map);
+
+ // Conversation.
+ $this->_ExportConversationTemps();
+
+ $Conversation_Map = array(
+ 'PMessageID' => 'ConversationID',
+ 'FromUserID' => 'InsertUserID',
+ 'Created' => 'DateInserted',
+ 'Title' => array('Column' => 'Subject', 'Type' => 'varchar(512)')
+ );
+ $Ex->ExportTable('Conversation', "
+ select
+ pm.*,
+ g.Title
+ from z_pmgroup g
+ join yaf_PMessage pm
+ on g.Group_ID = pm.PMessageID;", $Conversation_Map);
+
+ // UserConversation.
+ $UserConversation_Map = array(
+ 'PM_ID' => 'ConversationID',
+ 'User_ID' => 'UserID',
+ 'Deleted' => 'Deleted');
+ $Ex->ExportTable('UserConversation', "
+ select pto.*
+ from z_pmto pto
+ join z_pmgroup g
+ on pto.PM_ID = g.Group_ID;", $UserConversation_Map);
+
+ // ConversationMessage.
+ $ConversationMessage_Map = array(
+ 'PMessageID' => 'MessageID',
+ 'Group_ID' => 'ConversationID',
+ 'FromUserID' => 'InsertUserID',
+ 'Created' => 'DateInserted',
+ 'Body' => 'Body',
+ 'Format' => 'Format');
+ $Ex->ExportTable('ConversationMessage', "
+ select
+ pm.*,
+ case when pm.Flags & 1 = 1 then 'Html' else 'BBCode' end as Format,
+ t.Group_ID
+ from yaf_PMessage pm
+ join z_pmtext t
+ on t.PM_ID = pm.PMessageID;", $ConversationMessage_Map);
+
+ $Ex->EndExport();
+ }
+
+ public function CleanDate($Value) {
+ if (!$Value)
+ return NULL;
+ if (substr($Value, 0, 4) == '0000')
+ return NULL;
+ return $Value;
+ }
+
+ public function ConvertPassword($Hash, $ColumnName, &$Row) {
+ $Salt = $Row['PasswordSalt'];
+ $Hash = $Row['Password2'];
+ $Method = $Row['PasswordFormat'];
+ if (isset(self::$PasswordFormats[$Method]))
+ $Method = self::$PasswordFormats[$Method];
+ else
+ $Method = 'sha1';
+ $Result = "$Method$$Salt$$Hash$";
+ return $Result;
+ }
+
+ protected function _ExportConversationTemps() {
+ $Sql = "
+ drop table if exists z_pmto;
+
+ create table z_pmto (
+ PM_ID int unsigned,
+ User_ID int,
+ Deleted tinyint,
+ primary key(PM_ID, User_ID)
+ );
+
+ insert ignore z_pmto (
+ PM_ID,
+ User_ID,
+ Deleted
+ )
+ select
+ PMessageID,
+ FromUserID,
+ 0
+ from yaf_PMessage;
+
+ replace z_pmto (
+ PM_ID,
+ User_ID,
+ Deleted
+ )
+ select
+ PMessageID,
+ UserID,
+ IsDeleted
+ from yaf_UserPMessage;
+
+ drop table if exists z_pmto2;
+ create table z_pmto2 (
+ PM_ID int unsigned,
+ UserIDs varchar(250),
+ primary key (PM_ID)
+ );
+
+ replace z_pmto2 (
+ PM_ID,
+ UserIDs
+ )
+ select
+ PM_ID,
+ group_concat(User_ID order by User_ID)
+ from z_pmto
+ group by PM_ID;
+
+ drop table if exists z_pmtext;
+ create table z_pmtext (
+ PM_ID int unsigned,
+ Title varchar(250),
+ Title2 varchar(250),
+ UserIDs varchar(250),
+ Group_ID int unsigned
+ );
+
+ insert z_pmtext (
+ PM_ID,
+ Title,
+ Title2
+ )
+ select
+ PMessageID,
+ Subject,
+ case when Subject like 'Re:%' then trim(substring(Subject, 4)) else Subject end as Title2
+ from yaf_PMessage;
+
+ create index z_idx_pmtext on z_pmtext (PM_ID);
+
+ update z_pmtext pm
+ join z_pmto2 t
+ on pm.PM_ID = t.PM_ID
+ set pm.UserIDs = t.UserIDs;
+
+ drop table if exists z_pmgroup;
+
+ create table z_pmgroup (
+ Group_ID int unsigned,
+ Title varchar(250),
+ UserIDs varchar(250)
+ );
+
+ insert z_pmgroup (
+ Group_ID,
+ Title,
+ UserIDs
+ )
+ select
+ min(pm.PM_ID),
+ pm.Title2,
+ t2.UserIDs
+ from z_pmtext pm
+ join z_pmto2 t2
+ on pm.PM_ID = t2.PM_ID
+ group by pm.Title2, t2.UserIDs;
+
+ create index z_idx_pmgroup on z_pmgroup (Title, UserIDs);
+ create index z_idx_pmgroup2 on z_pmgroup (Group_ID);
+
+ update z_pmtext pm
+ join z_pmgroup g
+ on pm.Title2 = g.Title and pm.UserIDs = g.UserIDs
+ set pm.Group_ID = g.Group_ID;";
+
+ $this->Ex->QueryN($Sql);
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.