Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Converter Vanilla Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2015 Invision Power Services, Inc.
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
* @version
|
||||
*/
|
||||
|
||||
namespace IPS\convert\Software\Forums;
|
||||
@@ -139,8 +138,9 @@ class _Vanilla extends \IPS\convert\Software
|
||||
public static function checkConf()
|
||||
{
|
||||
return array(
|
||||
'convertForums',
|
||||
'convertAttachments'
|
||||
'convertForumsForums',
|
||||
'convertAttachments',
|
||||
'convertForumsPosts'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -156,12 +156,12 @@ class _Vanilla extends \IPS\convert\Software
|
||||
|
||||
switch( $method )
|
||||
{
|
||||
case 'convertForums':
|
||||
$return['convertForums'] = array();
|
||||
case 'convertForumsForums':
|
||||
$return['convertForumsForums'] = array();
|
||||
|
||||
/* Find out where the photos live */
|
||||
\IPS\Member::loggedIn()->language()->words['attach_location_desc'] = \IPS\Member::loggedIn()->language()->addToStack( 'attach_location' );
|
||||
$return['convertForums']['attach_location'] = array(
|
||||
$return['convertForumsForums']['attach_location'] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Text',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
@@ -169,6 +169,33 @@ class _Vanilla extends \IPS\convert\Software
|
||||
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_vanilla_photopath'),
|
||||
);
|
||||
break;
|
||||
case 'convertForumsPosts':
|
||||
/* Get our reactions to let the admin map them */
|
||||
$options = array();
|
||||
$descriptions = array();
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_reactions' ), 'IPS\Content\Reaction' ) AS $reaction )
|
||||
{
|
||||
$options[ $reaction->id ] = $reaction->_icon->url;
|
||||
$descriptions[ $reaction->id ] = \IPS\Member::loggedIn()->language()->addToStack('reaction_title_' . $reaction->id ) . '<br>' . $reaction->_description;
|
||||
}
|
||||
|
||||
$return['convertForumsPosts'] = array();
|
||||
|
||||
foreach( $this->db->select( '*', 'action' ) as $reaction )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['reaction_' . $reaction['ActionID'] ] = $reaction['Name'];
|
||||
\IPS\Member::loggedIn()->language()->words['reaction_' . $reaction['ActionID'] . '_desc' ] = \IPS\Member::loggedIn()->language()->addToStack('reaction_convert_help');
|
||||
|
||||
$return['convertForumsPosts']['reaction_' . $reaction['ActionID'] ] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => NULL,
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments'] = array(
|
||||
'attach_location' => array(
|
||||
@@ -200,6 +227,10 @@ class _Vanilla extends \IPS\convert\Software
|
||||
\IPS\Task::queue( 'convert', 'RebuildFirstPostIds', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'DeleteEmptyTopics', array( 'app' => $this->app->app_id ), 4, array( 'app' ) );
|
||||
|
||||
/* Rebuild Leaderboard */
|
||||
\IPS\Task::queue( 'core', 'RebuildReputationLeaderboard', array(), 4 );
|
||||
\IPS\Db::i()->delete('core_reputation_leaderboard_history');
|
||||
|
||||
/* Caches */
|
||||
\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'forums_topics', 'class' => 'IPS\forums\Topic' ), 3, array( 'app', 'link', 'class' ) );
|
||||
|
||||
@@ -293,7 +324,7 @@ class _Vanilla extends \IPS\convert\Software
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'c.CategoryID' );
|
||||
|
||||
$uploadsPath = $this->app->_session['more_info']['convertAttachments']['attach_location'];
|
||||
$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'
|
||||
@@ -303,7 +334,7 @@ class _Vanilla extends \IPS\convert\Software
|
||||
|
||||
foreach( $forums AS $row )
|
||||
{
|
||||
$icon = $row['Icon'] ? VanillaCore::parseMediaLocation( $row['Icon'], $uploadsPath ) : NULL;
|
||||
$icon = ( isset( $row['Icon'] ) AND $row['Icon'] ) ? VanillaCore::parseMediaLocation( $row['Icon'], $uploadsPath ) : NULL;
|
||||
$info = [
|
||||
'id' => $row['CategoryID'],
|
||||
'name' => $row['Name'],
|
||||
@@ -351,7 +382,7 @@ class _Vanilla extends \IPS\convert\Software
|
||||
->first();
|
||||
|
||||
$row['DateLastComment'] = $data['DateInserted'];
|
||||
$row['LastCommentUserId'] = $data['InsertUserId'];
|
||||
$row['LastCommentUserID'] = $data['InsertUserId'];
|
||||
$row['LastCommentUserName'] = $data['Name'];
|
||||
}
|
||||
|
||||
@@ -363,7 +394,7 @@ class _Vanilla extends \IPS\convert\Software
|
||||
'posts' => $row['CountComments'],
|
||||
'starter_id' => $row['InsertUserID'],
|
||||
'start_date' => VanillaCore::mysqlToDateTime( $row['DateInserted'] ),
|
||||
'last_poster_id' => $row['LastCommentUserId'],
|
||||
'last_poster_id' => $row['LastCommentUserID'],
|
||||
'last_post' => VanillaCore::mysqlToDateTime( $row['DateLastComment'] ),
|
||||
'starter_name' => $row['UserName'],
|
||||
'last_poster_name' => $row['LastCommentUserName'],
|
||||
@@ -440,6 +471,23 @@ class _Vanilla extends \IPS\convert\Software
|
||||
|
||||
$libraryClass->convertForumsPost( $info );
|
||||
$libraryClass->setLastKeyValue( $row['DiscussionID'] );
|
||||
|
||||
/* Reputation */
|
||||
foreach( $this->db->select( '*', 'reaction', array( "ParentType=? AND ParentID=?", 'comment', $row['DiscussionID'] ) ) AS $rep )
|
||||
{
|
||||
$reaction = $this->app->_session['more_info']['convertForumsPosts']['reaction_' . $rep['ActionID'] ];
|
||||
|
||||
$libraryClass->convertReputation( array(
|
||||
'id' => $rep['ReactionID'],
|
||||
'app' => 'forums',
|
||||
'type' => 'pid',
|
||||
'type_id' => 'fp-' . $row['DiscussionID'],
|
||||
'member_id' => $rep['InsertUserID'],
|
||||
'member_received' => $rep['ParentAuthorID'],
|
||||
'rep_date' => VanillaCore::mysqlToDateTime( $row['DateInserted'] ),
|
||||
'reaction' => $reaction
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user