Version 4.7.0

This commit is contained in:
Neo committed 2025-12-19 16:00:35 -08:00
1 parent 517a5e1f70
commit 8ba7d43898
1933 files changed
+65613 -11332

No files matched your search

@@ -132,8 +132,13 @@ class _Vbulletin extends \IPS\convert\Software
'where' => NULL
),
'convertMembers' => array(
'table' => 'user',
'where' => NULL
'table' => 'user',
'where' => NULL,
'extra_steps' => array( 'convertMembersFollowers' ),
),
'convertMembersFollowers' => array(
'table' => 'userlist',
'where' => array( "type=? AND friend=?", 'buddy', 'yes' )
),
'convertMemberHistory' => array(
'table' => 'userchangelog',
@@ -170,6 +175,32 @@ class _Vbulletin extends \IPS\convert\Software
);
}
/**
* Allows software to add additional menu row options
*
* @return array
*/
public function extraMenuRows()
{
$rows = array();
$count = $this->countRows( static::canConvert()['convertMembersFollowers']['table'], static::canConvert()['convertMembersFollowers']['where'] );
if( $count )
{
$rows['convertMembersFollowers'] = array(
'step_method' => 'convertMembersFollowers',
'step_title' => 'convert_follows',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_follow', array( 'follow_app=? and follow_area=?', 'core', 'member' ) ),
'source_rows' => $count,
'per_cycle' => 200,
'dependencies' => array( 'convertMembers' ),
'link_type' => 'core_follow',
);
}
return $rows;
}
/**
* Count Source Rows for a specific step
*
@@ -539,6 +570,7 @@ class _Vbulletin extends \IPS\convert\Software
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'core_member_status_updates', 'class' => 'IPS\core\Statuses\Status' ), 2, array( 'app', 'link', 'class' ) );
/* Non-Content Rebuilds */
\IPS\Task::queue( 'convert', 'RebuildProfilePhotos', array( 'app' => $this->app->app_id ), 5, array( 'app' ) );
\IPS\Task::queue( 'convert', 'RebuildNonContent', array( 'app' => $this->app->app_id, 'link' => 'core_announcements', 'extension' => 'core_Announcement' ), 2, array( 'app', 'link', 'extension' ) );
\IPS\Task::queue( 'convert', 'RebuildNonContent', array( 'app' => $this->app->app_id, 'link' => 'core_message_posts', 'extension' => 'core_Messaging' ), 2, array( 'app', 'link', 'extension' ) );
\IPS\Task::queue( 'convert', 'RebuildNonContent', array( 'app' => $this->app->app_id, 'link' => 'core_members', 'extension' => 'core_Signatures' ), 2, array( 'app', 'link', 'extension' ) );
@@ -585,7 +617,7 @@ class _Vbulletin extends \IPS\convert\Software
/* Remove video tags and allow our parser to handle the embeds it supports */
if( \preg_match( "#\[video=#i", $post ) )
{
$post = preg_replace( "#\[video=[a-z_]+;[a-z0-9_]+\](.*?)\[\/video\]#i", '$1', $post );
$post = preg_replace( "#\[video=[a-z_]+;[a-z0-9_-]+\](.*?)\[\/video\]#i", '$1', $post );
}
/* This is not a core feature in vBulletin, but is a popular addon and the code was supplied below.
@@ -667,8 +699,24 @@ class _Vbulletin extends \IPS\convert\Software
'title' => $imageCategory['title'],
'position' => $imageCategory['displayorder']
);
/* In some rare cases, these may be URLs to a CDN */
$filedata = $filepath = null;
if ( mb_substr( $emoticon['smiliepath'], 0, 4 ) == 'http' )
{
/* Remote */
try
{
$filedata = (string) \IPS\Http\Url::external( $emoticon['smiliepath'] )->request()->get();
}
catch( \Exception $e ) {}
}
else
{
$filepath = $this->app->_session['more_info']['convertEmoticons']['emoticon_path'];
}
$libraryClass->convertEmoticon( $info, $set, $this->app->_session['more_info']['convertEmoticons']['keep_existing_emoticons'], $this->app->_session['more_info']['convertEmoticons']['emoticon_path'] );
$libraryClass->convertEmoticon( $info, $set, $this->app->_session['more_info']['convertEmoticons']['keep_existing_emoticons'], $filepath, $filedata );
$libraryClass->setLastKeyValue( $emoticon['smilieid'] );
}
@@ -1013,6 +1061,11 @@ class _Vbulletin extends \IPS\convert\Software
}
}
/**
* @brief default pseudo fields to convert
*/
protected static $pseudoFields = [ 'homepage', 'icq', 'aim', 'yahoo', 'msn', 'skype', 'user_title' ];
/**
* Convert members
*
@@ -1021,14 +1074,21 @@ class _Vbulletin extends \IPS\convert\Software
public function convertMembers()
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'user.userid' );
/* User titles */
$userTitles = iterator_to_array( $this->db->select( 'title', 'usertitle' ) );
$userTitles = array_merge( $userTitles, iterator_to_array( $this->db->select( 'usertitle', 'usergroup', [ 'usertitle!=?', '' ] ) ) );
foreach( $this->fetch( 'user', 'user.userid', NULL, 'user.*, usertextfield.signature' )->join( 'usertextfield', 'user.userid = usertextfield.userid' ) AS $user )
$data = iterator_to_array( $this->fetch( 'user', 'user.userid', NULL, 'user.*, usertextfield.signature' )->join( 'usertextfield', 'user.userid = usertextfield.userid' ) );
$userIds = array_column( $data, 'userid' );
/* User Data */
$bans = iterator_to_array( $this->db->select( 'liftdate, userid', 'userban', [ $this->db->in( 'userid', $userIds ) ] )->setKeyField('userid')->setValueField( 'liftdate') );
$activation = iterator_to_array( $this->db->select( '*', 'useractivation', [ $this->db->in( 'userid', $userIds ) ] )->setKeyField('userid') );
$fields = iterator_to_array( $this->db->select( '*', 'userfield', [ $this->db->in( 'userid', $userIds ) ] )->setKeyField( 'userid' ) );
foreach( $data AS $user )
{
/* <3 Closures */
$self = $this;
@@ -1100,7 +1160,11 @@ class _Vbulletin extends \IPS\convert\Software
$temp_ban = 0;
try
{
$temp_ban = $this->db->select( 'liftdate', 'userban', array( "userid=?", $user['userid'] ) )->first();
if( !isset( $bans[ $user['userid'] ] ) )
{
throw new \UnderflowException();
}
$temp_ban = $bans[ $user['userid'] ];
if ( $temp_ban == 0 )
{
@@ -1149,7 +1213,11 @@ class _Vbulletin extends \IPS\convert\Software
/* If there is a validation record for this user, treat them as validating */
try
{
$activation = $this->db->select( '*', 'useractivation', array( "userid=?", $user['userid'] ) )->first();
if( !isset( $activation[ $user['userid'] ] ) )
{
throw new \UnderflowException();
}
$activation = $activation[ $user['userid'] ];
$info['members_bitoptions']['validating'] = TRUE;
}
@@ -1161,7 +1229,11 @@ class _Vbulletin extends \IPS\convert\Software
/* Profile Fields */
try
{
$profileFields = $this->db->select( '*', 'userfield', array( "userid=?", $user['userid'] ) )->first();
if( !isset( $fields[ $user['userid'] ] ) )
{
throw new \UnderflowException();
}
$profileFields = $fields[ $user['userid'] ];
unset( $profileFields['userid'] );
unset( $profileFields['temp'] );
@@ -1178,7 +1250,7 @@ class _Vbulletin extends \IPS\convert\Software
}
/* Pseudo Fields */
foreach( array( 'homepage', 'icq', 'aim', 'yahoo', 'msn', 'skype', 'user_title' ) AS $pseudo )
foreach( static::$pseudoFields AS $pseudo )
{
/* Are we retaining? */
if ( $this->app->_session['more_info']['convertMembers']["field_{$pseudo}"] == 'no_convert' )
@@ -1190,7 +1262,7 @@ class _Vbulletin extends \IPS\convert\Software
try
{
/* We don't actually need this, but we need to make sure the field was created */
$fieldId = $this->app->getLink( $pseudo, 'core_pfields_data' );
$this->app->getLink( $pseudo, 'core_pfields_data' );
}
catch( \OutOfRangeException $e )
{
@@ -1369,18 +1441,6 @@ class _Vbulletin extends \IPS\convert\Software
'email_sent' => $activation['dateline']
) );
}
/* Any friends need converting to followers? */
foreach( $this->db->select( '*', 'userlist', array( "type=? AND friend=? AND userid=?", 'buddy', 'yes', $user['userid'] ) ) AS $follower )
{
$libraryClass->convertFollow( array(
'follow_app' => 'core',
'follow_area' => 'member',
'follow_rel_id' => $follower['relationid'],
'follow_rel_id_type' => 'core_members',
'follow_member_id' => $follower['userid'],
) );
}
/* Skip this if we know that the user doesn't have any warnings */
if( \count( $warnings ) )
@@ -1420,6 +1480,28 @@ class _Vbulletin extends \IPS\convert\Software
}
}
/**
* Convert member followers
*
* @return void
*/
public function convertMembersFollowers()
{
$libraryClass = $this->getLibrary();
foreach ( $this->fetch( 'userlist', 'relationid', array( "type=? AND friend=?", 'buddy', 'yes' ) ) as $row )
{
$libraryClass->convertFollow( array(
'follow_app' => 'core',
'follow_area' => 'member',
'follow_rel_id' => $row['relationid'],
'follow_rel_id_type' => 'core_members',
'follow_member_id' => $row['userid'],
'follow_notify_freq' => 'none',
) );
}
}
/**
* Convert status updates
*