Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

@@ -56,7 +56,7 @@ class _Vanilla extends \IPS\convert\Software
public static function softwareName()
{
/* Child classes must override this method */
return "Vanilla 2 (2.2.x/2.3.x)";
return "Vanilla (3.x)";
}
/**
@@ -104,10 +104,10 @@ class _Vanilla extends \IPS\convert\Software
),
'convertForumsTopics' => array(
'table' => 'Discussion',
'where' => NULL
'where' => NULL
),
'convertForumsPosts' => array(
'table' => 'Comment',
'table' => 'Discussion',
'where' => NULL,
'extra_steps' => array( 'convertForumsPosts2' )
),
@@ -305,22 +305,7 @@ class _Vanilla extends \IPS\convert\Software
*/
public static function fixPostData( $post )
{
/**
* Vanilla has a quotes plugin that seems to have changed formats quite often. - We'll try to match as many formats as we can
*/
$post = preg_replace( '/(?:<blockquote\s+(?:class=\"(?:User)?Quote\")?(?:\s+rel=\"(?:[^\"]+)\")?>)(?:\s+)?<div class=\"QuoteAuthor\">([^\"]+)<\/div>(?:\s+)?<div class=\"QuoteText\">(?:<p>)?(.*?)(?:<\/p>)?<\/div>(?:\s+)?<\/blockquote>/i',
'[quote name="$1"]$2[/quote]' ,
$post );
$post = preg_replace( '/(?:<blockquote\s+(?:class=\"Quote (?:User)?Quote\")?(?:\s+rel=\"(?:[^\"]+)\")?>)(?:\s+)?<div class=\"QuoteText\">(?:<p>)?(.*?)(?:<\/p>)?<\/div>(?:\s+)?<\/blockquote>/i',
'[quote]$1[/quote]' ,
$post );
$post = preg_replace( '/<blockquote\s+rel=\"([^\"]+)\"?>(.*?)<\/blockquote>/i',
'[quote name="$1"]$2[/quote]' ,
$post );
return $post;
return \IPS\convert\Software\Core\Vanilla::fixPostData( $post );
}
/**
@@ -352,6 +337,7 @@ class _Vanilla extends \IPS\convert\Software
catch( \UnderflowException $ex )
{
$libraryClass->setLastKeyValue( $row['MediaID'] );
continue;
}
$map = array(
@@ -374,7 +360,9 @@ class _Vanilla extends \IPS\convert\Software
'attach_filesize' => $row['Size'],
);
$libraryClass->convertAttachment( $info, $map, rtrim( $this->app->_session['more_info']['convertAttachments']['attach_location'], '/' ) . '/' . trim( $row['Path'], '/' ) );
$uploadPath = \IPS\convert\Software\Core\Vanilla::parseMediaLocation( $row['Path'], $this->app->_session['more_info']['convertAttachments']['attach_location'] );
$libraryClass->convertAttachment( $info, $map, $uploadPath );
$libraryClass->setLastKeyValue( $row['MediaID'] );
}
}
@@ -431,14 +419,37 @@ class _Vanilla extends \IPS\convert\Software
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'd.DiscussionID' );
$discussions = $this->fetch( array( 'Discussion', 'd' ), 'DiscussionID', NULL,
$discussions = $this->fetch( array( 'Discussion', 'd' ), 'DiscussionID', NULL,
'd.*, u.Name as UserName, lcu.UserID as LastCommentUserID, lcu.Name as LastCommentUserName'
);
$discussions->join( array( 'User', 'u' ), 'd.InsertUserID=u.UserID' );
$discussions->join( array( 'User', 'lcu' ), 'd.LastCommentUserID=lcu.UserID' );
foreach( $discussions AS $row )
$data = iterator_to_array( $discussions );
$this->app->preCacheLinks( $data, [ 'core_members' => 'InsertUserID', 'forums_forums' => 'CategoryID' ] );
foreach( $data AS $row )
{
/* Skip reports */
$attributes = [];
if( !empty( $row['attributes'] ) )
{
if( substr( $row['Attributes'], 0, 2 ) == 'a:' ) // Probably serialize
{
$attributes = \unserialize( $row['Attributes'] );
}
else
{
$attributes = json_decode( $row['Attributes'], TRUE );
}
}
if( isset( $attributes['Report'] ) OR $row['Type'] == 'Report' )
{
$libraryClass->setLastKeyValue( $row['DiscussionID'] );
continue;
}
$row['DateLastComment'] = 0;
$row['LastCommentUserID'] = 0;
$row['LastCommentUserName'] = '';
@@ -516,8 +527,31 @@ class _Vanilla extends \IPS\convert\Software
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'DiscussionID' );
foreach( $this->fetch( 'Discussion', 'DiscussionID' ) AS $row )
$data = iterator_to_array( $this->fetch( 'Discussion', 'DiscussionID' ) );
$this->app->preCacheLinks( $data, [ 'core_members' => 'InsertUserID', 'forums_topics' => 'DiscussionID' ] );
foreach( $data AS $row )
{
/* Skip reports */
$attributes = [];
if( !empty( $row['attributes'] ) )
{
if( substr( $row['Attributes'], 0, 2 ) == 'a:' ) // Probably serialize
{
$attributes = \unserialize( $row['Attributes'] );
}
else
{
$attributes = json_decode( $row['Attributes'], TRUE );
}
}
if( isset( $attributes['Report'] ) OR $row['Type'] == 'Report' )
{
$libraryClass->setLastKeyValue( $row['DiscussionID'] );
continue;
}
$editName = NULL;
if( $row['UpdateUserID'] )
@@ -529,6 +563,12 @@ class _Vanilla extends \IPS\convert\Software
catch( \UnderflowException $e ) {}
}
// Add Format Type (for later processing) if Markdown
if( $row['Format'] == 'Markdown' )
{
$row['Body'] = '<!--Markdown-->' . $row['Body'];
}
// First post
$info = array(
'pid' => 'fp-' . $row['DiscussionID'],
@@ -548,7 +588,9 @@ class _Vanilla extends \IPS\convert\Software
/* Reputation - Reactions are only supported if the YAGA addon was used. */
if( static::$_supportsReactions )
{
foreach( $this->db->select( '*', 'Reaction', array( "ParentType=? AND ParentID=?", 'comment', $row['DiscussionID'] ) ) AS $rep )
$reputation = iterator_to_array( $this->db->select( '*', 'Reaction', array( "ParentType=? AND ParentID=?", 'comment', $row['DiscussionID'] ) ) );
$this->app->preCacheLinks( $reputation, [ 'core_members' => [ 'InsertUserID', 'ParentAuthorID' ] ] );
foreach( $reputation AS $rep )
{
$reaction = $this->app->_session['more_info']['convertForumsPosts']['reaction_' . $rep['ActionID'] ];
@@ -577,8 +619,30 @@ class _Vanilla extends \IPS\convert\Software
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'CommentID' );
foreach( $this->fetch( 'Comment', 'CommentID' ) AS $row )
$data = iterator_to_array( $this->fetch( 'Comment', 'CommentID' ) );
$this->app->preCacheLinks( $data, [ 'core_members' => 'InsertUserID', 'forums_topics' => 'DiscussionID' ] );
foreach( $data AS $row )
{
/* Check whether this is a report */
if( !empty( $row['Attributes'] ) )
{
if( substr( $row['Attributes'], 0, 2 ) == 'a:' ) // Probably serialize
{
$attributes = \unserialize( $row['Attributes'] );
}
else
{
$attributes = json_decode( $row['Attributes'], TRUE );
}
if( !empty( $attributes['Type'] ) AND $attributes['Type'] == 'Report' )
{
$libraryClass->setLastKeyValue( $row['CommentID'] );
continue;
}
}
$editName = NULL;
if( $row['UpdateUserID'] )
@@ -590,6 +654,12 @@ class _Vanilla extends \IPS\convert\Software
catch( \UnderflowException $e ) {}
}
// Add Format Type (for later processing) if Markdown
if( $row['Format'] == 'Markdown' )
{
$row['Body'] = '<!--Markdown-->' . $row['Body'];
}
$info = [
'pid' => $row['CommentID'],
'topic_id' => $row['DiscussionID'],