Version 5.0.6
This commit is contained in:
1 parent
a3a4a9ccbd
commit
b89858b2ff
1214 files changed
+92828
-14859
No files matched your search
@@ -16,6 +16,7 @@ namespace IPS\convert\Software\Forums;
|
||||
use DomainException;
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Expressionengine as ExpressionEngineCore;
|
||||
use IPS\Db;
|
||||
@@ -197,14 +198,15 @@ class Expressionengine extends Software
|
||||
/**
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string $post The post
|
||||
* @param string|null $className Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content ID passed by post-conversion rebuild
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @param App|null App object if available
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null, ?App $app=null ): string
|
||||
{
|
||||
return ExpressionEngineCore::fixPostData( $post, $className, $contentId );
|
||||
return ExpressionEngineCore::fixPostData( $post, $className, $contentId, $app );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,7 +217,6 @@ class Expressionengine extends Software
|
||||
public function convertForumsForums() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'forum_id' );
|
||||
|
||||
foreach( $this->fetch( 'exp_forums', 'forum_id' ) AS $row )
|
||||
@@ -226,12 +227,8 @@ class Expressionengine extends Software
|
||||
'description' => $row['forum_description'],
|
||||
'topics' => $row['forum_total_topics'],
|
||||
'posts' => $row['forum_total_posts'],
|
||||
'last_post' => $row['forum_last_post_date'],
|
||||
'last_poster_id' => $row['forum_last_post_author_id'],
|
||||
'last_poster_name' => $row['forum_last_post_author'],
|
||||
'parent_id' => ( $row['forum_parent'] == 0 ) ? -1 : $row['forum_parent'],
|
||||
'position' => $row['forum_order'],
|
||||
'last_title' => $row['forum_last_post_title'],
|
||||
'allow_poll' => 1,
|
||||
'inc_postcount' => 1,
|
||||
'sub_can_post' => 1,
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace IPS\convert\Software\Forums;
|
||||
use DomainException;
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Mybb as MybbCore;
|
||||
use IPS\Db;
|
||||
@@ -209,14 +210,15 @@ class Mybb extends Software
|
||||
/**
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string $post The post
|
||||
* @param string|null $className Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content ID passed by post-conversion rebuild
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @param App|null App object if available
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null, ?App $app=null ): string
|
||||
{
|
||||
return MybbCore::fixPostData( $post, $className, $contentId );
|
||||
return MybbCore::fixPostData( $post, $className, $contentId, $app );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,7 +229,6 @@ class Mybb extends Software
|
||||
public function convertForumsForums(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'fid' );
|
||||
|
||||
foreach( $this->fetch( 'forums', 'fid' ) AS $row )
|
||||
@@ -238,13 +239,9 @@ class Mybb extends Software
|
||||
'description' => $row['description'],
|
||||
'topics' => $row['threads'],
|
||||
'posts' => $row['posts'],
|
||||
'last_post' => $row['lastpost'],
|
||||
'last_poster_id' => $row['lastposteruid'],
|
||||
'last_poster_name' => $row['lastposter'],
|
||||
'parent_id' => $row['pid'] ?: -1,
|
||||
'position' => $row['disporder'],
|
||||
'password' => $row['password'] ?: NULL,
|
||||
'last_title' => $row['lastpostsubject'],
|
||||
'inc_postcount' => $row['usepostcounts'],
|
||||
'redirect_url' => $row['linkto'],
|
||||
'sub_can_post' => ( $row['type'] == 'c' ) ? 0 : 1,
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace IPS\convert\Software\Forums;
|
||||
use DomainException;
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Phpbb as PhpbbCore;
|
||||
use IPS\Db;
|
||||
@@ -192,14 +193,15 @@ class Phpbb extends Software
|
||||
/**
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string $post The post
|
||||
* @param string|null $className Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content ID passed by post-conversion rebuild
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @param App|null App object if available
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null, ?App $app=null ): string
|
||||
{
|
||||
return PhpbbCore::fixPostData( $post, $className, $contentId );
|
||||
return PhpbbCore::fixPostData( $post, $className, $contentId, $app );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,7 +212,6 @@ class Phpbb extends Software
|
||||
public function convertForumsForums(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'forum_id' );
|
||||
|
||||
foreach( $this->fetch( 'forums', 'forum_id' ) AS $row )
|
||||
@@ -221,14 +222,10 @@ class Phpbb extends Software
|
||||
'description' => $row['forum_desc'],
|
||||
'topics' => $row['forum_topics_approved'] ?? $row['forum_topics'],
|
||||
'posts' => $row['forum_posts_approved'] ?? $row['forum_posts'],
|
||||
'last_post' => $row['forum_last_post_time'],
|
||||
'last_poster_id' => $row['forum_last_poster_id'],
|
||||
'last_poster_name' => $row['forum_last_poster_name'],
|
||||
'parent_id' => ( $row['parent_id'] != 0 ) ? $row['parent_id'] : -1,
|
||||
'conv_parent' => ( $row['parent_id'] != 0 ) ? $row['parent_id'] : -1,
|
||||
'position' => $row['left_id'],
|
||||
'password' => ( isset( $this->app->_session['more_info']['convertForumsForums']["forum_password_{$row['forum_id']}"] ) ) ? $this->app->_session['more_info']['convertForumsForums']["forum_password_{$row['forum_id']}"] : NULL,
|
||||
'last_title' => $row['forum_last_post_subject'],
|
||||
'queued_topics' => $row['forum_topics_unapproved'] ?? 0,
|
||||
'queued_posts' => isset( $row['forum_posts_unapproved'] ) ? $row['forum_topics_unapproved'] : 0,
|
||||
'sub_can_post' => $row['forum_type'] == 1
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace IPS\convert\Software\Forums;
|
||||
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Punbb as PunbbCore;
|
||||
use IPS\Http\Url;
|
||||
@@ -122,14 +123,15 @@ class Punbb extends Software
|
||||
/**
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string $post The post
|
||||
* @param string|null $className Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content ID passed by post-conversion rebuild
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @param App|null App object if available
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null, ?App $app=null ): string
|
||||
{
|
||||
return PunbbCore::fixPostData( $post, $className, $contentId );
|
||||
return PunbbCore::fixPostData( $post, $className, $contentId, $app );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,7 +142,6 @@ class Punbb extends Software
|
||||
public function convertForumsForums(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'id' );
|
||||
|
||||
foreach( $this->fetch( 'forums', 'id' ) AS $row )
|
||||
@@ -166,24 +167,12 @@ class Punbb extends Software
|
||||
catch( UnderflowException $e ) {}
|
||||
}
|
||||
|
||||
/* They don't store the last poster ID. Makes me sad. */
|
||||
$last_poster_id = 0;
|
||||
try
|
||||
{
|
||||
/* Better hope they haven't changed their name */
|
||||
$last_poster_id = $this->db->select( 'id', 'users', array( "username=?", $row['last_poster'] ) )->first();
|
||||
}
|
||||
catch( UnderflowException $e ) {}
|
||||
|
||||
$info = array(
|
||||
'id' => $row['id'],
|
||||
'name' => $row['forum_name'],
|
||||
'description' => $row['forum_desc'],
|
||||
'topics' => $row['num_topics'],
|
||||
'posts' => $row['num_posts'],
|
||||
'last_post' => $row['last_post'],
|
||||
'last_poster_id' => $last_poster_id,
|
||||
'last_poster_name' => $row['last_poster'],
|
||||
'parent_id' => ( $row['parent_forum_id'] == 0 ) ? '1000' . $row['cat_id'] : $row['parent_forum_id'],
|
||||
'position' => $row['disp_position'],
|
||||
'redirect_url' => $row['redirect_url'],
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace IPS\convert\Software\Forums;
|
||||
use DomainException;
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Smf as SmfCore;
|
||||
use IPS\Db;
|
||||
@@ -228,14 +229,15 @@ class Smf extends Software
|
||||
/**
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string $post The post
|
||||
* @param string|null $className Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content ID passed by post-conversion rebuild
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @param App|null App object if available
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null, ?App $app=null ): string
|
||||
{
|
||||
return SmfCore::fixPostData( $post, $className, $contentId );
|
||||
return SmfCore::fixPostData( $post, $className, $contentId, $app );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -267,39 +269,18 @@ class Smf extends Software
|
||||
public function convertForumsBoards(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'id_board' );
|
||||
|
||||
foreach( $this->fetch( 'boards', 'id_board' ) AS $row )
|
||||
{
|
||||
$last_post_time = 0;
|
||||
$last_poster = 0;
|
||||
$last_title = NULL;
|
||||
$last_poster_name = NULL;
|
||||
|
||||
try
|
||||
{
|
||||
$last_post = $this->db->select( '*', 'messages', array( "id_msg=?", $row['id_last_msg'] ) )->first();
|
||||
|
||||
$last_post_time = $last_post['poster_time'];
|
||||
$last_poster = $last_post['id_member'];
|
||||
$last_poster_name = $last_post['poster_name'];
|
||||
$last_title = $last_post['subject']; # Yes, I know this is technically wrong, but it's better than just not showing anything
|
||||
}
|
||||
catch( UnderflowException $e ) {}
|
||||
|
||||
$info = array(
|
||||
'id' => $row['id_board'],
|
||||
'name' => $row['name'],
|
||||
'description' => $row['description'],
|
||||
'topics' => $row['num_topics'],
|
||||
'posts' => $row['num_posts'],
|
||||
'last_post' => $last_post_time,
|
||||
'last_poster_id' => $last_poster,
|
||||
'last_poster_name' => $last_poster_name,
|
||||
'parent_id' => ( $row['id_parent'] <> 0 ) ? $row['id_parent'] : 'c' . $row['id_cat'],
|
||||
'position' => $row['board_order'],
|
||||
'last_title' => $last_title,
|
||||
'redirect_url' => $row['redirect'],
|
||||
'queued_topics' => $row['unapproved_topics'],
|
||||
'queued_posts' => $row['unapproved_posts'],
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace IPS\convert\Software\Forums;
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use Exception;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\UBBthreads as UBBthreadsCore;
|
||||
use IPS\convert\Software\Exception as SoftwareException;
|
||||
@@ -246,14 +247,15 @@ class UBBthreads extends Software
|
||||
/**
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string $post The post
|
||||
* @param string|null $className Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content ID passed by post-conversion rebuild
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @param App|null App object if available
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null, ?App $app=null ): string
|
||||
{
|
||||
return UBBthreadsCore::fixPostData( $post, $className, $contentId );
|
||||
return UBBthreadsCore::fixPostData( $post, $className, $contentId, $app );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -290,12 +292,8 @@ class UBBthreads extends Software
|
||||
'description' => $row['FORUM_DESCRIPTION'],
|
||||
'topics' => $row['FORUM_TOPICS'],
|
||||
'posts' => $row['FORUM_POSTS'],
|
||||
'last_post' => DateTime::create()->setTimestamp( $row['FORUM_LAST_POST_TIME'] ),
|
||||
'last_poster_id' => $row['FORUM_LAST_POSTER_ID'],
|
||||
'last_poster_name' => $row['FORUM_LAST_POSTER_NAME'],
|
||||
'parent_id' => $row['FORUM_PARENT_ID'] ?: ( 10000 + $row['CATEGORY_ID'] ),
|
||||
'position' => $row['FORUM_SORT_ORDER'],
|
||||
'last_title' => $row['FORUM_LAST_POST_SUBJECT'],
|
||||
'allow_poll' => $row['FORUM_ALLOW_POLLS']
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class Vanilla extends Software
|
||||
),
|
||||
'convertAttachments' => array(
|
||||
'table' => 'Media',
|
||||
'where' => array( 'ForeignTable=? OR ForeignTable=?', 'discussion', 'comment' )
|
||||
'where' => [ "ForeignTable IN ('discussion', 'comment', 'embed')" ]
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -295,6 +295,7 @@ class Vanilla extends Software
|
||||
{
|
||||
/* Content Rebuilds */
|
||||
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
|
||||
Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'forums_posts_first', 'class' => 'IPS\forums\Topic\Post' ), 2, array( 'app', 'link', 'class' ) );
|
||||
Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'forums_posts', 'class' => 'IPS\forums\Topic\Post' ), 2, array( 'app', 'link', 'class' ) );
|
||||
Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\forums\Topic' ), 3, array( 'class' ) );
|
||||
Task::queue( 'convert', 'RebuildFirstPostIds', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
@@ -313,16 +314,22 @@ class Vanilla extends Software
|
||||
/**
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string $post The post
|
||||
* @param string|null $className Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content ID passed by post-conversion rebuild
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @param App|null App object if available
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null, ?App $app=null ): string
|
||||
{
|
||||
return VanillaCore::fixPostData( $post, $className, $contentId );
|
||||
return VanillaCore::fixPostData( $post, $className, $contentId, $app );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief temporarily store post content
|
||||
*/
|
||||
protected array $_postContent = array();
|
||||
|
||||
/**
|
||||
* Convert attachments
|
||||
*
|
||||
@@ -331,18 +338,41 @@ class Vanilla extends Software
|
||||
public function convertAttachments(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'MediaID' );
|
||||
$this->_postContent = [];
|
||||
|
||||
foreach( $this->fetch( 'Media', 'MediaID', array( 'ForeignTable=? OR ForeignTable=?', 'discussion', 'comment' ) ) AS $row )
|
||||
foreach( $this->fetch( 'Media', 'MediaID', [ $this->db->in( 'ForeignTable', [ 'discussion', 'comment', 'embed' ] ) ] ) AS $row )
|
||||
{
|
||||
if( $row['ForeignTable'] == 'discussion' )
|
||||
{
|
||||
$map = array(
|
||||
'id1' => 'fp-' . $row['ForeignID'],
|
||||
'id1' => $row['ForeignID'],
|
||||
'id2' => $row['ForeignID'],
|
||||
'first_post' => true
|
||||
);
|
||||
}
|
||||
elseif( $row['ForeignTable'] == 'embed' )
|
||||
{
|
||||
$mediaRows = iterator_to_array(
|
||||
\IPS\Db::i()->select(
|
||||
'*',
|
||||
'convert_vanilla_temp',
|
||||
[ 'media_id=? AND ' . \IPS\Db::i()->in( 'link_type', [ 'forums_posts', 'forums_posts_first'] ), $row['MediaID'] ]
|
||||
) );
|
||||
|
||||
// Nothing to do, attachment must be in another content type
|
||||
if( !count( $mediaRows ) )
|
||||
{
|
||||
$libraryClass->setLastKeyValue( $row['MediaID'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
$map = [
|
||||
'id1' => $mediaRows[0]['content_id'],
|
||||
'id2' => $mediaRows[0]['post_id'],
|
||||
'first_post' => ( $mediaRows[0]['link_type'] == 'forums_posts_first' ) ? true : false
|
||||
];
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
@@ -377,9 +407,38 @@ class Vanilla extends Software
|
||||
|
||||
$uploadPath = VanillaCore::parseMediaLocation( $row['Path'], $this->app->_session['more_info']['convertAttachments']['attach_location'] );
|
||||
|
||||
$libraryClass->convertAttachment( $info, $map, $uploadPath );
|
||||
$attachId = $libraryClass->convertAttachment( $info, $map, $uploadPath );
|
||||
|
||||
/* Do some re-jiggery on the post itself to make sure attachment displays */
|
||||
if ( $attachId !== FALSE and isset( $mediaRows ) )
|
||||
{
|
||||
foreach( $mediaRows as $mediaRow )
|
||||
{
|
||||
try
|
||||
{
|
||||
$pid = $this->app->getLink( $map['id2'], ( isset( $map['first_post'] ) AND $map['first_post'] === TRUE ) ? 'forums_posts_first' : 'forums_posts' );
|
||||
|
||||
if( !isset( $this->_postContent[ $pid ] ) )
|
||||
{
|
||||
$this->_postContent[ $pid ] = Db::i()->select( 'post', 'forums_posts', array( "pid=?", $pid ) )->first();
|
||||
}
|
||||
|
||||
$this->_postContent[ $pid ] = str_replace( "[ATTACH={$row['MediaID']}]", '[attachment=' . $attachId . ':name]', $this->_postContent[ $pid ] );
|
||||
// dump($this->_postContent[ $pid ]);
|
||||
}
|
||||
catch( UnderflowException|OutOfRangeException $e ) {}
|
||||
}
|
||||
}
|
||||
|
||||
unset( $mediaRows );
|
||||
$libraryClass->setLastKeyValue( $row['MediaID'] );
|
||||
}
|
||||
|
||||
/* Do the updates */
|
||||
foreach( $this->_postContent as $pid => $content )
|
||||
{
|
||||
Db::i()->update( 'forums_posts', array( 'post' => $content ), array( 'pid=?', $pid ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -394,11 +453,7 @@ class Vanilla extends Software
|
||||
|
||||
$uploadsPath = $this->app->_session['more_info']['convertForumsForums']['attach_location'];
|
||||
|
||||
$forums = $this->fetch( array( 'Category', 'c' ), 'CategoryID', array( 'c.CategoryID<>?', -1 ),
|
||||
'c.*, lcu.UserID as LastCommentUserID, lcu.Name as LastCommentUserName, ld.Name as LastDiscussionName'
|
||||
);
|
||||
$forums->join( array( 'User', 'lcu' ), 'c.LastCommentID=lcu.UserID' );
|
||||
$forums->join( array( 'Discussion', 'ld' ), 'c.LastDiscussionID=ld.DiscussionID' );
|
||||
$forums = $this->fetch( array( 'Category', 'c' ), 'CategoryID', array( 'c.CategoryID<>?', -1 ) );
|
||||
|
||||
foreach( $forums AS $row )
|
||||
{
|
||||
@@ -409,12 +464,8 @@ class Vanilla extends Software
|
||||
'description' => $row['Description'],
|
||||
'topics' => $row['CountDiscussions'],
|
||||
'posts' => $row['CountComments'],
|
||||
'last_post' => VanillaCore::mysqlToDateTime( $row['LastDateInserted'] ),
|
||||
'last_poster_id' => $row['LastCommentID'],
|
||||
'last_poster_name' => $row['LastCommentUserName'],
|
||||
'parent_id' => ( (int) $row['ParentCategoryID'] > 0 ) ? $row['ParentCategoryID'] : NULL,
|
||||
'position' => $row['Sort'],
|
||||
'last_title' => $row['LastDiscussionName'],
|
||||
'icon' => $icon,
|
||||
'sub_can_post' => $row['AllowDiscussions'] ?: 0
|
||||
];
|
||||
@@ -584,17 +635,31 @@ class Vanilla extends Software
|
||||
{
|
||||
$row['Body'] = '<!--Markdown-->' . $row['Body'];
|
||||
}
|
||||
elseif( $row['Format'] == 'Rich' )
|
||||
{
|
||||
$row['Body'] = VanillaCore::processQuill( $row['Body'], $this->app, 'forums_posts_first', $row['DiscussionID'], $row['DiscussionID'] );
|
||||
}
|
||||
|
||||
/* Get IP */
|
||||
try
|
||||
{
|
||||
$ipAddress = ( $row['InsertIPAddress'] AND !str_contains( $row['InsertIPAddress'], '.' ) ) ? long2ip( hexdec( bin2hex( $row['InsertIPAddress'] ) ) ) : $row['InsertIPAddress'];
|
||||
}
|
||||
catch( \ErrorException $e )
|
||||
{
|
||||
$ipAddress = '';
|
||||
}
|
||||
|
||||
// First post
|
||||
$info = array(
|
||||
'pid' => 'fp-' . $row['DiscussionID'],
|
||||
'pid' => $row['DiscussionID'],
|
||||
'topic_id' => $row['DiscussionID'],
|
||||
'post' => $row['Body'],
|
||||
'new_topic' => 1,
|
||||
'edit_time' => ( $editName === NULL ) ? NULL : VanillaCore::mysqlToDateTime( $row['DateUpdated'] ),
|
||||
'edit_name' => $editName,
|
||||
'author_id' => $row['InsertUserID'],
|
||||
'ip_address' => $row['InsertIPAddress'],
|
||||
'ip_address' => $ipAddress,
|
||||
'post_date' => VanillaCore::mysqlToDateTime( $row['DateInserted'] ),
|
||||
);
|
||||
|
||||
@@ -675,6 +740,20 @@ class Vanilla extends Software
|
||||
{
|
||||
$row['Body'] = '<!--Markdown-->' . $row['Body'];
|
||||
}
|
||||
elseif( $row['Format'] == 'Rich' )
|
||||
{
|
||||
$row['Body'] = VanillaCore::processQuill( $row['Body'], $this->app, 'forums_posts', $row['DiscussionID'], $row['CommentID'] );
|
||||
}
|
||||
|
||||
/* Get IP */
|
||||
try
|
||||
{
|
||||
$ipAddress = ( $row['InsertIPAddress'] AND !str_contains( $row['InsertIPAddress'], '.' ) ) ? long2ip( hexdec( bin2hex( $row['InsertIPAddress'] ) ) ) : $row['InsertIPAddress'];
|
||||
}
|
||||
catch( \ErrorException $e )
|
||||
{
|
||||
$ipAddress = '';
|
||||
}
|
||||
|
||||
$info = [
|
||||
'pid' => $row['CommentID'],
|
||||
@@ -683,7 +762,7 @@ class Vanilla extends Software
|
||||
'edit_time' => ( $editName === NULL ) ? NULL : VanillaCore::mysqlToDateTime( $row['DateUpdated'] ),
|
||||
'edit_name' => $editName,
|
||||
'author_id' => $row['InsertUserID'],
|
||||
'ip_address' => $row['InsertIPAddress'],
|
||||
'ip_address' => $ipAddress,
|
||||
'post_date' => VanillaCore::mysqlToDateTime( $row['DateInserted'] ),
|
||||
];
|
||||
|
||||
|
||||
@@ -238,14 +238,15 @@ class Vbulletin extends Software
|
||||
/**
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string $post The post
|
||||
* @param string|null $className Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId ID passed by post-conversion rebuild
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @param App|null App object if available
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null, ?App $app=null ): string
|
||||
{
|
||||
return VbulletinCore::fixPostData( $post, $className, $contentId );
|
||||
return VbulletinCore::fixPostData( $post, $className, $contentId, $app );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -369,13 +370,9 @@ class Vbulletin extends Software
|
||||
'description' => $forum['description'],
|
||||
'topics' => $forum['threadcount'],
|
||||
'posts' => $forum['replycount'],
|
||||
'last_post' => $forum['lastpost'],
|
||||
'last_poster_id' => ( static::$isLegacy === FALSE or is_null( static::$isLegacy ) ) ? $forum['lastposterid'] : 0,
|
||||
'last_poster_name' => $forum['lastposter'],
|
||||
'parent_id' => $forum['parentid'],
|
||||
'position' => $forum['displayorder'],
|
||||
'password' => $forum['password'] ?: NULL,
|
||||
'last_title' => $forum['lastthread'],
|
||||
'preview_posts' => $checkpermission( 'forumoptions', 'moderatenewpost' ),
|
||||
'inc_postcount' => $checkpermission( 'forumoptions', 'countposts' ),
|
||||
'redirect_url' => $forum['link'],
|
||||
|
||||
@@ -208,14 +208,15 @@ class Vbulletin5 extends Software
|
||||
/**
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string $post The post
|
||||
* @param string|null $className Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content ID passed by post-conversion rebuild
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @param App|null App object if available
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null, ?App $app=null ): string
|
||||
{
|
||||
return Vbulletin5Core::fixPostData( $post, $className, $contentId );
|
||||
return Vbulletin5Core::fixPostData( $post, $className, $contentId, $app );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -295,7 +296,6 @@ class Vbulletin5 extends Software
|
||||
public function convertForumsForums() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'node.nodeid' );
|
||||
$clubs = $this->fetchClubs();
|
||||
|
||||
@@ -334,9 +334,6 @@ class Vbulletin5 extends Software
|
||||
'description' => $forum['description'],
|
||||
'topics' => $forum['textcount'],
|
||||
'posts' => $forum['totalcount'],
|
||||
'last_post' => $forum['lastcontent'],
|
||||
'last_poster_id' => $forum['lastauthorid'],
|
||||
'last_poster_name' => $forum['lastcontentauthor'],
|
||||
'parent_id' => ( !array_key_exists( $forum['nodeid'], $clubs ) ) ? $forum['parentid'] : -1,
|
||||
'club_id' => ( array_key_exists( $forum['nodeid'], $clubs ) ) ? $forum['nodeid'] : NULL,
|
||||
'position' => $forum['displayorder'],
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace IPS\convert\Software\Forums;
|
||||
use DomainException;
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Woltlab as WoltlabCore;
|
||||
use IPS\Db;
|
||||
@@ -175,14 +176,15 @@ class Woltlab extends Software
|
||||
/**
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string $post The post
|
||||
* @param string|null $className Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content ID passed by post-conversion rebuild
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @param App|null App object if available
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null, ?App $app=null ): string
|
||||
{
|
||||
return WoltlabCore::fixPostData( $post, $className, $contentId );
|
||||
return WoltlabCore::fixPostData( $post, $className, $contentId, $app );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace IPS\convert\Software\Forums;
|
||||
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Wpforo as WpforoCore;
|
||||
use IPS\Db;
|
||||
@@ -138,14 +139,15 @@ class Wpforo extends Software
|
||||
/**
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string $post The post
|
||||
* @param string|null $className Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content ID passed by post-conversion rebuild
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @param App|null App object if available
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null, ?App $app=null ): string
|
||||
{
|
||||
return WpforoCore::fixPostData( $post, $className, $contentId );
|
||||
return WpforoCore::fixPostData( $post, $className, $contentId, $app );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -273,14 +273,15 @@ class Xenforo extends Software
|
||||
/**
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string $post The post
|
||||
* @param string|null $className Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content ID passed by post-conversion rebuild
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @param App|null App object if available
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null, ?App $app=null ): string
|
||||
{
|
||||
return XenforoCore::fixPostData( $post, $className, $contentId );
|
||||
return XenforoCore::fixPostData( $post, $className, $contentId, $app );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -338,12 +339,8 @@ class Xenforo extends Software
|
||||
'description' => $row['description'],
|
||||
'topics' => ( isset( $data['discussion_count'] ) ) ? $data['discussion_count'] : 0,
|
||||
'posts' => ( isset( $data['message_count'] ) ) ? $data['message_count'] : 0,
|
||||
'last_post' => ( isset( $data['last_post_date'] ) ) ? $data['last_post_date'] : 0,
|
||||
'last_poster_id' => ( isset( $data['last_post_user_id'] ) ) ? $data['last_post_user_id'] : 0,
|
||||
'last_poster_name' => ( isset( $data['last_poster_name'] ) ) ? $data['last_post_username'] : '',
|
||||
'parent_id' => ( $row['parent_node_id'] == 0 ) ? -1 : $row['parent_node_id'],
|
||||
'position' => $row['display_order'],
|
||||
'last_title' => ( isset( $data['last_thread_title'] ) ) ? $data['last_thread_title'] : '',
|
||||
'allow_poll' => ( isset( $data['allow_poll'] ) ) ? $data['allow_poll'] : 0,
|
||||
'inc_postcount' => ( isset( $data['count_messages'] ) ) ? $data['count_messages'] : 0,
|
||||
'redirect_url' => ( isset( $data['link_url'] ) ) ? $data['link_url'] : NULL,
|
||||
|
||||
Reference in new issue
Block a user