Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -20,11 +20,53 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
class _Xenforo extends \IPS\convert\Software
|
||||
{
|
||||
/**
|
||||
* @brief The similarities between XF1 and XF2 are close enough that we can use the same converter
|
||||
*/
|
||||
public static $isLegacy = NULL;
|
||||
|
||||
/**
|
||||
* @brief Flag to indicate the post data has been fixed during conversion, and we only need to use Legacy Parser
|
||||
*/
|
||||
public static $contentFixed = TRUE;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\convert\App The application to reference for database and other information.
|
||||
* @param bool Establish a DB connection
|
||||
* @return void
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct( \IPS\convert\App $app, $needDB=TRUE )
|
||||
{
|
||||
$return = parent::__construct( $app, $needDB );
|
||||
|
||||
if ( $needDB )
|
||||
{
|
||||
try
|
||||
{
|
||||
/* Is this XF1 or XF2 */
|
||||
if ( static::$isLegacy === NULL )
|
||||
{
|
||||
$version = $this->db->select( 'MAX(version_id)', 'xf_template', array( "addon_id=?", 'XF' ) )->first();
|
||||
|
||||
if ( $version < 2000010 )
|
||||
{
|
||||
static::$isLegacy = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
static::$isLegacy = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( \Exception $e ) {} # If we can't query, we won't be able to do anything anyway
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Software Name
|
||||
*
|
||||
@@ -33,7 +75,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "XenForo";
|
||||
return "XenForo (1.5.x/2.0.x)";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,17 +229,19 @@ class _Xenforo extends \IPS\convert\Software
|
||||
{
|
||||
return \IPS\convert\Software\Core\Xenforo::fixPostData( $post );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper to fetch a xenforo phrase
|
||||
*
|
||||
* @param string $title Phrase
|
||||
* @param string $xfOneTitle XF1 Phrase title
|
||||
* @param string $xfTwoTitle XF2 Phrase Title
|
||||
* @return string|null
|
||||
*/
|
||||
protected function getPhrase( $title )
|
||||
protected function getPhrase( $xfOneTitle, $xfTwoTitle )
|
||||
{
|
||||
try
|
||||
{
|
||||
$title = ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) ? $xfTwoTitle : $xfOneTitle;
|
||||
return $this->db->select( 'phrase_text', 'xf_phrase', array( "title=?", $title ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
@@ -273,7 +317,6 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'follow_notify_freq' => ( $follow['send_alert'] OR $follow['send_email'] ) ? 'immediate' : 'none',
|
||||
'follow_notify_sent' => 0,
|
||||
'follow_visible' => 1,
|
||||
'follow_index_id' => NULL
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -418,14 +461,13 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'follow_notify_freq' => ( $follow['email_subscribe'] ) ? 'immediate' : 'none',
|
||||
'follow_notify_sent' => 0,
|
||||
'follow_visible' => 1,
|
||||
'follow_index_id' => NULL
|
||||
) );
|
||||
}
|
||||
|
||||
/* Tag Prefix */
|
||||
if ( $row['prefix_id'] )
|
||||
{
|
||||
$prefix = $this->getPhrase( "thread_prefix_{$row['prefix_id']}" );
|
||||
$prefix = $this->getPhrase( "thread_prefix_{$row['prefix_id']}", "thread_prefix.{$row['prefix_id']}" );
|
||||
|
||||
if ( !is_null( $prefix ) )
|
||||
{
|
||||
@@ -519,12 +561,23 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$queued = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
$editName = NULL;
|
||||
try
|
||||
{
|
||||
if( $row['last_edit_user_id'] )
|
||||
{
|
||||
$editName = $this->db->select( 'username', 'xf_user', array( 'user_id=?', $row['last_edit_user_id'] ) )->first();
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
|
||||
$info = array(
|
||||
'pid' => $row['post_id'],
|
||||
'topic_id' => $row['thread_id'],
|
||||
'post' => static::fixPostData( $row['message'] ),
|
||||
'edit_time' => $row['last_edit_date'],
|
||||
'edit_name' => $editName,
|
||||
'author_id' => $row['user_id'],
|
||||
'author_name' => $row['username'],
|
||||
'ip_address' => $ip,
|
||||
@@ -555,7 +608,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
/* Warnings */
|
||||
foreach( $this->db->select( '*', 'xf_warning', array( "content_type=? AND content_id=?", 'post', $row['post_id'] ) ) AS $warn )
|
||||
{
|
||||
$libraryClass->convertWarnLog( array(
|
||||
$warnId = $libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warn['warning_id'],
|
||||
'wl_member' => $warn['user_id'],
|
||||
'wl_moderator' => $warn['warning_user_id'],
|
||||
@@ -564,6 +617,17 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'wl_note_member' => $warn['title'],
|
||||
'wl_note_mods' => $warn['notes'],
|
||||
) );
|
||||
|
||||
/* Add a member history record for this member */
|
||||
$libraryClass->convertMemberHistory( array(
|
||||
'log_id' => 'w' . $warn['warning_id'],
|
||||
'log_member' => $warn['user_id'],
|
||||
'log_by' => $warn['warning_user_id'],
|
||||
'log_type' => 'warning',
|
||||
'log_data' => array( 'wid' => $warnId ),
|
||||
'log_date' => $warn['warning_date']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/* Edit History */
|
||||
|
||||
Reference in new issue
Block a user