Version 4.7.0
This commit is contained in:
1 parent
517a5e1f70
commit
8ba7d43898
1933 files changed
+65613
-11332
No files matched your search
@@ -298,6 +298,7 @@ class _Expressionengine extends \IPS\convert\Software
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* 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_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' ) );
|
||||
|
||||
|
||||
@@ -52,13 +52,17 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
{
|
||||
static::$dbNeeded = TRUE;
|
||||
|
||||
$version = $this->db->select( 'app_version', 'core_applications', array( 'app_directory=?', 'core' ) )->first();
|
||||
|
||||
/* We're matching against the human version since the long version can change with patches */
|
||||
if( $version == \IPS\Application::load( 'core')->version )
|
||||
try
|
||||
{
|
||||
static::$versionMatch = TRUE;
|
||||
$version = $this->db->select( 'app_version', 'core_applications', array( 'app_directory=?', 'core' ) )->first();
|
||||
|
||||
/* We're matching against the human version since the long version can change with patches */
|
||||
if ( $version == \IPS\Application::load( 'core' )->version )
|
||||
{
|
||||
static::$versionMatch = TRUE;
|
||||
}
|
||||
}
|
||||
catch( \IPS\Db\Exception $e ) {}
|
||||
}
|
||||
|
||||
return $return;
|
||||
@@ -365,6 +369,7 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
|
||||
/* Attachments */
|
||||
\IPS\Task::queue( 'core', 'RebuildAttachmentThumbnails', array( 'app' => $this->app->app_id ), 4, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildProfilePhotos', array( 'app' => $this->app->app_id ), 5, array( 'app' ) );
|
||||
|
||||
return array( "f_search_index_rebuild", "f_clear_caches" );
|
||||
}
|
||||
@@ -672,8 +677,8 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
$row['ips_members_bitoptions2'] = $row['members_bitoptions2'];
|
||||
unset( $row['members_bitoptions'], $row['members_bitoptions2'] );
|
||||
|
||||
$path = $this->app->_session['more_info']['convertMembers']['upload_path'] . '/profile';
|
||||
$libraryClass->convertMember( $row, $profileFields, $profilePhotoName, $path, NULL, $coverPhotoName, $path );
|
||||
$path = $this->app->_session['more_info']['convertMembers']['upload_path'] . '/';
|
||||
$libraryClass->convertMember( $row, $profileFields, $profilePhotoName, $path . ( isset( $bits ) ? $bits[0] : '' ), NULL, $coverPhotoName, $path . ( isset( $coverBits[0] ) ? $coverBits[0] : '' ) );
|
||||
|
||||
/* Any friends need converting to followers? */
|
||||
foreach( $this->db->select( '*', 'core_follow', array( 'follow_app=? AND follow_area=? AND follow_rel_id=?', 'core', 'member', $row['member_id'] ) ) as $follow )
|
||||
@@ -1130,6 +1135,7 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
|
||||
/* This applies to all options */
|
||||
$attachmentMap['id1_from_parent'] = FALSE;
|
||||
$attachmentMap['id3_skip_link'] = TRUE;
|
||||
|
||||
/* Remap rows */
|
||||
$name = explode( '/', $row['attach_location'] );
|
||||
|
||||
@@ -273,6 +273,7 @@ class _Mybb extends \IPS\convert\Software
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* 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' ) );
|
||||
|
||||
@@ -167,6 +167,7 @@ class _Photopost extends \IPS\convert\Software
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* 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_members', 'extension' => 'core_Signatures' ), 2, array( 'app', 'link', 'extension' ) );
|
||||
|
||||
/* Content Counts */
|
||||
|
||||
@@ -331,7 +331,8 @@ class _Phpbb extends \IPS\convert\Software
|
||||
/* Clear Cache and Store */
|
||||
\IPS\Data\Store::i()->clearAll();
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
|
||||
\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_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' ) );
|
||||
|
||||
|
||||
@@ -294,6 +294,7 @@ class _Smf extends \IPS\convert\Software
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* 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_members', 'extension' => 'core_Signatures' ), 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' ) );
|
||||
|
||||
|
||||
@@ -337,6 +337,7 @@ class _UBBthreads extends \IPS\convert\Software
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* 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_members', 'extension' => 'core_Signatures' ), 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' ) );
|
||||
|
||||
|
||||
@@ -322,6 +322,7 @@ class _Vanilla 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_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' ) );
|
||||
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -508,6 +508,7 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* 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_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' ) );
|
||||
|
||||
@@ -609,7 +610,7 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
$post = preg_replace( "#\[quote=([^\];]+?);n\d+\]#i", "[quote name='$1']", $post );
|
||||
|
||||
/* Remove video tags and allow our parser to handle the embeds it supports */
|
||||
$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 );
|
||||
|
||||
return $post;
|
||||
}
|
||||
@@ -2044,6 +2045,17 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
$member->conv_password_extra = $token[1];
|
||||
return \IPS\convert\Software\Core\Vbulletin::login( $member, $password );
|
||||
break;
|
||||
/** vBulletin 5.6.2 was able to also use the Argon2id password hashing scheme. */
|
||||
case 'argon2id':
|
||||
if( defined('PASSWORD_ARGON2ID') ) {
|
||||
return password_verify( md5( $password ), $member->conv_password );
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -321,6 +321,7 @@ class _Woltlab extends \IPS\convert\Software
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* 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' ) );
|
||||
|
||||
@@ -591,6 +591,7 @@ class _Wpforo extends \IPS\convert\Software
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
/* Non-Content Rebuilds */
|
||||
\IPS\Task::queue( 'convert', 'RebuildProfilePhotos', array( 'app' => $this->app->app_id ), 5, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildNonContent', [ 'app' => $this->app->app_id, 'link' => 'core_message_posts', 'extension' => 'core_Messaging' ], 2, [ 'app', 'link', 'extension' ] );
|
||||
\IPS\Task::queue( 'convert', 'RebuildNonContent', [ 'app' => $this->app->app_id, 'link' => 'core_members', 'extension' => 'core_Signatures' ], 2, [ 'app', 'link', 'extension' ] );
|
||||
\IPS\Task::queue( 'convert', 'RebuildNonContent', [ 'app' => $this->app->app_id, 'link' => 'core_members', 'extension' => 'core_Signatures' ], 2, [ 'app', 'link', 'extension' ] );
|
||||
@@ -617,7 +618,7 @@ class _Wpforo extends \IPS\convert\Software
|
||||
*/
|
||||
public static function login( $member, $password )
|
||||
{
|
||||
return \IPS\convert\Software\Core\WordPress::login( $member, $password );
|
||||
return \IPS\convert\Software\Core\Wordpress::login( $member, $password );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,7 +72,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
{
|
||||
static::$isLegacy = FALSE;
|
||||
|
||||
/* Is this XF 2.1 */
|
||||
/* Is this XF 2.1/2.2 */
|
||||
if ( $version > 2010010 )
|
||||
{
|
||||
static::$useJson = TRUE;
|
||||
@@ -93,7 +93,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
*/
|
||||
public static function softwareName()
|
||||
{
|
||||
return "XenForo (1.5.x/2.0.x/2.1.x)";
|
||||
return "XenForo (1.5.x/2.0.x/2.1.x/2.2.x)";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -515,7 +515,8 @@ class _Xenforo extends \IPS\convert\Software
|
||||
/* Clear Cache and Store */
|
||||
\IPS\Data\Store::i()->clearAll();
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
|
||||
\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_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' ) );
|
||||
|
||||
@@ -546,16 +547,31 @@ class _Xenforo extends \IPS\convert\Software
|
||||
{
|
||||
// run everything through htmlspecialchars to prevent XSS
|
||||
$post = htmlspecialchars( $post, ENT_DISALLOWED | ENT_QUOTES, 'UTF-8', FALSE );
|
||||
|
||||
|
||||
// find YouTube ID's and replace.
|
||||
if( \preg_match( "#\[media=#i", $post ) )
|
||||
if ( \preg_match( "#\[media=#i", $post ) )
|
||||
{
|
||||
$post = preg_replace( '#\[media=youtube\](.+?)\[/media\]#i', 'https://www.youtube.com/watch?v=$1', $post );
|
||||
$post = preg_replace( '#\[media=facebook\](.+?)\[/media\]#i', 'https://www.facebook.com/video.php?v=$1', $post );
|
||||
$post = preg_replace( '#\[media=twitter\](.+?)\[/media\]#i', 'https://twitter.com/username/status/$1', $post );
|
||||
$post = preg_replace( '#\[media=reddit\](.+?)\[/media\]#i', 'https://reddit.com/r/$1', $post );
|
||||
$post = preg_replace( '#\[media=imgur\](.+?)\[/media\]#i', '[img]https://imgur.com/$1[/img]', $post );
|
||||
$post = preg_replace( '#\[media=instagram\](.+?)\[/media\]#i', 'https://instagram.com/p/$1', $post );
|
||||
$post = preg_replace( '#\[media=vimeo\](.+?)\[/media\]#i', 'https://vimeo.com/$1', $post );
|
||||
}
|
||||
|
||||
// Remove extra attributes
|
||||
if ( \preg_match( "#\[img #i", $post ) )
|
||||
{
|
||||
$post = preg_replace( '/\[img .*\](.*?)\[\/img\]/i', '[img]$1[/img]', $post );
|
||||
}
|
||||
if ( \preg_match( "#\[url unfurl#i", $post ) )
|
||||
{
|
||||
$post = preg_replace( '/\[url unfurl=.*\](.*?)\[\/url\]/i', '[url]$1[/url]', $post );
|
||||
}
|
||||
|
||||
/* Quick check for the presence of user tags */
|
||||
if( \preg_match( "#\[user=#i", $post ) )
|
||||
if ( \preg_match( "#\[user=#i", $post ) )
|
||||
{
|
||||
/* Mentions */
|
||||
preg_match_all( '#\[user=(\d+)\](.+?)\[\/user\]#i', $post, $matches );
|
||||
@@ -563,10 +579,10 @@ class _Xenforo extends \IPS\convert\Software
|
||||
if ( \count( $matches ) )
|
||||
{
|
||||
/* Make sure we actually have mention data */
|
||||
if ( isset( $matches[1] ) AND \count( $matches[1] ) )
|
||||
if ( isset( $matches[1] ) and \count( $matches[1] ) )
|
||||
{
|
||||
$mentions = array();
|
||||
foreach ( $matches[1] AS $k => $v )
|
||||
foreach ( $matches[1] as $k => $v )
|
||||
{
|
||||
if ( isset( $matches[2][ $k ] ) )
|
||||
{
|
||||
@@ -576,7 +592,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
$maps = iterator_to_array( \IPS\Db::i()->select( 'name, member_id', 'core_members', array( \IPS\Db::i()->in( 'name', array_keys( $mentions ) ) ) )->setKeyField( 'name' )->setValueField( 'member_id' ) );
|
||||
|
||||
foreach ( $mentions AS $memberName => $memberId )
|
||||
foreach ( $mentions as $memberName => $memberId )
|
||||
{
|
||||
if ( !isset( $maps[ $memberName ] ) )
|
||||
{
|
||||
@@ -591,9 +607,9 @@ class _Xenforo extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
/* Quotes */
|
||||
if( \preg_match( "#\[quote=#i", $post ) )
|
||||
if ( \preg_match( "#\[quote=#i", $post ) )
|
||||
{
|
||||
$post = preg_replace( '#\[quote="([a-zA-Z0-9-_ ]+)(,(.?)+)?"]#i', "[quote name='$1']", $post );
|
||||
$post = preg_replace( '#\[quote="([a-zA-Z0-9-_ ]+)(,([a-z0-9\s:])+)?(,([a-z0-9\s:])+)?"]#i', "[quote name='$1']", $post );
|
||||
}
|
||||
|
||||
// finally, give us the post back.
|
||||
@@ -655,9 +671,9 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
$post = \IPS\Db::i()->select( 'msg_post', 'core_message_posts', array( "msg_id=?", $messagePostId ) )->first();
|
||||
|
||||
if ( preg_match( "/\[ATTACH([^\]]+?)?\]" . $row['attachment_id'] . "\[\/ATTACH\]/i", $post ) )
|
||||
if ( preg_match( "/\[ATTACH([^\]]+?)?\]" . $row['attachment_id'] . "(\._xfImport)?\[\/ATTACH\]/i", $post ) )
|
||||
{
|
||||
$post = preg_replace( "/\[ATTACH([^\]]+?)?\]" . $row['attachment_id'] . "\[\/ATTACH\]/i", '[attachment=' . $attachId . ':name]', $post );
|
||||
$post = preg_replace( "/\[ATTACH([^\]]+?)?\]" . $row['attachment_id'] . "(\._xfImport)?\[\/ATTACH\]/i", '[attachment=' . $attachId . ':name]', $post );
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'core_message_posts', array( 'msg_post' => $post ), array( "msg_id=?", $messagePostId ) );
|
||||
@@ -868,12 +884,18 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$info = array(
|
||||
'g_id' => $row['user_group_id'],
|
||||
'g_name' => $row['title'],
|
||||
'prefix' => NULL,
|
||||
'suffix' => NULL
|
||||
);
|
||||
|
||||
/* XenForo stores raw CSS to style usernames - we can convert this into a <span> tag with an inline style attribute */
|
||||
$style = str_replace( array( '<br>', '<br />' ), '', nl2br( $row['username_css'] ) );
|
||||
$info['prefix'] = "<span style='{$style}'>";
|
||||
$info['suffix'] = "</span>";
|
||||
|
||||
if( mb_strlen( $style ) < 220 )
|
||||
{
|
||||
$info['prefix'] = "<span style='{$style}'>";
|
||||
$info['suffix'] = "</span>";
|
||||
}
|
||||
|
||||
/* General Permissions */
|
||||
foreach( $this->db->select( '*', 'xf_permission_entry', array( "user_group_id=?", $row['user_group_id'] ) ) AS $perm )
|
||||
@@ -1040,17 +1062,32 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
$libraryClass::setKey( 'xf_user.user_id' );
|
||||
|
||||
$it = $this->fetch( 'xf_user', 'xf_user.user_id' )
|
||||
$it = iterator_to_array( $this->fetch( 'xf_user', 'xf_user.user_id' )
|
||||
->join( 'xf_user_profile', 'xf_user.user_id = xf_user_profile.user_id' )
|
||||
->join( 'xf_user_option', 'xf_user.user_id = xf_user_option.user_id' );
|
||||
|
||||
->join( 'xf_user_option', 'xf_user.user_id = xf_user_option.user_id' )
|
||||
);
|
||||
|
||||
$userIds = array_column( $it, 'user_id' );
|
||||
$passwords = iterator_to_array(
|
||||
$this->db->select( 'user_id, data', 'xf_user_authenticate', array( $this->db->in( 'user_id', $userIds ) ) )
|
||||
->setKeyField('user_id')
|
||||
->setValueField('data')
|
||||
);
|
||||
$bans = iterator_to_array(
|
||||
$this->db->select( 'user_id, max(end_date) as end_date', 'xf_user_ban', array( $this->db->in( 'user_id', $userIds ) ), NULL, NULL, 'user_id' )
|
||||
->setKeyField('user_id')
|
||||
->setValueField('end_date')
|
||||
);
|
||||
foreach( $it AS $row )
|
||||
{
|
||||
/* Fetch our password. XenForo supports multiple authentication types (XF, vB, SMF, etc.) so let's try and retain these as much as possible. */
|
||||
try
|
||||
{
|
||||
$auth = $this->db->select( 'data', 'xf_user_authenticate', array( "user_id=?", $row['user_id'] ) )->first();
|
||||
$data = \unserialize( $auth );
|
||||
if( !isset( $passwords[ $row['user_id'] ] ) )
|
||||
{
|
||||
throw new \UnderflowException;
|
||||
}
|
||||
$data = \unserialize( $passwords[ $row['user_id'] ] );
|
||||
|
||||
if( !isset( $data['hash'] ) )
|
||||
{
|
||||
@@ -1130,7 +1167,12 @@ class _Xenforo extends \IPS\convert\Software
|
||||
/* Ban */
|
||||
try
|
||||
{
|
||||
$ban = $this->db->select( 'end_date', 'xf_user_ban', array( "user_id=?", $row['user_id'] ) )->first();
|
||||
if( !isset( $bans[ $row['user_id'] ] ) )
|
||||
{
|
||||
throw new \UnderflowException;
|
||||
}
|
||||
|
||||
$ban = $bans[ $row['user_id'] ];
|
||||
|
||||
if ( $ban == 0 )
|
||||
{
|
||||
@@ -1608,7 +1650,6 @@ class _Xenforo extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
$libraryClass->convertPrivateMessage( $topic, $maps );
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['conversation_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user