Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added SimplePress export support.

  • Loading branch information...
commit b97a3393c8e58e99a777b57d9e3dd34e88e39d8b 1 parent 9b51f5c
@tburry tburry authored
Showing with 182 additions and 310 deletions.
  1. +143 −0 class.simplepress.php
  2. +15 −60 class.vanilla1.php
  3. +24 −250 vanilla2export.php
View
143 class.simplepress.php
@@ -0,0 +1,143 @@
+<?php
+/**
+ * ppPress exporter tool
+ *
+ * @copyright Vanilla Forums Inc. 2010
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU GPL2
+ * @package VanillaPorter
+ */
+
+class SimplePress extends ExportController {
+
+ /** @var array Required tables => columns */
+ protected $SourceTables = array(
+ 'sfforums' => array(),
+ 'sfposts' => array(),
+ 'sftopics' => array(),
+ 'users' => array('ID', 'user_nicename', 'user_pass', 'user_email', 'user_registered')
+ //'meta' => array()
+ );
+
+ /**
+ * Forum-specific export format.
+ * @param ExportModel $Ex
+ */
+ protected function ForumExport($Ex) {
+ // Begin
+ $Ex->BeginExport('', 'SimplePress 1.*', array('HashMethod' => 'Vanilla'));
+
+ // Users
+ $User_Map = array(
+ 'user_id'=>'UserID',
+ 'display_name'=>'Name',
+ 'user_pass'=>'Password',
+ 'user_email'=>'Email',
+ 'user_registered'=>'DateInserted'
+ );
+ $Ex->ExportTable('User',
+ "select m.*, u.user_pass, u.user_email
+ from :_users u
+ join :_sfmembers m
+ on u.ID = m.user_id", $User_Map); // ":_" will be replace by database prefix
+
+ // Roles
+ $Role_Map = array(
+ 'usergroup_id' => 'RoleID',
+ 'usergroup_name' => 'Name',
+ 'usergroup_desc' => 'Description'
+ );
+ $Ex->ExportTable('Role',
+ "select * from :_sfusergroups", $Role_Map);
+
+ // UserRoles
+ $UserRole_Map = array(
+ 'user_id'=>'UserID',
+ 'usergroup_id'=>'RoleID'
+ );
+ $Ex->ExportTable('UserRole',
+ "select * from :_sfmemberships", $UserRole_Map);
+
+ // Categories
+ $Category_Map = array(
+ 'forum_id'=>'CategoryID',
+ 'forum_name'=>'Name',
+ 'forum_desc'=>'Description',
+ 'form_slug'=>'UrlCode'
+ );
+ $Ex->ExportTable('Category', "select *,
+ nullif(parent,0) as ParentCategoryID
+ from :_sfforums", $Category_Map);
+
+ // Discussions
+ $Discussion_Map = array(
+ 'topic_id'=>'DiscussionID',
+ 'forum_id'=>'CategoryID',
+ 'user_id'=>'InsertUserID',
+ 'topic_name'=>'Name',
+ 'Format'=>'Format',
+ 'topic_date'=>'DateInserted',
+ 'topic_pinned'=>'Announce'
+ );
+ $Ex->ExportTable('Discussion', "select t.*,
+ 'Html' as Format
+ from :_sftopics t", $Discussion_Map);
+
+ // Comments
+ $Comment_Map = array(
+ 'post_id' => 'CommentID',
+ 'topic_id' => 'DiscussionID',
+ 'post_content' => 'Body',
+ 'Format' => 'Format',
+ 'user_id' => 'InsertUserID',
+ 'post_date' => 'DateInserted'
+ );
+ $Ex->ExportTable('Comment', "select p.*,
+ 'Html' as Format
+ from :_sfposts p", $Comment_Map);
+
+ // Conversation.
+ $Conv_Map = array(
+ 'message_id' => 'ConversationID',
+ 'from_id' => 'InsertUserID',
+ 'sent_date' => 'DateInserted'
+ );
+ $Ex->ExportTable('Conversation',
+ "select *
+ from :_sfmessages
+ where is_reply = 0", $Conv_Map);
+
+ // ConversationMessage.
+ $ConvMessage_Map = array(
+ 'message_id' => 'MessageID',
+ 'from_id' => 'InsertUserID',
+ 'message' => array('Column'=>'Body')
+ );
+ $Ex->ExportTable('ConversationMessage',
+ 'select c.message_id as ConversationID, m.*
+ from :_sfmessages c
+ join :_sfmessages m
+ on (m.is_reply = 0 and m.message_id = c.message_id) or (m.is_reply = 1 and c.is_reply = 0 and m.message_slug = c.message_slug and m.from_id in (c.from_id, c.to_id) and m.to_id in (c.from_id, c.to_id));',
+ $ConvMessage_Map);
+
+ // UserConversation
+ $UserConv_Map = array(
+ 'message_id' => 'ConversationID',
+ 'from_id' => 'UserID'
+ );
+ $Ex->ExportTable('UserConversation',
+ 'select message_id, from_id
+ from :_sfmessages
+ where is_reply = 0
+
+ union
+
+ select message_id, to_id
+ from :_sfmessages
+ where is_reply = 0',
+ $UserConv_Map);
+
+ // End
+ $Ex->EndExport();
+ }
+}
+?>
View
75 class.vanilla1.php
@@ -21,7 +21,6 @@ class Vanilla1 extends ExportController {
/**
* Forum-specific export format
* @todo Project file size / export time and possibly break into multiple files
- * @param ExportModel $Ex
*
*/
protected function ForumExport($Ex) {
@@ -56,16 +55,6 @@ protected function ForumExport($Ex) {
'Description'=>'Description'
);
$Ex->ExportTable('Role', 'select * from :_Role', $Role_Map);
-
- // Permissions.
- $Permission_Map = array(
- 'RoleID'=>'RoleID',
- 'PERMISSION_SIGN_IN2'=>'Garden.SignIn.Allow',
- 'View1'=>'Vanilla.Discussions.View',
- 'PERMISSION_START_DISCUSSION'=>array('Column'=>'Vanilla.Discussions.Add', 'Filter'=>array($this,'ExplodePermissions')),
- 'PERMISSION_ADD_COMMENTS'=>array('Column'=>'Vanilla.Comments.Add', 'Filter'=>array($this,'ExplodePermissions'))
- );
- $Ex->ExportTable('Permission', "select r.*, case Name when 'Unauthenticated' then 0 else PERMISSION_SIGN_IN end as PERMISSION_SIGN_IN2 from :_Role r", $Permission_Map);
// UserRoles
/*
@@ -162,8 +151,7 @@ protected function ForumExport($Ex) {
JOIN :_Discussion d
ON c.DiscussionID = d.DiscussionID
WHERE coalesce(d.WhisperUserID, 0) = 0
- AND coalesce(c.WhisperUserID, 0) = 0
- AND coalesce(c.Deleted, 0) = 0", $Comment_Map);
+ AND coalesce(c.WhisperUserID, 0) = 0", $Comment_Map);
$Ex->ExportTable('UserDiscussion', "
SELECT
@@ -180,9 +168,9 @@ protected function ForumExport($Ex) {
// Create a mapping table for conversations.
// This cannot be a temporary table because of some of the union selects it is used in below.
- $Ex->Query("create table :_V1Conversation (ConversationID int auto_increment primary key, DiscussionID int, UserID1 int, UserID2 int, DateCreated datetime, EditUserID int, DateEdited datetime)");
+ $Ex->Query("create table LUM_V1Conversation (ConversationID int auto_increment primary key, DiscussionID int, UserID1 int, UserID2 int, DateCreated datetime, EditUserID int, DateEdited datetime)");
- $Ex->Query("insert :_V1Conversation (DiscussionID, UserID1, UserID2, DateCreated, EditUserID, DateEdited)
+ $Ex->Query("insert LUM_V1Conversation (DiscussionID, UserID1, UserID2, DateCreated, EditUserID, DateEdited)
select
DiscussionID,
AuthUserID as UserID1,
@@ -190,7 +178,7 @@ protected function ForumExport($Ex) {
min(DateCreated),
max(EditUserID),
max(DateEdited)
- from :_Comment
+ from LUM_Comment
where coalesce(WhisperUserID, 0) <> 0
group by DiscussionID, AuthUserID, WhisperUserID
@@ -203,14 +191,14 @@ protected function ForumExport($Ex) {
DateCreated,
WhisperFromLastUserID,
DateLastWhisper
- from :_Discussion
+ from LUM_Discussion
where coalesce(WhisperUserID, 0) <> 0");
// Delete redundant conversations.
- $Ex->Query("create index ix_V1UserID1 on :_V1Conversation (DiscussionID, UserID1)"); // for speed
+ $Ex->Query("create index ix_V1UserID1 on LUM_V1Conversation (DiscussionID, UserID1)"); // for speed
$Ex->Query("delete t.*
- from :_V1Conversation t
- inner join :_Comment c
+ from LUM_V1Conversation t
+ inner join LUM_Comment c
on c.DiscussionID = t.DiscussionID
and c.AuthUserID = t.UserID2
and c.WhisperUserID = t.UserID1
@@ -242,8 +230,8 @@ protected function ForumExport($Ex) {
);
$Ex->ExportTable('ConversationMessage', "
select c.CommentID, t.ConversationID, c.AuthUserID, c.DateCreated, c.Body
- from :_Comment c
- join :_V1Conversation t
+ from LUM_Comment c
+ join LUM_V1Conversation t
on t.DiscussionID = c.DiscussionID
and c.WhisperUserID in (t.UserID1, t.UserID2)
and c.AuthUserID in (t.UserID1, t.UserID2)
@@ -252,10 +240,10 @@ protected function ForumExport($Ex) {
union
select c.CommentID, t.ConversationID, c.AuthUserID, c.DateCreated, c.Body
- from :_Comment c
- join :_Discussion d
+ from LUM_Comment c
+ join LUM_Discussion d
on c.DiscussionID = d.DiscussionID
- join :_V1Conversation t
+ join LUM_V1Conversation t
on t.DiscussionID = d.DiscussionID
and d.WhisperUserID in (t.UserID1, t.UserID2)
and d.AuthUserID in (t.UserID1, t.UserID2)
@@ -273,51 +261,18 @@ protected function ForumExport($Ex) {
);
$Ex->ExportTable('UserConversation',
"select UserID1 as UserID, ConversationID
- from :_V1Conversation
+ from LUM_V1Conversation
union
select UserID2 as UserID, ConversationID
- from :_V1Conversation", $UserConversation_Map);
+ from LUM_V1Conversation", $UserConversation_Map);
$Ex->Query("drop table :_V1Conversation");
-
- if ($Ex->Exists('Attachment')) {
- $Media_Map = array(
- 'AttachmentID' => 'MediaID',
- 'Name' => 'Name',
- 'MimeType' => 'Type',
- 'Size' => 'Size',
- //'StorageMethod',
- 'Path' => array('Column' => 'Path', 'Filter' => array($this, 'StripMediaPath')),
- 'UserID' => 'InsertUserID',
- 'DateCreated' => 'DateInserted',
- 'CommentID' => 'ForeignID'
- //'ForeignTable'
- );
- $Ex->ExportTable('Media',
- "select a.*, 'local' as StorageMethod, 'comment' as ForeignTable from :_Attachment a",
- $Media_Map);
- }
-
// End
$Ex->EndExport();
}
- public function StripMediaPath($AbsPath) {
- $AbsPath = str_replace('\\', '/', $AbsPath);
- if (($Pos = strpos($AbsPath, '/uploads/')) !== FALSE)
- return substr($AbsPath, $Pos + 9);
- return $AbsPath;
- }
-
- public function ExplodePermissions($Value, $DestField, $Row, $SourceField) {
- $Permissions = $Row['Permissions'];
- $Permissions = unserialize($Permissions);
- if (isset($Permissions[$SourceField]))
- return (bool)$Permissions[$SourceField];
- return 0;
- }
}
?>
View
274 vanilla2export.php
@@ -1,8 +1,7 @@
<?php /* This file was automatically generated by make.php. DO NOT EDIT. */ ?>
<?php
-define('APPLICATION', 'Porter');
-define('APPLICATION_VERSION', '1.3.0');
+define('VERSION', '1.2.0');
/**
* Vanilla 2 Exporter
* This script exports other forum databases to the Vanilla 2 import format.
@@ -32,10 +31,8 @@
$Supported = array(
'vanilla1' => array('name'=> 'Vanilla 1.*', 'prefix'=>'LUM_'),
'vbulletin' => array('name'=>'vBulletin 3.*', 'prefix'=>'vb_'),
- 'phpbb2' => array('name'=>'phpBB 2.*', 'prefix' => 'phpbb_'),
- 'phpbb3' => array('name'=>'phpBB 3.*', 'prefix' => 'phpbb_'),
- 'bbPress' => array('name'=>'bbPress 1.*', 'prefix' => 'bb_'),
- 'SimplePress' => array('name'=>'SimpePress 1.*', 'prefix' => 'wp_')
+ 'phpbb' => array('name'=>'phpBB 3.*', 'prefix' => 'phpbb_'),
+ 'bbPress' => array('name'=>'bbPress 1.*', 'prefx' => 'bb_')
);
// Support Files
@@ -149,24 +146,6 @@ class ExportModel {
'Closed' => 'tinyint',
'Announce' => 'tinyint',
'Sink' => 'tinyint'),
- 'Media' => array(
- 'Name' => 'varchar(255)',
- 'Type' => 'varchar(64)',
- 'Size' => 'int',
- 'StorageMethod' => 'varchar(24)',
- 'Path' => 'varchar(255)',
- 'InsertUserId' => 'int',
- 'DateInserted' => 'datetime',
- 'ForeignID' => 'int',
- 'ForeignTable' => 'varchar(24)'
- ),
- 'Permission' => array(
- 'RoleID' => 'int',
- 'Garden.SignIn.Allow' => 'tinyint',
- 'Vanilla.Discussions.View' => 'tinyint',
- 'Vanilla.Discussions.Add' => 'tinyint',
- 'Vanilla.Comments.Add' => 'tinyint'
- ),
'Role' => array(
'RoleID' => 'int',
'Name' => 'varchar(100)',
@@ -372,17 +351,6 @@ protected function _ExportTable($TableName, $Query, $Mappings = array()) {
} else {
$Value = NULL;
}
-
- if ($TableName == 'Permission') {
- $Foo = 'Bar';
- }
-
- // Check to see if there is a callback filter.
- if (isset($Filters[$Field])) {
- $Callback = $Filters[$Field];
- $Value = call_user_func($Filters[$Field], $Value, $Field, $Row, $Column);
- }
-
// Format the value for writing.
if (is_null($Value)) {
$Value = self::NULL;
@@ -392,7 +360,7 @@ protected function _ExportTable($TableName, $Query, $Mappings = array()) {
// Check to see if there is a callback filter.
if (isset($Filters[$Field])) {
- //$Value = call_user_func($Filters[$Field], $Value, $Field, $Row);
+ $Value = call_user_func($Filters[$Field], $Value, $Field, $Row);
} else {
if($Mb && mb_detect_encoding($Value) != 'UTF-8')
$Value = utf8_encode($Value);
@@ -552,25 +520,6 @@ public function GetExportStructure($Row, $Structure, &$Mappings) {
$ExportStructure[$DestColumn] = $DestType;
}
}
-
- // Add filtered mappings since filters can add new columns.
- foreach ($Mappings as $Source => $Options) {
- if (!is_array($Options) || !isset($Options['Filter']) || !isset($Options['Column']))
- continue;
- $DestColumn = $Options['Column'];
- if (isset($ExportStructure[$DestColumn]))
- continue;
-
- if (isset($Structure[$DestColumn]))
- $DestType = $Structure[$DestColumn];
- elseif (isset($Options['Type']))
- $DestType = $Options['Type'];
- else
- continue;
-
- $ExportStructure[$DestColumn] = $DestType;
- }
-
return $ExportStructure;
}
@@ -700,7 +649,7 @@ public function UseCompression($Value = NULL) {
* @return string
*/
public function Version() {
- return APPLICATION_VERSION;
+ return VERSION;
}
/**
@@ -1069,7 +1018,7 @@ function PageHeader() {
<div class="Title">
<h1>
<img src="http://vanillaforums.com/porter/vanilla_logo.png" alt="Vanilla" />
- <p>Vanilla Porter <span class="Version">Version <?php echo APPLICATION_VERSION; ?></span></p>
+ <p>Vanilla Porter <span class="Version">Version <?php echo VERSION; ?></span></p>
</h1>
</div>
<?php
@@ -1348,7 +1297,6 @@ class Vanilla1 extends ExportController {
/**
* Forum-specific export format
* @todo Project file size / export time and possibly break into multiple files
- * @param ExportModel $Ex
*
*/
protected function ForumExport($Ex) {
@@ -1383,16 +1331,6 @@ protected function ForumExport($Ex) {
'Description'=>'Description'
);
$Ex->ExportTable('Role', 'select * from :_Role', $Role_Map);
-
- // Permissions.
- $Permission_Map = array(
- 'RoleID'=>'RoleID',
- 'PERMISSION_SIGN_IN2'=>'Garden.SignIn.Allow',
- 'View1'=>'Vanilla.Discussions.View',
- 'PERMISSION_START_DISCUSSION'=>array('Column'=>'Vanilla.Discussions.Add', 'Filter'=>array($this,'ExplodePermissions')),
- 'PERMISSION_ADD_COMMENTS'=>array('Column'=>'Vanilla.Comments.Add', 'Filter'=>array($this,'ExplodePermissions'))
- );
- $Ex->ExportTable('Permission', "select r.*, case Name when 'Unauthenticated' then 0 else PERMISSION_SIGN_IN end as PERMISSION_SIGN_IN2 from :_Role r", $Permission_Map);
// UserRoles
/*
@@ -1489,8 +1427,7 @@ protected function ForumExport($Ex) {
JOIN :_Discussion d
ON c.DiscussionID = d.DiscussionID
WHERE coalesce(d.WhisperUserID, 0) = 0
- AND coalesce(c.WhisperUserID, 0) = 0
- AND coalesce(c.Deleted, 0) = 0", $Comment_Map);
+ AND coalesce(c.WhisperUserID, 0) = 0", $Comment_Map);
$Ex->ExportTable('UserDiscussion', "
SELECT
@@ -1507,9 +1444,9 @@ protected function ForumExport($Ex) {
// Create a mapping table for conversations.
// This cannot be a temporary table because of some of the union selects it is used in below.
- $Ex->Query("create table :_V1Conversation (ConversationID int auto_increment primary key, DiscussionID int, UserID1 int, UserID2 int, DateCreated datetime, EditUserID int, DateEdited datetime)");
+ $Ex->Query("create table LUM_V1Conversation (ConversationID int auto_increment primary key, DiscussionID int, UserID1 int, UserID2 int, DateCreated datetime, EditUserID int, DateEdited datetime)");
- $Ex->Query("insert :_V1Conversation (DiscussionID, UserID1, UserID2, DateCreated, EditUserID, DateEdited)
+ $Ex->Query("insert LUM_V1Conversation (DiscussionID, UserID1, UserID2, DateCreated, EditUserID, DateEdited)
select
DiscussionID,
AuthUserID as UserID1,
@@ -1517,7 +1454,7 @@ protected function ForumExport($Ex) {
min(DateCreated),
max(EditUserID),
max(DateEdited)
- from :_Comment
+ from LUM_Comment
where coalesce(WhisperUserID, 0) <> 0
group by DiscussionID, AuthUserID, WhisperUserID
@@ -1530,14 +1467,14 @@ protected function ForumExport($Ex) {
DateCreated,
WhisperFromLastUserID,
DateLastWhisper
- from :_Discussion
+ from LUM_Discussion
where coalesce(WhisperUserID, 0) <> 0");
// Delete redundant conversations.
- $Ex->Query("create index ix_V1UserID1 on :_V1Conversation (DiscussionID, UserID1)"); // for speed
+ $Ex->Query("create index ix_V1UserID1 on LUM_V1Conversation (DiscussionID, UserID1)"); // for speed
$Ex->Query("delete t.*
- from :_V1Conversation t
- inner join :_Comment c
+ from LUM_V1Conversation t
+ inner join LUM_Comment c
on c.DiscussionID = t.DiscussionID
and c.AuthUserID = t.UserID2
and c.WhisperUserID = t.UserID1
@@ -1569,8 +1506,8 @@ protected function ForumExport($Ex) {
);
$Ex->ExportTable('ConversationMessage', "
select c.CommentID, t.ConversationID, c.AuthUserID, c.DateCreated, c.Body
- from :_Comment c
- join :_V1Conversation t
+ from LUM_Comment c
+ join LUM_V1Conversation t
on t.DiscussionID = c.DiscussionID
and c.WhisperUserID in (t.UserID1, t.UserID2)
and c.AuthUserID in (t.UserID1, t.UserID2)
@@ -1579,10 +1516,10 @@ protected function ForumExport($Ex) {
union
select c.CommentID, t.ConversationID, c.AuthUserID, c.DateCreated, c.Body
- from :_Comment c
- join :_Discussion d
+ from LUM_Comment c
+ join LUM_Discussion d
on c.DiscussionID = d.DiscussionID
- join :_V1Conversation t
+ join LUM_V1Conversation t
on t.DiscussionID = d.DiscussionID
and d.WhisperUserID in (t.UserID1, t.UserID2)
and d.AuthUserID in (t.UserID1, t.UserID2)
@@ -1600,52 +1537,19 @@ protected function ForumExport($Ex) {
);
$Ex->ExportTable('UserConversation',
"select UserID1 as UserID, ConversationID
- from :_V1Conversation
+ from LUM_V1Conversation
union
select UserID2 as UserID, ConversationID
- from :_V1Conversation", $UserConversation_Map);
+ from LUM_V1Conversation", $UserConversation_Map);
$Ex->Query("drop table :_V1Conversation");
-
- if ($Ex->Exists('Attachment')) {
- $Media_Map = array(
- 'AttachmentID' => 'MediaID',
- 'Name' => 'Name',
- 'MimeType' => 'Type',
- 'Size' => 'Size',
- //'StorageMethod',
- 'Path' => array('Column' => 'Path', 'Filter' => array($this, 'StripMediaPath')),
- 'UserID' => 'InsertUserID',
- 'DateCreated' => 'DateInserted',
- 'CommentID' => 'ForeignID'
- //'ForeignTable'
- );
- $Ex->ExportTable('Media',
- "select a.*, 'local' as StorageMethod, 'comment' as ForeignTable from :_Attachment a",
- $Media_Map);
- }
-
// End
$Ex->EndExport();
}
- public function StripMediaPath($AbsPath) {
- $AbsPath = str_replace('\\', '/', $AbsPath);
- if (($Pos = strpos($AbsPath, '/uploads/')) !== FALSE)
- return substr($AbsPath, $Pos + 9);
- return $AbsPath;
- }
-
- public function ExplodePermissions($Value, $DestField, $Row, $SourceField) {
- $Permissions = $Row['Permissions'];
- $Permissions = unserialize($Permissions);
- if (isset($Permissions[$SourceField]))
- return (bool)$Permissions[$SourceField];
- return 0;
- }
}
?>
<?php
@@ -1847,7 +1751,7 @@ protected function ForumExport($Ex) {
?><?php
-/* Contents included from class.phpbb2.php */
+/* Contents included from class.phpbb.php */
?><?php
/**
* phpBB exporter tool
@@ -1857,133 +1761,7 @@ protected function ForumExport($Ex) {
* @package VanillaPorter
*/
-class Phpbb2 extends ExportController {
-
- /** @var array Required tables => columns */
- protected $SourceTables = array(
- 'users' => array('user_id', 'username', 'user_password', 'user_email', 'user_timezone', 'user_posts', 'user_regdate', 'user_lastvisit'),
- 'groups' => array('group_id', 'group_name', 'group_description'),
- 'user_group' => array('user_id', 'group_id'),
- 'forums' => array('forum_id', 'forum_name', 'forum_desc', 'forum_order'),
- 'topics' => array('topic_id', 'forum_id', 'topic_poster', 'topic_title', 'topic_views', 'topic_first_post_id',
- 'topic_replies', 'topic_status', 'topic_type', 'topic_time'),
- 'posts' => array('post_id', 'topic_id', 'poster_id', 'post_time', 'post_edit_time'),
- 'posts_text' => array('post_id', 'post_text')
- );
-
- /**
- * Forum-specific export format.
- * @param ExportModel $Ex
- */
- protected function ForumExport($Ex) {
- // Begin
- $Ex->BeginExport('', 'phpBB 2.*', array('HashMethod' => 'phpBB'));
-
- // Users
- $User_Map = array(
- 'user_id'=>'UserID',
- 'username'=>'Name',
- 'user_password'=>'Password',
- 'user_email'=>'Email',
- 'user_timezone'=>'HourOffset',
- 'user_posts'=>array('Column' => 'CountComments', 'Type' => 'int')
- );
- $Ex->ExportTable('User', "select *,
- FROM_UNIXTIME(nullif(user_regdate, 0)) as DateFirstVisit,
- FROM_UNIXTIME(nullif(user_lastvisit, 0)) as DateLastActive,
- FROM_UNIXTIME(nullif(user_regdate, 0)) as DateInserted
- from :_users", $User_Map); // ":_" will be replace by database prefix
-
-
- // Roles
- $Role_Map = array(
- 'group_id'=>'RoleID',
- 'group_name'=>'Name',
- 'group_description'=>'Description'
- );
- $Ex->ExportTable('Role', 'select * from :_groups', $Role_Map);
-
-
- // UserRoles
- $UserRole_Map = array(
- 'user_id'=>'UserID',
- 'group_id'=>'RoleID'
- );
- $Ex->ExportTable('UserRole', 'select user_id, group_id from :_users
- union
- select user_id, group_id from :_user_group', $UserRole_Map);
-
- // Categories
- $Category_Map = array(
- 'forum_id'=>'CategoryID',
- 'forum_name'=>'Name',
- 'forum_desc'=>'Description',
- 'forum_order'=>'Sort'
- );
- $Ex->ExportTable('Category', "select * from :_forums", $Category_Map);
-
-
- // Discussions
- $Discussion_Map = array(
- 'topic_id'=>'DiscussionID',
- 'forum_id'=>'CategoryID',
- 'topic_poster'=>'InsertUserID',
- 'topic_title'=>'Name',
- 'Format'=>'Format',
- 'topic_views'=>'CountViews',
- 'topic_first_post_id'=>array('Column'=>'FirstCommentID','Type'=>'int')
- );
- $Ex->ExportTable('Discussion', "select t.*,
- 'BBCode' as Format,
- t.topic_replies+1 as CountComments,
- case t.topic_status when 1 then 1 else 0 end as Closed,
- case t.topic_type when 1 then 1 else 0 end as Announce,
- FROM_UNIXTIME(t.topic_time) as DateInserted,
- FROM_UNIXTIME(p.post_time) as DateUpdated,
- FROM_UNIXTIME(p.post_time) as DateLastComment
- from :_topics t inner join :_posts p on t.topic_last_post_id = p.post_id",
- $Discussion_Map);
-
- // Comments
- $Comment_Map = array(
- 'post_id' => 'CommentID',
- 'topic_id' => 'DiscussionID',
- 'post_text' => array('Column'=>'Body','Filter'=>array($this, 'RemoveBBCodeUIDs')),
- 'Format' => 'Format',
- 'poster_id' => 'InsertUserID',
- 'poster_id' => 'UpdateUserID'
- );
- $Ex->ExportTable('Comment', "select p.*, pt.post_text,
- 'BBCode' as Format,
- FROM_UNIXTIME(p.post_time) as DateInserted,
- FROM_UNIXTIME(nullif(p.post_edit_time,0)) as DateUpdated
- from :_posts p inner join :_posts_text pt on p.post_id = pt.post_id",
- $Comment_Map);
-
- // End
- $Ex->EndExport();
- }
-
- public function RemoveBBCodeUIDs($Value, $Field, $Row) {
- $UID = $Row['bbcode_uid'];
- return str_replace(':'.$UID, '', $Value);
- }
-}
-?>
-<?php
-
-
-/* Contents included from class.phpbb3.php */
-?><?php
-/**
- * phpBB exporter tool
- *
- * @copyright Vanilla Forums Inc. 2010
- * @license http://opensource.org/licenses/gpl-2.0.php GNU GPL2
- * @package VanillaPorter
- */
-
-class Phpbb3 extends ExportController {
+class Phpbb extends ExportController {
/** @var array Required tables => columns */
protected $SourceTables = array(
@@ -2335,10 +2113,6 @@ function bb_decodeit( $matches ) {
?><?php
-/* Contents included from class.simplepress.php */
-?><?php
-
-
// Make sure a default time zone is set
if (ini_get('date.timezone') == '')
date_default_timezone_set('America/Montreal');
@@ -2384,4 +2158,4 @@ function TestWrite() {
}
else return false;
}
-?>
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.