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 Master 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
|
||||
*/
|
||||
@@ -128,6 +128,10 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'table' => 'user',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertMemberHistory' => array(
|
||||
'table' => 'userchangelog',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertStatuses' => array(
|
||||
'table' => 'visitormessage',
|
||||
'where' => NULL
|
||||
@@ -151,6 +155,14 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'convertRanks' => array(
|
||||
'table' => 'usertitle',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertClubs' => array(
|
||||
'table' => 'socialgroup',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertClubMembers' => array(
|
||||
'table' => 'socialgroupmember',
|
||||
'where' => NULL
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -244,6 +256,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'convertProfileFields',
|
||||
'convertGroups',
|
||||
'convertMembers',
|
||||
'convertClubs'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -419,6 +432,24 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'convertClubs':
|
||||
$return['convertClubs'] = array();
|
||||
$return['convertClubs']['photo_location'] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => 'database',
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array(
|
||||
'options' => array(
|
||||
'database' => \IPS\Member::loggedIn()->language()->addToStack( 'database' ),
|
||||
'file_system' => \IPS\Member::loggedIn()->language()->addToStack( 'file_system' ),
|
||||
),
|
||||
'userSuppliedInput' => 'file_system',
|
||||
),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => function( $value ) { if ( $value != 'database' AND !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
return ( isset( $return[ $method ] ) ) ? $return[ $method ] : array();
|
||||
@@ -816,7 +847,6 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'g_bitoptions' => array(
|
||||
'gbw_promote_unit_type' => $gbw_promote_unit, // Type of group promotion to use. 1 is days since joining, 0 is content count. Corresponds to g_promotion
|
||||
'gbw_no_status_update' => !$checkpermission( 'visitormessagepermissions', 'canmessageownprofile' ), // Can NOT post status updates
|
||||
'gbw_soft_delete_own' => $checkpermission( 'forumpermissions', 'candeletepost' ), // Allow users of this group to hide their own submitted content
|
||||
'gbw_allow_upload_bgimage' => 1, // Can upload a cover photo?
|
||||
'gbw_view_reps' => $checkpermission( 'genericpermissions2', 'canprofilerep' ), // Can view who gave reputation?
|
||||
'gbw_no_status_import' => !$checkpermission( 'visitormessagepermissions', 'canmessageownprofile' ), // Can NOT import status updates from Facebook/Twitter
|
||||
@@ -825,6 +855,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'gbw_pm_override_inbox_full'=> $checkpermission( 'pmpermissions', 'canignorequota' ), // 1 means this group can send other members PMs even when that member's inbox is full
|
||||
'gbw_cannot_be_ignored' => ( ( $checkpermission( 'adminpermissions', 'ismoderator' ) OR $checkpermission( 'adminpermissions', 'cancontrolpanel' ) ) AND $this->_setting( 'ignoremods' ) ), // 1 means they cannot be ignored. 0 means they can
|
||||
),
|
||||
'g_hide_own_posts' => $checkpermission( 'forumpermissions', 'candeletepost' ),
|
||||
'g_pm_flood_mins' => $this->_setting( 'pmfloodtime' ) / 60,
|
||||
'g_post_polls' => $checkpermission( 'forumpermissions', 'canpostpoll' ) ? 1 : 0,
|
||||
'g_vote_polls' => $checkpermission( 'forumpermissions', 'canvote' ) ? 1 : 0,
|
||||
@@ -837,6 +868,81 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
|
||||
$libraryClass->setLastKeyValue( $group['usergroupid'] );
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
$libraryClass->convertGroupPromotion( $groupPromotion );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Member history type map
|
||||
*/
|
||||
protected $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'member_group_id', 'membergroupids' => 'mgroup_others' );
|
||||
|
||||
/**
|
||||
* Convert member history
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertMemberHistory()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'changeid' );
|
||||
|
||||
$fixGroups = function( $string )
|
||||
{
|
||||
$groups = explode( ',', $string );
|
||||
$newGroups = array();
|
||||
|
||||
array_walk( $groups, function( &$item, $key ) use ( &$newGroups )
|
||||
{
|
||||
try
|
||||
{
|
||||
$item = $this->app->getLink( $item, 'core_groups' );
|
||||
$newGroups[] = $item;
|
||||
}
|
||||
catch( \OutOfRangeException $e ){}
|
||||
});
|
||||
|
||||
return implode( ',', $newGroups );
|
||||
};
|
||||
|
||||
foreach( $this->fetch( 'userchangelog', 'changeid' ) AS $change )
|
||||
{
|
||||
if( !in_array( $change['fieldname'], array_keys( $this->changeLogTypes ) ) )
|
||||
{
|
||||
$libraryClass->setLastKeyValue( $change['changeid'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Any processing we need to do */
|
||||
switch( $this->changeLogTypes[ $change['fieldname'] ] )
|
||||
{
|
||||
case 'member_group_id':
|
||||
case 'mgroup_others':
|
||||
$change['oldvalue'] = $fixGroups( $change['oldvalue'] );
|
||||
$change['newvalue'] = $fixGroups( $change['newvalue'] );
|
||||
break;
|
||||
}
|
||||
|
||||
$libraryClass->convertMemberHistory( array(
|
||||
'log_id' => $change['changeid'],
|
||||
'log_member' => $change['userid'],
|
||||
'log_by' => $change['adminid'],
|
||||
'log_type' => $this->changeLogTypes[ $change['fieldname'] ],
|
||||
'log_data' => array( 'old' => $change['oldvalue'], 'new' => $change['newvalue'] ),
|
||||
'log_date' => $change['change_time']
|
||||
)
|
||||
);
|
||||
|
||||
$libraryClass->setLastKeyValue( $change['changeid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1152,15 +1258,26 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
/* And warn logs made on the profile - we'll do content specific later */
|
||||
foreach( $this->db->select( '*', 'infraction', array( "userid=? AND postid=?", $user['userid'], 0 ) ) AS $warn )
|
||||
{
|
||||
$libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warn['infractionid'],
|
||||
'wl_member' => $warn['userid'],
|
||||
'wl_moderator' => $warn['whoadded'],
|
||||
'wl_date' => $warn['dateline'],
|
||||
'wl_points' => $warn['points'],
|
||||
'wl_note_member' => $warn['note'],
|
||||
'wl_note_mods' => $warn['customreason'],
|
||||
) );
|
||||
$warnId = $libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warn['infractionid'],
|
||||
'wl_member' => $warn['userid'],
|
||||
'wl_moderator' => $warn['whoadded'],
|
||||
'wl_date' => $warn['dateline'],
|
||||
'wl_points' => $warn['points'],
|
||||
'wl_note_member' => $warn['note'],
|
||||
'wl_note_mods' => $warn['customreason'],
|
||||
) );
|
||||
|
||||
/* Add a member history record for this member */
|
||||
$libraryClass->convertMemberHistory( array(
|
||||
'log_id' => 'w' . $warn['infractionid'],
|
||||
'log_member' => $warn['userid'],
|
||||
'log_by' => $warn['whoadded'],
|
||||
'log_type' => 'warning',
|
||||
'log_data' => array( 'wid' => $warnId ),
|
||||
'log_date' => $warn['dateline']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $user['userid'] );
|
||||
@@ -1447,6 +1564,109 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert clubs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubs()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'groupid' );
|
||||
|
||||
foreach( $this->fetch( 'socialgroup', 'groupid' ) AS $group )
|
||||
{
|
||||
switch( $group['type'] )
|
||||
{
|
||||
case 'public':
|
||||
$type = 'public';
|
||||
break;
|
||||
|
||||
case 'moderated':
|
||||
$type = 'closed';
|
||||
break;
|
||||
|
||||
case 'inviteonly':
|
||||
$type = 'private';
|
||||
break;
|
||||
}
|
||||
|
||||
$icon = NULL;
|
||||
try
|
||||
{
|
||||
$icon = $this->db->select( '*', 'socialgroupicon', array( "groupid=?", $group['groupid'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
|
||||
$info = array(
|
||||
'club_id' => $group['groupid'],
|
||||
'name' => $group['name'],
|
||||
'type' => $type,
|
||||
'created' => $group['dateline'],
|
||||
'members' => $group['members'],
|
||||
'owner' => $group['creatoruserid'],
|
||||
'profile_photo' => ( $icon ) ? "clubicon{$group['groupid']}.{$icon['extension']}" : NULL,
|
||||
'about' => $group['description'],
|
||||
'last_activity' => $group['lastupdate']
|
||||
);
|
||||
|
||||
$iconpath = NULL;
|
||||
$icondata = NULL;
|
||||
if ( $icon )
|
||||
{
|
||||
if ( $this->app->_session['more_info']['convertClubs']['photo_location'] == 'database' )
|
||||
{
|
||||
$icondata = $icon['filedata'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$iconpath = $this->app->_session['more_info']['convertClubs']['photo_location'] . "/socialgroupicon_{$icon['groupid']}_{$icon['dateline']}.gif";
|
||||
}
|
||||
}
|
||||
|
||||
$libraryClass->convertClub( $info, $iconpath, $icondata );
|
||||
|
||||
$libraryClass->setLastKeyValue( $group['groupid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert club members
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubMembers()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
foreach( $this->fetch( 'socialgroupmember', 'groupid' ) AS $member )
|
||||
{
|
||||
$type = NULL;
|
||||
try
|
||||
{
|
||||
$group = $this->db->select( '*', 'socialgroup', array( "groupid=?", $member['groupid'] ) )->first();
|
||||
|
||||
if ( $member['userid'] == $group['creatoruserid'] )
|
||||
{
|
||||
$type = 'leader';
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
|
||||
if ( $type === NULL )
|
||||
{
|
||||
$type = ( $member['type'] === 'moderated' ) ? 'requested' : $member['type'];
|
||||
}
|
||||
|
||||
$libraryClass->convertClubMember( array(
|
||||
'club_id' => $member['groupid'],
|
||||
'member_id' => $member['userid'],
|
||||
'joined' => $member['dateline'],
|
||||
'status' => $type,
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
/* !vBulletin Specific Stuff */
|
||||
/**
|
||||
* @brief Silly Bit Options for Groups. Typically we would leave out app specific options (such as Forums here) however we need them for some general permissions, like uploading.
|
||||
@@ -1626,6 +1846,13 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'allowsmilies' => 4,
|
||||
'parseurl' => 8,
|
||||
'signature' => 16,
|
||||
),
|
||||
'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