Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter vBulletin 4.x Forums Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -121,6 +121,18 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'table' => 'post',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertClubForums' => array(
|
||||
'table' => 'socialgroup',
|
||||
'where' => array( \IPS\Db::i()->bitwiseWhere( array( 'options' => static::$bitOptions['cluboptions'] ), 'enable_group_messages' ) )
|
||||
),
|
||||
'convertClubTopics' => array(
|
||||
'table' => 'discussion',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertClubPosts' => array(
|
||||
'table' => 'groupmessage',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertAttachments' => array(
|
||||
'table' => 'attachment',
|
||||
'where' => ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) ? array( "contenttypeid=?", static::$postContentType ) : NULL
|
||||
@@ -162,6 +174,10 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
\IPS\Task::queue( 'convert', 'RebuildFirstPostIds', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'DeleteEmptyTopics', array( 'app' => $this->app->app_id ), 4, array( 'app' ) );
|
||||
|
||||
/* Rebuild Leaderboard */
|
||||
\IPS\Task::queue( 'core', 'RebuildReputationLeaderboard', array(), 4 );
|
||||
\IPS\Db::i()->delete('core_reputation_leaderboard_history');
|
||||
|
||||
/* Caches */
|
||||
\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'forums_topics', 'class' => 'IPS\forums\Topic' ), 3, array( 'app', 'link', 'class' ) );
|
||||
|
||||
@@ -186,7 +202,10 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
*/
|
||||
public static function checkConf()
|
||||
{
|
||||
return array( 'convertAttachments' );
|
||||
return array(
|
||||
'convertAttachments',
|
||||
'convertForumsPosts'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,6 +219,44 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$return = array();
|
||||
switch( $method )
|
||||
{
|
||||
case 'convertForumsPosts':
|
||||
/* Get our reactions to let the admin map them */
|
||||
$options = array();
|
||||
$descriptions = array();
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_reactions' ), 'IPS\Content\Reaction' ) AS $reaction )
|
||||
{
|
||||
$options[ $reaction->id ] = $reaction->_icon->url;
|
||||
$descriptions[ $reaction->id ] = \IPS\Member::loggedIn()->language()->addToStack('reaction_title_' . $reaction->id ) . '<br>' . $reaction->_description;
|
||||
}
|
||||
|
||||
$return['convertForumsPosts'] = array(
|
||||
'rep_neutral' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => NULL,
|
||||
),
|
||||
'rep_positive' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => NULL,
|
||||
),
|
||||
'rep_negative' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => NULL,
|
||||
),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments'] = array(
|
||||
'file_location' => array(
|
||||
@@ -425,7 +482,6 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'views' => $topic['views'],
|
||||
'approved' => $topic['visible'],
|
||||
'pinned' => $topic['sticky'],
|
||||
'topic_open_time' => $topic['dateline'],
|
||||
'topic_hiddenposts' => $topic['hiddencount'] + $topic['deletedcount']
|
||||
);
|
||||
|
||||
@@ -556,6 +612,11 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
/* Reputation */
|
||||
foreach( $this->db->select( '*', 'reputation', array( "postid=?", $post['postid'] ) ) AS $rep )
|
||||
{
|
||||
$reaction = ( $rep['reputation'] > 0 ) ?
|
||||
$this->app->_session['more_info']['convertForumsPosts']['rep_positive'] :
|
||||
( ( $rep['reputation'] == 0 ) ? $this->app->_session['more_info']['convertForumsPosts']['rep_neutral'] :
|
||||
$this->app->_session['more_info']['convertForumsPosts']['rep_negative'] );
|
||||
|
||||
$libraryClass->convertReputation( array(
|
||||
'id' => $rep['reputationid'],
|
||||
'app' => 'forums',
|
||||
@@ -564,7 +625,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'member_id' => $rep['whoadded'],
|
||||
'member_received' => $rep['userid'],
|
||||
'rep_date' => $rep['dateline'],
|
||||
'rep_rating' => $rep['reputation']
|
||||
'reaction' => $reaction
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -572,6 +633,8 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$latestedit = 0;
|
||||
$reason = NULL;
|
||||
$name = NULL;
|
||||
$newText = static::fixPostData( $post['pagetext'] );
|
||||
|
||||
foreach( $this->db->select( '*', 'postedithistory', array( "postid=?", $post['postid'] ) ) AS $edit )
|
||||
{
|
||||
$libraryClass->convertEditHistory( array(
|
||||
@@ -580,9 +643,12 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'comment_id' => $post['postid'],
|
||||
'member' => $edit['userid'],
|
||||
'time' => $edit['dateline'],
|
||||
'old' => $edit['pagetext']
|
||||
'old' => static::fixPostData( $edit['pagetext'] ),
|
||||
'new' => $newText
|
||||
) );
|
||||
|
||||
$newText = static::fixPostData( $edit['pagetext'] );
|
||||
|
||||
if ( $edit['dateline'] > $latestedit )
|
||||
{
|
||||
$latestedit = $edit['dateline'];
|
||||
@@ -724,6 +790,122 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$libraryClass->setLastKeyValue( $attachment['attachmentid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Club Forums
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubForums()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'groupid' );
|
||||
foreach( $this->fetch( 'socialgroup', 'groupid', array( \IPS\Db::i()->bitwiseWhere( array( 'options' => static::$bitOptions['cluboptions'] ), 'enable_group_messages' ) ) ) AS $row )
|
||||
{
|
||||
$libraryClass->convertClubForum( array(
|
||||
'id' => "clubforum{$row['groupid']}",
|
||||
'name' => "{$row['name']} Topics",
|
||||
'description' => "<p>{$row['description']}</p>",
|
||||
'topics' => $row['discussions'],
|
||||
'club_id' => $row['groupid']
|
||||
) );
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['groupid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Club Topics
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubTopics()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'discussionid' );
|
||||
foreach( $this->fetch( 'discussion', 'discussionid' ) AS $row )
|
||||
{
|
||||
try
|
||||
{
|
||||
$firstpost = $this->db->select( '*', 'groupmessage', array( "gmid=?", $row['firstpostid'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$libraryClass->setLastKeyValue( $row['discussionid'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
switch( $firstpost['state'] )
|
||||
{
|
||||
case 'visible':
|
||||
$approved = 1;
|
||||
break;
|
||||
|
||||
case 'moderation':
|
||||
$approved = 0;
|
||||
break;
|
||||
|
||||
case 'deleted':
|
||||
$approved = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
$libraryClass->convertClubTopic( array(
|
||||
'tid' => "clubtopic{$row['discussionid']}",
|
||||
'title' => $firstpost['title'],
|
||||
'forum_id' => "clubforum{$row['groupid']}",
|
||||
'state' => 'open',
|
||||
'starter_id' => $row['lastposterid'],
|
||||
'start_date' => $firstpost['dateline'],
|
||||
'last_poster_id' => $row['lastposterid'],
|
||||
'last_post' => $row['lastpost'],
|
||||
'starter_name' => $firstpost['postusername'],
|
||||
'last_poster_name' => $row['lastposter'],
|
||||
'approved' => $approved,
|
||||
) );
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['discussionid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Club Posts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubPosts()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'gmid' );
|
||||
foreach( $this->fetch( 'groupmessage', 'gmid' ) AS $row )
|
||||
{
|
||||
switch( $row['state'] )
|
||||
{
|
||||
case 'visible':
|
||||
$queued = 0;
|
||||
break;
|
||||
|
||||
case 'moderation':
|
||||
$queued = 1;
|
||||
break;
|
||||
|
||||
case 'deleted':
|
||||
$queued = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
$libraryClass->convertClubPost( array(
|
||||
'pid' => "clubpost{$row['gmid']}",
|
||||
'topic_id' => "clubtopic{$row['discussionid']}",
|
||||
'post' => static::fixPostData( $row['pagetext'] ),
|
||||
'author_id' => $row['postuserid'],
|
||||
'author_name' => $row['postusername'],
|
||||
'post_date' => $row['dateline'],
|
||||
'queued' => $queued,
|
||||
) );
|
||||
$libraryClass->setLastKeyValue( $row['gmid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/* !vBulletin Stuff */
|
||||
|
||||
@@ -755,6 +937,13 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'displaywrt' => 1048576,
|
||||
'canreputation' => 2097152,
|
||||
),
|
||||
'cluboptions' => array(
|
||||
'owner_mod_queue' => 1,
|
||||
'join_to_view' => 2,
|
||||
'enable_group_messages' => 4,
|
||||
'enable_group_albums' => 8,
|
||||
'only_owner_discussions' => 16
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user