Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Applications Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -135,6 +135,11 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
|
||||
unset( \IPS\Data\Store::i()->convert_apps );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Session data store
|
||||
*/
|
||||
protected $_sessionData = null;
|
||||
|
||||
/**
|
||||
* Save Session Data for this application
|
||||
@@ -145,6 +150,8 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
public function set__session( $value )
|
||||
{
|
||||
\IPS\Db::i()->update( 'convert_app_sessions', array( 'session_app_data' => json_encode( $value ) ), array( 'session_app_id=?', $this->app_id ) );
|
||||
|
||||
$this->_sessionData = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,9 +161,16 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
*/
|
||||
public function get__session()
|
||||
{
|
||||
/* Use ready-cached session data */
|
||||
if( $this->_sessionData !== null )
|
||||
{
|
||||
return $this->_sessionData;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return json_decode( \IPS\Db::i()->select( 'session_app_data', 'convert_app_sessions', array( 'session_app_id=?', $this->app_id ) )->first(), TRUE );
|
||||
$this->_sessionData = json_decode( \IPS\Db::i()->select( 'session_app_data', 'convert_app_sessions', array( 'session_app_id=?', $this->app_id ) )->first(), TRUE );
|
||||
return $this->_sessionData;
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
@@ -253,14 +267,14 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an IPS Community Suite ID from a Foreign ID.
|
||||
* Retrieves an Invision Community ID from a Foreign ID.
|
||||
*
|
||||
* @param mixed $foreign_id The Foreign ID
|
||||
* @param string|array $type The type of item, or an array of types to check.
|
||||
* @param boolean $parent If set to TRUE, then retrieves from the parent application if one is available.
|
||||
* @param boolean $mainTable If set to TRUE, and the type is of either 'core_message_topics', 'core_message_posts', 'core_message_topic_user_map', 'forums_topics', or 'forums_posts', then the ID is retrieved from convert_link, rather than the other link tables.
|
||||
*
|
||||
* @return integer The IPS Community Suite ID.
|
||||
* @return integer The Invision Community ID.
|
||||
* @throws \OutOfRangeException
|
||||
*/
|
||||
public function getLink( $foreign_id, $type, $parent=FALSE, $mainTable=FALSE )
|
||||
@@ -272,9 +286,9 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
|
||||
$key = md5( json_encode( $type ) );
|
||||
|
||||
if ( isset( $this->linkCache[$key][$foreign_id] ) )
|
||||
if ( isset( $this->linkCache[ $key ][ $foreign_id ] ) )
|
||||
{
|
||||
return $this->linkCache[$key][$foreign_id];
|
||||
return $this->linkCache[ $key ][ $foreign_id ];
|
||||
}
|
||||
|
||||
$table = 'convert_link';
|
||||
@@ -300,18 +314,18 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
|
||||
try
|
||||
{
|
||||
$link = \IPS\Db::i()->select( 'ipb_id', $table, array( \IPS\Db::i()->in( 'type', $type ) . ' AND foreign_id=? AND app=?', (string) $foreign_id, ( $parent === TRUE ) ? $this->parent : $this->app_id ) )->first();
|
||||
$this->linkCache[$key][$foreign_id] = $link;
|
||||
return $this->linkCache[$key][$foreign_id];
|
||||
$link = \IPS\Db::i()->select( 'ipb_id', $table, array( \IPS\Db::i()->in( 'type', $type ) . ' AND foreign_id=? AND app=?', (string) $foreign_id, ( $parent === TRUE AND $this->parent ) ? $this->parent : $this->app_id ), 'link_id DESC' )->first();
|
||||
$this->linkCache[ $key ][ $foreign_id ] = $link;
|
||||
return $this->linkCache[ $key ][ $foreign_id ];
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
/* If lookup failed, and we have a parent, try it anyway */
|
||||
try
|
||||
{
|
||||
$link = \IPS\Db::i()->select( 'ipb_id', $table, array( \IPS\Db::i()->in( 'type', $type ) . ' AND foreign_id=? AND app=?', (string) $foreign_id, $this->parent ) )->first();
|
||||
$this->linkCache[$key][$foreign_id] = $link;
|
||||
return $this->linkCache[$key][$foreign_id];
|
||||
$link = \IPS\Db::i()->select( 'ipb_id', $table, array( \IPS\Db::i()->in( 'type', $type ) . ' AND foreign_id=? AND app=?', (string) $foreign_id, $this->parent ), 'link_id DESC' )->first();
|
||||
$this->linkCache[ $key ][ $foreign_id ] = $link;
|
||||
return $this->linkCache[ $key ][ $foreign_id ];
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
|
||||
@@ -326,14 +340,14 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
protected $siblingLinkCache = array();
|
||||
|
||||
/**
|
||||
* Retrieves an IPS Community Suite iD from a Foriegn ID in a Sibling Application
|
||||
* Retrieves an Invision Community iD from a Foriegn ID in a Sibling Application
|
||||
*
|
||||
* @param mixed $foreign_id The Foreign ID.
|
||||
* @param string $type The type of item.
|
||||
* @param string $sibling The sibling software library.
|
||||
* @param boolean $mainTable If set to TRUE, and the type is of either 'core_message_topics', 'core_message_posts', 'core_message_topic_user_map', 'forums_topics', or 'forums_posts', then the ID is retrieved from convert_link, rather than the other link tables.
|
||||
*
|
||||
* @return inteer The IPS Community Suite ID.
|
||||
* @return inteer The Invision Community ID.
|
||||
* @throws \OutOfRangeException
|
||||
*/
|
||||
public function getSiblingLink( $foreign_id, $type, $sibling, $mainTable=FALSE )
|
||||
@@ -356,9 +370,9 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a foreign ID to IPS Community Suite ID reference to the convert_link tables.
|
||||
* Saves a foreign ID to Invision Community ID reference to the convert_link tables.
|
||||
*
|
||||
* @param integer $ips_id The IPS Community Suite ID
|
||||
* @param integer $ips_id The Invision Community ID
|
||||
* @param mixed $foreign_id The Foreign ID
|
||||
* @param string $type The type of item
|
||||
* @param boolean $duplicate If TRUE, then this item is a duplicate and was merged into existing $ips_id
|
||||
@@ -395,9 +409,9 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a link exists for an IPS Community Suite ID
|
||||
* Checks to see if a link exists for an Invision Community ID
|
||||
*
|
||||
* @param integer $ips_id The IPS Community Suite ID.
|
||||
* @param integer $ips_id The Invision Community ID.
|
||||
* @return void
|
||||
* @throws \OutOfRangeException
|
||||
*/
|
||||
@@ -491,7 +505,7 @@ class _App extends \IPS\Patterns\ActiveRecord
|
||||
{
|
||||
case 'board':
|
||||
case 'ccs':
|
||||
$this->sw = $this->_data['sw'];
|
||||
$this->sw = $this->sw;
|
||||
$this->save();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Exception Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Library Master Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Library Blog Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -52,7 +52,7 @@ class _Blog extends Core
|
||||
'dependencies' => array(),
|
||||
'link_type' => 'blog_blogs',
|
||||
);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'convertBlogEntries':
|
||||
$return[ $k ] = array(
|
||||
@@ -64,7 +64,7 @@ class _Blog extends Core
|
||||
'dependencies' => array( 'convertBlogs' ),
|
||||
'link_type' => 'blog_entries',
|
||||
);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'convertBlogComments':
|
||||
$return[ $k ] = array(
|
||||
@@ -76,7 +76,7 @@ class _Blog extends Core
|
||||
'dependencies' => array( 'convertBlogEntries' ),
|
||||
'link_type' => 'bog_comments',
|
||||
);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'convertBlogRssImport':
|
||||
$return[ $k ] = array(
|
||||
@@ -88,7 +88,43 @@ class _Blog extends Core
|
||||
'dependencies' => array( 'convertBlogs' ),
|
||||
'link_type' => 'blog_rss_import',
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertClubBlogs':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_blogs',
|
||||
'step_method' => 'convertClubBlogs',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'blog_blogs', array( "blog_club_id IS NOT NULL" ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 2000,
|
||||
'dependencies' => array( 'convertClubs' ),
|
||||
'link_type' => 'core_club_blogs'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertClubBlogEntries':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_blog_entries',
|
||||
'step_method' => 'convertClubBlogEntries',
|
||||
'ips_rows' => (int) \IPS\Db::i()->select( 'SUM(blog_entries)', 'blog_blogs', array( "blog_club_id IS NOT NULL" ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 1000,
|
||||
'dependencies' => array( 'convertClubBlogs' ),
|
||||
'link_type' => 'core_club_blogs_entries'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertClubBlogComments':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_blog_comments',
|
||||
'step_method' => 'convertClubBlogComments',
|
||||
'ips_rows' => (int) \IPS\Db::i()->select( 'SUM(blog_comments)', 'blog_blogs', array( "blog_club_id IS NOT NULL" ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 1000,
|
||||
'dependencies' => array( 'convertClubBlogEntries' ),
|
||||
'link_type' => 'core_club_blogs_comments'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertAttachments':
|
||||
$return[ $k ] = array(
|
||||
@@ -100,7 +136,7 @@ class _Blog extends Core
|
||||
'dependencies' => array( 'convertBlogEntries', 'convertBlogComments' ),
|
||||
'link_type' => 'core_attachments',
|
||||
);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,27 +164,39 @@ class _Blog extends Core
|
||||
{
|
||||
/* Should return multiple array members for each table that needs to be truncated. The key should be the table, while the value should be a WHERE clause, or NULL to completely empty the table */
|
||||
case 'convertBlogs':
|
||||
$return['convertBlogs'] = array( 'blog_blogs' => NULL );
|
||||
break;
|
||||
$return['convertBlogs'] = array( 'blog_blogs' => NULL, 'core_clubs_node_map' => array( "node_class=?", "IPS\\blog\\Blog" ) );
|
||||
break;
|
||||
|
||||
case 'convertBlogEntries':
|
||||
$return['convertBlogEntries'] = array( 'blog_entries' => NULL );
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'convertBlogComments':
|
||||
$return['convertBlogComments'] = array( 'blog_comments' => NULL );
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'convertBlogRssImport':
|
||||
$return['convertBlogRssImport'] = array( 'blog_rss_import' => NULL, 'blog_rss_imported' => NULL );
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments'] = array(
|
||||
'core_attachments' => \IPS\Db::i()->in( \IPS\Db::i()->select( 'attachment_id', 'core_attachments_map', array( "location_key=?", 'blog_Entries' ) ) ),
|
||||
'core_attachments_map' => array( "location_key=?", 'blog_Entries' )
|
||||
);
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'convertClubBlogs':
|
||||
$return['convertClubBlogs'] = array( "blog_blogs" => array( "blog_club_id IS NOT NULL" ) );
|
||||
break;
|
||||
|
||||
case 'convertClubBlogEntries':
|
||||
$return['convertClubBlogEntries'] = array( 'blog_entries' => array( 'entry_id IN ( ' . (string) \IPS\Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_blog_entries' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
|
||||
case 'convertClubBlogComments':
|
||||
$return['convertClubBlogComments'] = array( 'blog_comments' => array( 'comment_id IN ( ' . (string) \IPS\Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_blog_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +332,7 @@ class _Blog extends Core
|
||||
|
||||
if ( $owner->member_id )
|
||||
{
|
||||
$name = "{$member->name}'s Blog";
|
||||
$name = "{$owner->name}'s Blog";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -366,6 +414,12 @@ class _Blog extends Core
|
||||
$info[ $column ] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sidebar */
|
||||
if( !isset( $info['blog_sidebar'] ) OR !$info['blog_sidebar'] )
|
||||
{
|
||||
$info['blog_sidebar'] = NULL;
|
||||
}
|
||||
|
||||
/* Well update this later if we need too */
|
||||
$info['blog_social_group'] = NULL;
|
||||
@@ -422,6 +476,22 @@ class _Blog extends Core
|
||||
$info['blog_cover_photo_offset'] = NULL;
|
||||
}
|
||||
|
||||
if ( isset( $info['blog_club_id'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$info['blog_club_id'] = $this->software->app->getLink( $info['blog_club_id'], 'core_clubs', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$info['blog_club_id'] = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$info['blog_club_id'] = NULL;
|
||||
}
|
||||
|
||||
$id = $info['blog_id'];
|
||||
unset( $info['blog_id'] );
|
||||
|
||||
@@ -431,6 +501,18 @@ class _Blog extends Core
|
||||
\IPS\Lang::saveCustom( 'blog', "blogs_blog_{$inserted_id}", $name );
|
||||
\IPS\Lang::saveCustom( 'blog', "blogs_blog_{$inserted_id}_desc", $desc );
|
||||
|
||||
if ( $info['blog_club_id'] )
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_clubs_node_map', array(
|
||||
'club_id' => $info['blog_club_id'],
|
||||
'node_class' => "IPS\\blog\\Blog",
|
||||
'node_id' => $inserted_id,
|
||||
'name' => $name
|
||||
) );
|
||||
|
||||
\IPS\blog\Blog::load( $inserted_id )->setPermissionsToClub( \IPS\Member\Club::load( $info['blog_club_id'] ) );
|
||||
}
|
||||
|
||||
return $inserted_id;
|
||||
}
|
||||
|
||||
@@ -920,4 +1002,52 @@ class _Blog extends Core
|
||||
|
||||
return parent::convertAttachment( $info, $map, $filepath, $filedata );
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Club Blog
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly insertd blog, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubBlog( $info=array() )
|
||||
{
|
||||
$insertedId = $this->convertBlog( $info );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['blog_id'], 'core_clubs_blogs' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Club Blog Entry
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted entry, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubBlogEntry( $info=array() )
|
||||
{
|
||||
$insertedId = $this->convertBlogEntry( $info );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['entry_id'], 'core_clubs_blog_entries' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Club Blog Comment
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubBlogComment( $info=array() )
|
||||
{
|
||||
$insertedId = $this->convertBlogComment( $info );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['comment_id'], 'core_clubs_blog_comments' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Library Legacy Board Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Library Calendar Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -50,6 +50,18 @@ class _Calendar extends Core
|
||||
'link_type' => 'calendar_calendars',
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertCalendarVenues':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_calendar_venues',
|
||||
'step_method' => 'convertCalendarVenues',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_venues' )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => array( 'convertCalendarCalendars' ),
|
||||
'link_type' => 'calendar_venues',
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertCalendarEvents':
|
||||
$return[ $k ] = array(
|
||||
@@ -110,6 +122,18 @@ class _Calendar extends Core
|
||||
'link_type' => 'calendar_import_feeds',
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertCalendarReminders':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_calendar_reminders',
|
||||
'step_method' => 'convertCalendarReminders',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'calendar_event_reminders' )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => array( 'convertCalendarEvents' ),
|
||||
'link_type' => 'calendar_reminders',
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertAttachments':
|
||||
$return[ $k ] = array(
|
||||
@@ -148,7 +172,7 @@ class _Calendar extends Core
|
||||
switch( $k )
|
||||
{
|
||||
case 'convertCalendarCalendars':
|
||||
$return['convertCalendarCalendars'] = array( 'calendar_calendars' => NULL );
|
||||
$return['convertCalendarCalendars'] = array( 'calendar_calendars' => NULL, 'core_clubs_node_map' => array( "node_class=?", "IPS\\calendar\\Calendar" ) );
|
||||
break;
|
||||
|
||||
case 'convertCalendarEvents':
|
||||
@@ -170,6 +194,14 @@ class _Calendar extends Core
|
||||
case 'convertCalendarFeeds':
|
||||
$return['convertCalendarFeeds'] = array( 'calender_import_feeds' => NULL );
|
||||
break;
|
||||
|
||||
case 'convertCalendarVenues':
|
||||
$return['convertCalendarVenues'] = array( 'calender_venues' => NULL );
|
||||
break;
|
||||
|
||||
case 'convertCalendarReminders':
|
||||
$return['convertCalendarReminders'] = array( 'calender_reminders' => NULL );
|
||||
break;
|
||||
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments'] = array( 'core_attachments' => array( "location_key=?", 'calendar_Events' ) );
|
||||
@@ -257,6 +289,22 @@ class _Calendar extends Core
|
||||
$info['cal_color'] = $genericCalendar->_generateColor();
|
||||
}
|
||||
|
||||
if ( isset( $info['cal_club_id'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$info['cal_club_id'] = $this->software->app->getLink( $info['cal_club_id'], 'core_clubs', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$info['cal_club_id'] = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$info['cal_club_id'] = NULL;
|
||||
}
|
||||
|
||||
$id = $info['cal_id'];
|
||||
unset( $info['cal_id'] );
|
||||
|
||||
@@ -266,6 +314,18 @@ class _Calendar extends Core
|
||||
\IPS\Lang::saveCustom( 'calendar', "calendar_calendar_{$inserted_id}", $name );
|
||||
\IPS\Lang::saveCustom( 'calendar', "calendar_calendar_{$inserted_id}_desc", $desc );
|
||||
|
||||
if ( $info['cal_club_id'] )
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_clubs_node_map', array(
|
||||
'node_id' => $inserted_id,
|
||||
'node_class' => "IPS\\calendar\\Calendar",
|
||||
'club_id' => $info['cal_club_id'],
|
||||
'name' => $name,
|
||||
) );
|
||||
|
||||
\IPS\calendar\Calendar::load( $inserted_id )->setPermissionsToClub( \IPS\Member\Club::load( $info['cal_club_id'] ) );
|
||||
}
|
||||
|
||||
return $inserted_id;
|
||||
}
|
||||
|
||||
@@ -318,6 +378,22 @@ class _Calendar extends Core
|
||||
{
|
||||
$info['event_member_id'] = 0;
|
||||
}
|
||||
|
||||
if ( isset( $info['event_venue'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$info['event_venue'] = $this->software->app->getLink( $info['event_venue'], 'calendar_venues', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$info['event_venue'] = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$info['event_venue'] = NULL;
|
||||
}
|
||||
|
||||
if ( !isset( $info['event_title'] ) )
|
||||
{
|
||||
@@ -1080,6 +1156,144 @@ class _Calendar extends Core
|
||||
|
||||
return $inserted_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Calendar Venue
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted venue, or FALSE on failure.
|
||||
*/
|
||||
public function convertCalendarVenue( $info=array() )
|
||||
{
|
||||
if ( !isset( $info['venue_id'] ) )
|
||||
{
|
||||
$this->software->app->log( 'calendar_venue_missing_ids', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !isset( $info['venue_title'] ) )
|
||||
{
|
||||
$info['venue_title'] = "Untitled Venue {$info['venue_id']}";
|
||||
$this->software->app->log( 'calendar_venue_missing_title', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['venue_id'] );
|
||||
}
|
||||
|
||||
if ( isset( $info['venue_enabled'] ) )
|
||||
{
|
||||
$info['venue_enabled'] = 1;
|
||||
}
|
||||
|
||||
if ( isset( $info['venue_address'] ) )
|
||||
{
|
||||
if ( is_array( $info['venue_address'] ) AND isset( $info['venue_address']['lat'] ) AND isset( $info['venue_address']['long'] ) )
|
||||
{
|
||||
$info['venue_address'] = (string) \IPS\GeoLocation::getFromLatLong( $info['venue_address']['lat'], $info['venue_address']['long'] );
|
||||
}
|
||||
else if ( $info['venue_address'] instanceof \IPS\GeoLocation )
|
||||
{
|
||||
$info['venue_address'] = (string) $info['venue_address'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_venue_missing_address', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_venue_missing_address', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !isset( $info['venue_position'] ) )
|
||||
{
|
||||
$position = \IPS\Db::i()->select( 'MAX(venue_position)', 'calendar_venues' )->first();
|
||||
$info['venue_position'] = $position + 1;
|
||||
}
|
||||
|
||||
$id = $info['venue_id'];
|
||||
unset( $info['venue_id'] );
|
||||
|
||||
$inserted_id = \IPS\Db::i()->insert( 'calendar_venues', $info );
|
||||
$this->software->app->addLink( $inserted_id, $id, 'calendar_venues' );
|
||||
|
||||
return $inserted_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Calendar Event Reminder
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted reminder, or FALSE on failure.
|
||||
*/
|
||||
public function convertCalendarReminder( $info=array() )
|
||||
{
|
||||
if ( !isset( $info['reminder_id'] ) )
|
||||
{
|
||||
$this->software->app->log( 'calendar_reminder_missing_ids', __METHOD__, \IPS\convert\App::LOG_WARNING );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( isset( $info['reminder_days_before'] ) )
|
||||
{
|
||||
$info['reminder_days_before'] = 1;
|
||||
}
|
||||
|
||||
if ( isset( $info['reminder_event_id'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$info['reminder_event_id'] = $this->software->app->getLink( $info['reminder_event_id'], 'calendar_events' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$this->software->app->log( 'calendar_reminder_missing_event', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['reminder_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_reminder_missing_event', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['reminder_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( isset( $info['reminder_member_id'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$info['reminder_member_id'] = $this->software->app->getLink( $info['reminder_member_id'], 'core_members', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$this->software->app->log( 'calendar_reminder_missing_member', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['reminder_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->software->app->log( 'calendar_reminder_missing_member', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['reminder_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( isset( $info['reminder_date'] ) )
|
||||
{
|
||||
if ( $info['reminder_date'] instanceof \IPS\DateTime )
|
||||
{
|
||||
$info['reminder_date'] = $info['reminder_date']->getTimestamp();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$info['reminder_date'] = time();
|
||||
}
|
||||
|
||||
$id = $info['reminder_id'];
|
||||
unset( $info['reminder_id'] );
|
||||
|
||||
$inserted_id = \IPS\Db::i()->insert( 'calendar_event_reminders', $info );
|
||||
$this->software->app->addLink( $inserted_id, $id, 'calendar_event_reminders' );
|
||||
|
||||
return $inserted_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an attachment
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Library Legacy CCS Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Library CMS Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -219,14 +219,15 @@ class _Cms extends Core
|
||||
{
|
||||
$in[] = $database;
|
||||
}
|
||||
|
||||
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_cms_attachments',
|
||||
'step_method' => 'convertAttachments',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments_map', array( \IPS\Db::i()->in( 'id3', $in ) . " AND location_key=?", 'cms_Records' ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => array( 'convertCmsDatabaseRecords', 'convertCmsDatabaseComments', 'convertCmsDatabaseReviews' ),
|
||||
#'dependencies' => array( 'convertCmsDatabaseRecords', 'convertCmsDatabaseComments', 'convertCmsDatabaseReviews' ),
|
||||
'dependencies' => array( 'convertCmsDatabaseRecords' ), //TODO dear code reviewer... please review this part.. i had to remove it for my further work
|
||||
'link_type' => 'core_attachments',
|
||||
);
|
||||
break;
|
||||
@@ -273,8 +274,12 @@ class _Cms extends Core
|
||||
$database->delete();
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
|
||||
/* Only return if we're truncating this step */
|
||||
if( $method == 'convertCmsDatabases' )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'convertCmsDatabaseCategories':
|
||||
@@ -308,6 +313,12 @@ class _Cms extends Core
|
||||
case 'convertCmsMedia':
|
||||
$return['convertCmsMedia'] = array( 'cms_media' => NULL );
|
||||
break;
|
||||
|
||||
case 'convertAttachments':
|
||||
$subQuery = (string) \IPS\Db::i()->select( 'attachment_id', 'core_attachments_map', array( "location_key='cms_Records'" ) );
|
||||
$return['convertAttachments'] = array( 'core_attachments' => "attach_id IN ( {$subQuery} )", 'core_attachments_map' => array( "location_key=?", 'cms_Records' ) );
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -575,7 +586,7 @@ class _Cms extends Core
|
||||
|
||||
/**
|
||||
* Convert a block
|
||||
* @note These probably won't really work unless going from IPS4 to IPS4, but we still support them anyway so they can be refactored.
|
||||
* @note These probably won't really work unless going from Invision Community to Invision Community, but we still support them anyway so they can be refactored.
|
||||
*
|
||||
* @param array $info Data to insert.
|
||||
* @return integer|boolean The ID of the newly inserted block, or FALSE on failure.
|
||||
@@ -2645,7 +2656,7 @@ class _Cms extends Core
|
||||
$map['id1_from_parent'] = FALSE;
|
||||
$map['id2_from_parent'] = FALSE;
|
||||
$map['id3_skip_link'] = TRUE;
|
||||
$map['location_key'] = "cms_Records{$database}";
|
||||
$map['location_key'] = "cms_Records";
|
||||
|
||||
if ( \substr( $map['id3'], -1, 7 ) == '-review' )
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Library Downloads Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -116,7 +116,55 @@ class _Downloads extends Core
|
||||
'link_type' => 'downloads_reviews',
|
||||
);
|
||||
break;
|
||||
|
||||
|
||||
case 'convertClubDownloadsCategories':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_downloads_categories',
|
||||
'step_method' => 'convertClubDownloadsCategories',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_categories', array( "cclub_id IS NOT NULL" ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 1000,
|
||||
'dependencies' => array( 'convertClubs' ),
|
||||
'link_type' => 'core_club_downloads_categories',
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertClubDownloadsFiles':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_downloads_files',
|
||||
'step_method' => 'convertClubDownloadsFiles',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files', array( \IPS\Db::i()->in( 'file_category_id', \IPS\Db::i()->select( 'cid', 'downloads_categories', array( "cclub_id IS NOT NULL" ) ) ) ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => array( 'convertClubDownloadsCategories' ),
|
||||
'link_type' => 'core_club_downloads_files'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertClubDownloadsComments':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_downloads_comments',
|
||||
'step_method' => 'convertClubDownloadsComments',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_comments', array( \IPS\Db::i()->in( 'comment_file_id', \IPS\Db::i()->select( 'file_id', 'downloads_files', array( \IPS\Db::i()->in( 'file_category_id', \IPS\Db::i()->select( 'cid', 'downloads_categories', array( "cclub_id IS NOT NULL" ) ) ) ) ) ) ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 1000,
|
||||
'dependencies' => array( 'convertClubDownloadsFiles' ),
|
||||
'link_type' => 'core_club_downloads_comments',
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertClubDownloadsReviews':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_downloads_reviews',
|
||||
'step_method' => 'convertClubDownloadsReviews',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files_reviews', array( \IPS\Db::i()->in( 'review_file_id', \IPS\Db::i()->select( 'file_id', 'downloads_files', array( \IPS\Db::i()->in( 'file_category_id', \IPS\Db::i()->select( 'cid', 'downloads_categories', array( "cclub_id IS NOT NULL" ) ) ) ) ) ) ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 1000,
|
||||
'dependencies' => array( 'convertClubDownloadsFiles' ),
|
||||
'link_type' => 'core_club_downloads_reviews',
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertAttachments':
|
||||
$return[ $k ] = array(
|
||||
'step_method' => 'convertAttachments',
|
||||
@@ -183,6 +231,22 @@ class _Downloads extends Core
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments'] = array( 'core_attachments' => \IPS\Db::i()->select( 'attachment_id', 'core_attachments_map', array( "location_key=?", 'downloads_Downloads' ) ), 'core_attachments_map' => array( "location_key=?", 'downloads_Downloads' ) );
|
||||
break;
|
||||
|
||||
case 'convertClubDownloadsCategories':
|
||||
$return['convertClubDownloadsCategories'] = array( 'downloads_categories' => array( "cclub_id IS NOT NULL" ) );
|
||||
break;
|
||||
|
||||
case 'convertClubDownloadsFiles':
|
||||
$return['convertClubDownloadsFiles'] = array( 'downloads_files' => array( 'file_id IN ( ' . (string) \IPS\Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_files' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
|
||||
case 'convertClubDownloadsComments':
|
||||
$return['convertClubDownloadsComments'] = array( 'downloads_comments' => array( 'comment_id IN ( ' . (string) \IPS\Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
|
||||
case 'convertClubDownloadsReviews':
|
||||
$return['convertClubDownloadsFiles'] = array( 'downloads_reviews' => array( 'review_id IN ( ' . (string) \IPS\Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_reviews' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -605,6 +669,23 @@ class _Downloads extends Core
|
||||
$info['ctopic_suffix'] = '';
|
||||
}
|
||||
|
||||
|
||||
if ( isset( $info['cclub_id'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$info['cclub_id'] = $this->software->app->getLink( $info['cclub_id'], 'core_clubs', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$info['cclub_id'] = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$info['cclub_id'] = NULL;
|
||||
}
|
||||
|
||||
/* Can't know this */
|
||||
$info['clast_file_id'] = 0;
|
||||
$info['clast_file_date'] = 0;
|
||||
@@ -621,6 +702,18 @@ class _Downloads extends Core
|
||||
|
||||
\IPS\Db::i()->update( 'downloads_categories', array( "cparent" => $inserted_id ), array( "cconv_parent=? AND cconv_parent<>?", $id, 0 ) );
|
||||
|
||||
if ( $info['cclub_id'] )
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_clubs_node_map', array(
|
||||
'node_id' => $inserted_id,
|
||||
'node_class' => "IPS\\downloads\\Category",
|
||||
'club_id' => $info['cclub_id'],
|
||||
'name' => $name
|
||||
) );
|
||||
|
||||
\IPS\downloads\Category::load( $inserted_id )->setPermissionsToClub( \IPS\Member\Club::load( $info['cclub_id'] ) );
|
||||
}
|
||||
|
||||
return $inserted_id;
|
||||
}
|
||||
|
||||
@@ -911,15 +1004,13 @@ class _Downloads extends Core
|
||||
|
||||
try
|
||||
{
|
||||
if ( !isset( $record['file_data'] ) OR is_null( $record['file_data'] ) )
|
||||
if ( !isset( $record['file_data'] ) )
|
||||
{
|
||||
$record['file_data'] = file_get_contents( $record['file_path'] );
|
||||
}
|
||||
|
||||
if ( $record['record_type'] != 'link' )
|
||||
{
|
||||
unset( $record['file_path'] );
|
||||
$record['file_data'] = NULL;
|
||||
}
|
||||
|
||||
/* We need the file storage to copy the file rather than move it */
|
||||
\IPS\File\FileSystem::$converterCopy = TRUE;
|
||||
|
||||
if ( $record['record_type'] == 'link' )
|
||||
{
|
||||
@@ -930,7 +1021,7 @@ class _Downloads extends Core
|
||||
}
|
||||
else if ( $record['record_type'] == 'upload' )
|
||||
{
|
||||
$file = \IPS\File::create( 'downloads_Files', $record['record_realname'], $record['file_data'] );
|
||||
$file = \IPS\File::create( 'downloads_Files', $record['record_realname'], $record['file_data'], NULL, TRUE, $record['file_path'] );
|
||||
$record['record_location'] = (string) $file;
|
||||
$record['record_size'] = $file->filesize();
|
||||
|
||||
@@ -941,7 +1032,7 @@ class _Downloads extends Core
|
||||
}
|
||||
else
|
||||
{
|
||||
$file = \IPS\File::create( 'downloads_Screenshots', $record['record_realname'], $record['file_data'] );
|
||||
$file = \IPS\File::create( 'downloads_Screenshots', $record['record_realname'], $record['file_data'], NULL, TRUE, $record['file_path'] );
|
||||
$record['record_location'] = (string) $file;
|
||||
$record['record_thumb'] = (string) $file->thumbnail( 'downloads_Files' );
|
||||
$record['record_size'] = $file->filesize();
|
||||
@@ -957,8 +1048,10 @@ class _Downloads extends Core
|
||||
$this->software->app->log( $e->getMessage(), __METHOD__, \IPS\convert\App::LOG_WARNING, ( $hasId ) ? $record['record_id'] : NULL );
|
||||
continue;
|
||||
}
|
||||
|
||||
unset( $record['file_data'] );
|
||||
|
||||
/* Revert file system to default functionality */
|
||||
\IPS\File\FileSystem::$converterCopy = FALSE;
|
||||
unset( $record['file_data'], $file );
|
||||
|
||||
if ( isset( $record['record_time'] ) )
|
||||
{
|
||||
@@ -1358,4 +1451,69 @@ class _Downloads extends Core
|
||||
|
||||
return parent::convertAttachment( $info, $map, $filepath, $filedata );
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Club Downloads Category
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted category, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubDownloadsCategory( $info=array() )
|
||||
{
|
||||
$insertedId = $this->convertDownloadsCategory( $info );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['cid'], 'core_clubs_downloads_categories' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Club Downloads File
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @param array $records File Records
|
||||
* @return integer|boolean The ID of the newly inserted file, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubDownloadsFile( $info=array(), $records=array() )
|
||||
{
|
||||
$insertedId = $this->convertDownloadsFile( $info, $records );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['file_id'], 'core_clubs_downloads_files' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Club Downloads Comment
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubDownloadsComment( $info=array() )
|
||||
{
|
||||
$insertedId = $this->convertDownloadsComment( $info );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['comment_id'], 'core_clubs_downloads_comments' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Club Downloads Review
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubDownloadsReview( $info=array() )
|
||||
{
|
||||
$insertedId = $this->convertDownloadsReview( $info );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['review_id'], 'core_clubs_downloads_reviews' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Library Forums Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -161,6 +161,44 @@ class _Forums extends Core
|
||||
'link_type' => 'core_attachments',
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertClubForums':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_forums',
|
||||
'step_method' => 'convertClubForums',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'forums_forums', array( "club_id IS NOT NULL" ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 2000,
|
||||
'dependencies' => array( 'convertForumsForums' ),
|
||||
'link_type' => 'core_club_forums'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertClubTopics':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_topics',
|
||||
'step_method' => 'convertClubTopics',
|
||||
'ips_rows' => (int) \IPS\Db::i()->select( 'COUNT(tid)', 'forums_topics', array( 'forum_id IN ( ' . (string) \IPS\Db::i()->select( 'id', 'forums_forums', array( "club_id IS NOT NULL" ) ) . ')' ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 1000,
|
||||
'dependencies' => array( 'convertClubForums' ),
|
||||
'link_type' => 'core_club_topics'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertClubPosts':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_posts',
|
||||
'step_method' => 'convertClubPosts',
|
||||
'ips_rows' => (int) \IPS\Db::i()->select( 'COUNT(pid)', 'forums_forums', array( "club_id IS NOT NULL" ) )
|
||||
->join( 'forums_topics', 'forums_topics.forum_id=forums_forums.id')
|
||||
->join( 'forums_posts', 'forums_posts.topic_id=forums_topics.tid')->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 1000,
|
||||
'dependencies' => array( 'convertClubTopics' ),
|
||||
'link_type' => 'core_club_posts'
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,6 +243,7 @@ class _Forums extends Core
|
||||
case 'convertForumsForums':
|
||||
$return['convertForumsForums'] = array(
|
||||
'core_follow' => array( 'follow_app=? AND follow_area=?', 'forums', 'forum' ),
|
||||
'core_clubs_node_map' => array( "node_class=?", "IPS\\forums\\Forum" ),
|
||||
'forums_forums' => NULL
|
||||
);
|
||||
break;
|
||||
@@ -262,6 +301,18 @@ class _Forums extends Core
|
||||
}
|
||||
$return['convertAttachments'] = array( 'core_attachments' => \IPS\Db::i()->in( 'attach_id', $attachIds ), 'core_attachments_map' => array( "location_key=?", 'forums_Forums' ) );
|
||||
break;
|
||||
|
||||
case 'convertClubForums':
|
||||
$return['convertClubForums'] = array( 'forums_forums' => array( "club_id IS NOT NULL" ), 'core_clubs_node_map' => array( 'node_class=?', 'IPS\\forums\\Forum' ) );
|
||||
break;
|
||||
|
||||
case 'convertClubTopics':
|
||||
$return['convertClubTopics'] = array( 'forums_topics' => array( 'tid IN ( ' . (string) \IPS\Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_topics' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
|
||||
case 'convertClubPosts':
|
||||
$return['convertClubPosts'] = array( 'forums_posts' => array( 'pid IN ( ' . (string) \IPS\Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_posts' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $return[$method];
|
||||
@@ -364,27 +415,30 @@ class _Forums extends Core
|
||||
}
|
||||
|
||||
/* Do parent_id now - we'll need it later */
|
||||
if ( isset( $info['parent_id'] ) )
|
||||
if ( !isset( $info['club_id'] ) )
|
||||
{
|
||||
if ( $info['parent_id'] != -1 )
|
||||
if ( isset( $info['parent_id'] ) )
|
||||
{
|
||||
try
|
||||
if ( $info['parent_id'] != -1 )
|
||||
{
|
||||
$info['parent_id'] = $this->software->app->getLink( $info['parent_id'], 'forums_forums' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
/* Does the ID exist in the source? */
|
||||
$info['conv_parent'] = $info['parent_id'];
|
||||
|
||||
/* Default to a category unless a later converted forum updates the parent_id */
|
||||
$info['parent_id'] = -1;
|
||||
try
|
||||
{
|
||||
$info['parent_id'] = $this->software->app->getLink( $info['parent_id'], 'forums_forums' );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
/* Does the ID exist in the source? */
|
||||
$info['conv_parent'] = $info['parent_id'];
|
||||
|
||||
/* Default to a category unless a later converted forum updates the parent_id */
|
||||
$info['parent_id'] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$info['parent_id'] = $this->_getOrphanedForumCategory();
|
||||
else
|
||||
{
|
||||
$info['parent_id'] = $this->_getOrphanedForumCategory();
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isset( $info['position'] ) )
|
||||
@@ -707,7 +761,7 @@ class _Forums extends Core
|
||||
{
|
||||
$icondata = file_get_contents( $iconpath );
|
||||
}
|
||||
$file = \IPS\File::create( 'forums_Icons', $info['icon'], $filedata );
|
||||
$file = \IPS\File::create( 'forums_Icons', $info['icon'], $icondata );
|
||||
$info['icon'] = (string) $file;
|
||||
}
|
||||
else
|
||||
@@ -724,6 +778,36 @@ class _Forums extends Core
|
||||
$info['icon'] = NULL;
|
||||
}
|
||||
|
||||
if ( isset( $info['club_id'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$info['club_id'] = $this->software->app->getLink( $info['club_id'], 'core_clubs', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
if ( $info['club_id'] )
|
||||
{
|
||||
try
|
||||
{
|
||||
$info['parent_id'] = $this->software->app->getLink( '__orphan_club_forum__', 'core_clubs', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$info['parent_id'] = $this->convertForumsForum( array(
|
||||
'id' => '__orphan_club_forum__',
|
||||
'name' => 'Orphaned Club Forums',
|
||||
'parent_id' => -1
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$info['club_id'] = NULL;
|
||||
}
|
||||
|
||||
$id = $info['id'];
|
||||
unset( $info['id'] );
|
||||
|
||||
@@ -735,6 +819,18 @@ class _Forums extends Core
|
||||
|
||||
\IPS\Db::i()->update( 'forums_forums', array( "parent_id" => $inserted_id ), array( "conv_parent=? AND conv_parent<>?", $id, 0 ) );
|
||||
|
||||
if ( $info['club_id'] )
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_clubs_node_map', array(
|
||||
'club_id' => $info['club_id'],
|
||||
'node_class' => "IPS\\forums\\Forum",
|
||||
'node_id' => $inserted_id,
|
||||
'name' => $name
|
||||
) );
|
||||
|
||||
\IPS\forums\Forum::load( $inserted_id )->setPermissionsToClub( \IPS\Member\Club::load( $info['club_id'] ) );
|
||||
}
|
||||
|
||||
return $inserted_id;
|
||||
}
|
||||
|
||||
@@ -1971,4 +2067,52 @@ class _Forums extends Core
|
||||
|
||||
return parent::convertAttachment( $info, $map, $filepath, $filedata );
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Club Forum
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted forum, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubForum( $info=array() )
|
||||
{
|
||||
$insertedId = $this->convertForumsForum( $info );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['id'], 'core_clubs_forums' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Club Topic
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted topic, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubTopic( $info=array() )
|
||||
{
|
||||
$insertedId = $this->convertForumsTopic( $info );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['tid'], 'core_clubs_topics' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Club Post
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted post, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubPost( $info=array() )
|
||||
{
|
||||
$insertedId = $this->convertForumsPost( $info );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['pid'], 'core_clubs_posts' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Library Gallery Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -119,6 +119,54 @@ class _Gallery extends Core
|
||||
'link_type' => 'gallery_reviews',
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertClubGalleryCategories':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_gallery_categories',
|
||||
'step_method' => 'convertClubGalleryCategories',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'gallery_categories', array( "category_club_id IS NOT NULL" ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 1000,
|
||||
'dependencies' => array( 'convertGalleryImages' ),
|
||||
'link_type' => 'core_club_gallery_categories'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertClubGalleryImages':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_gallery_images',
|
||||
'step_method' => 'convertClubGalleryImages',
|
||||
'ips_rows' => (int) \IPS\Db::i()->select( 'SUM(category_count_imgs)', 'gallery_categories', array( "category_club_id IS NOT NULL" ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => array( 'convertClubGalleryCategories' ),
|
||||
'link_type' => 'core_club_gallery_images'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertClubGalleryComments':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_gallery_comments',
|
||||
'step_method' => 'convertClubGalleryComments',
|
||||
'ips_rows' => (int) \IPS\Db::i()->select( 'SUM(category_count_comments)', 'gallery_categories', array( "category_club_id IS NOT NULL" ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 1000,
|
||||
'dependencies' => array( 'convertClubGalleryImages' ),
|
||||
'link_type' => 'core_club_gallery_comments'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertClubGalleryReviews':
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_club_gallery_reviews',
|
||||
'step_method' => 'convertClubGalleryReviews',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'gallery_reviews', array( \IPS\Db::i()->in( 'review_image_id', \IPS\Db::i()->select( 'image_id', 'gallery_images', array( \IPS\Db::i()->in( 'image_category_id', \IPS\Db::i()->select( 'category_id', 'gallery_categories', array( "category_club_id IS NOT NULL" ) ) ) ) ) ) ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 1000,
|
||||
'dependencies' => array( 'convertClubGalleryImages' ),
|
||||
'link_type' => 'core_club_gallery_reviews'
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertAttachments':
|
||||
$dependencies = array( 'convertGalleryImages' );
|
||||
@@ -169,7 +217,7 @@ class _Gallery extends Core
|
||||
switch( $k )
|
||||
{
|
||||
case 'convertGalleryCategories':
|
||||
$return['convertGalleryCategories'] = array( 'gallery_categories' => NULL );
|
||||
$return['convertGalleryCategories'] = array( 'gallery_categories' => NULL, 'core_clubs_node_map' => array( "node_class=?", "IPS\\gallery\\Category" ) );
|
||||
break;
|
||||
|
||||
case 'convertGalleryAlbums':
|
||||
@@ -191,6 +239,22 @@ class _Gallery extends Core
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments'] = array( 'core_attachments' => \IPS\Db::i()->select( 'attachment_id', 'core_attachments_map', array( "location_key=?", 'gallery_Gallery' ) ), 'core_attachments_map' => array( 'location_key=?', 'gallery_Gallery' ) );
|
||||
break;
|
||||
|
||||
case 'convertClubGalleryCategories':
|
||||
$return['convertClubGalleryCategories'] = array( 'gallery_categories' => array( "category_club_id IS NOT NULL" ) );
|
||||
break;
|
||||
|
||||
case 'convertClubGalleryImages':
|
||||
$return['convertClubGalleryImages'] = array( 'gallery_images' => array( 'image_id IN ( ' . (string) \IPS\Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_gallery_images' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
|
||||
case 'convertClubGalleryComments':
|
||||
$return['convertClubGalleryComments'] = array( 'gallery_comments' => array( 'comment_id IN ( ' . (string) \IPS\Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_gallery_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
|
||||
case 'convertClubGalleryReviews':
|
||||
$return['convertClubGalleryReviews'] = array( 'gallery_reviews' => array( 'review_id IN ( ' . (string) \IPS\Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_gallery_reviews' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,6 +376,22 @@ class _Gallery extends Core
|
||||
$info['category_position'] = $position + 1;
|
||||
}
|
||||
|
||||
if ( isset( $info['category_club_id'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$info['category_club_id'] = $this->software->app->getLink( $info['category_club_id'], 'core_clubs', TRUE );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$info['category_club_id'] = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$info['category_club_id'] = NULL;
|
||||
}
|
||||
|
||||
$id = $info['category_id'];
|
||||
unset( $info['category_id'] );
|
||||
|
||||
@@ -323,6 +403,18 @@ class _Gallery extends Core
|
||||
|
||||
\IPS\Db::i()->update( 'gallery_categories', array( "category_parent_id" => $inserted_id ), array( "category_conv_parent=? AND category_conv_parent<>?", $id, 0 ) );
|
||||
|
||||
if ( $info['category_club_id'] )
|
||||
{
|
||||
\IPS\Db::i()->insert( 'core_clubs_node_map', array(
|
||||
'node_id' => $inserted_id,
|
||||
'node_class' => "IPS\\gallery\\Category",
|
||||
'club_id' => $info['category_club_id'],
|
||||
'name' => $name
|
||||
) );
|
||||
|
||||
\IPS\gallery\Category::load( $inserted_id )->setPermissionsToClub( \IPS\Member\Club::load( $info['category_club_id'] ) );
|
||||
}
|
||||
|
||||
return $inserted_id;
|
||||
}
|
||||
|
||||
@@ -658,6 +750,12 @@ class _Gallery extends Core
|
||||
{
|
||||
if ( is_null( $filedata ) AND !is_null( $filepath ) )
|
||||
{
|
||||
if( !file_exists( $filepath ) )
|
||||
{
|
||||
$this->software->app->log( 'gallery_image_missing_file', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['image_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$filedata = file_get_contents( $filepath );
|
||||
}
|
||||
$image = \IPS\File::create( 'gallery_Images', $info['image_file_name'], $filedata );
|
||||
@@ -1178,4 +1276,70 @@ class _Gallery extends Core
|
||||
|
||||
return parent::convertAttachment( $info, $map, $filepath, $filedata );
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Club Gallery Category
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted category, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubGalleryCategory( $info=array() )
|
||||
{
|
||||
$insertedId = $this->convertGalleryCategory( $info );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['category_id'], 'core_clubs_gallery_categories' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Club Gallery Image
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @param string|NULL $filepath The path to the image, or NULL.
|
||||
* @param string|NULL $fileinfo The binary data for the image, or NULL
|
||||
* @return integer|boolean The ID of the newly inserted image, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubGalleryImage( $info=array(), $filepath=NULL, $filedata=NULL )
|
||||
{
|
||||
$insertedId = $this->convertGalleryImage( $info, $filepath, $filedata );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['image_id'], 'core_club_gallery_images' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Club Gallery Comment
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubGalleryComment( $info=array() )
|
||||
{
|
||||
$insertedId = $this->convertGalleryComment( $info );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['comment_id'], 'core_club_gallery_comments' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Club Gallery Review
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted review, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubGalleryReview( $info=array() )
|
||||
{
|
||||
$insertedId = $this->convertGalleryReview( $info );
|
||||
if ( $insertedId )
|
||||
{
|
||||
$this->software->app->addLink( $insertedId, $info['review_id'], 'core_club_gallery_reviews' );
|
||||
}
|
||||
return $insertedId;
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Library Nexus Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 6 May 2016
|
||||
*/
|
||||
@@ -85,7 +85,7 @@ class _Nexus extends \IPS\convert\Library
|
||||
$return[ $k ] = array(
|
||||
'step_title' => 'convert_nexus_customer_history',
|
||||
'step_method' => 'convertNexusCustomerHistory',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'nexus_customer_history' )->first(),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_member_history', array( 'log_app=?', 'nexus' ) )->first(),
|
||||
'source_rows' => $this->software->countRows( $v['table'], $v['where'] ),
|
||||
'per_cycle' => 2000,
|
||||
'dependencies' => array( 'convertNexusCustomers' ),
|
||||
@@ -356,7 +356,7 @@ class _Nexus extends \IPS\convert\Library
|
||||
break;
|
||||
|
||||
case 'convertNexusCustomerHistory':
|
||||
$return['convertNexusCustomerHistory'] = array( 'nexus_customer_history' => NULL );
|
||||
$return['convertNexusCustomerHistory'] = array( 'core_member_history' => array( 'log_app=?', 'nexus' ) );
|
||||
break;
|
||||
|
||||
case 'convertNexusAlternateContacts':
|
||||
|
||||
Whitespace-only changes.
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Software Core Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -204,7 +204,7 @@ abstract class _Software
|
||||
}
|
||||
|
||||
/**
|
||||
* Can we translate settings over to our IPS4 equivalents?
|
||||
* Can we translate settings over to our Invision Community equivalents?
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
@@ -401,7 +401,7 @@ abstract class _Software
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates Posted Content to work with the IPS4 parser.
|
||||
* Updates Posted Content to work with the parser.
|
||||
*
|
||||
* @param string The post
|
||||
* @return string The converted post
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter vBulletin 4.x Blog Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -599,22 +599,15 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$attach_id = $libraryClass->convertAttachment( $info, $map, $path, $data );
|
||||
|
||||
/* Do some re-jiggery on the post itself to make sure attachment displays */
|
||||
$ourAttachment = \IPS\File::get( 'core_Attachment', \IPS\Db::i()->select( 'attach_location', 'core_attachments', array( 'attach_id=?', $attach_id ) )->first() );
|
||||
|
||||
$entry_id = $this->app->getLink( $attachment[ $column ], 'blog_entries' );
|
||||
|
||||
$post = \IPS\Db::i()->select( 'entry_content', 'blog_entries', array( "entry_id=?", $entry_id ) )->first();
|
||||
|
||||
if ( preg_match( "/\[ATTACH(.+?)?\]".$attachment['attachmentid']."\[\/ATTACH\]/i", $post ) )
|
||||
{
|
||||
$post = preg_replace( "/\[ATTACH=(.+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", '<p><a href="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attach_id . '" src="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>', $post );
|
||||
$post = preg_replace( "/\[ATTACH=(.+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", '[attachment=' . $attach_id . ':name]', $post );
|
||||
\IPS\Db::i()->update( 'blog_entries', array( 'entry_content' => $post ), array( "entry_id=?", $entry_id ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$post .= '<p><a href="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attach_id . '" src="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>';
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'blog_entries', array( 'entry_content' => $post ), array( "entry_id=?", $entry_id ) );
|
||||
|
||||
$libraryClass->setLastKeyValue( $attachment['attachmentid'] );
|
||||
}
|
||||
|
||||
Whitespace-only changes.
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter MyBB Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter vBulletin 4.x Calendar Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
Whitespace-only changes.
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Joomla Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter vBulletin 4.x Pages Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -20,6 +20,16 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
class _Vbulletin extends \IPS\convert\Software
|
||||
{
|
||||
/**
|
||||
* @brief The schematic for vB3 and vB4 is similar enough that we can make specific concessions in a single converter for either version.
|
||||
*/
|
||||
protected static $isLegacy = NULL;
|
||||
|
||||
/**
|
||||
* @brief Cached article content type
|
||||
*/
|
||||
protected static $_articleContentType = NULL;
|
||||
|
||||
/**
|
||||
* Software Name
|
||||
*
|
||||
@@ -41,6 +51,52 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
/* Child classes must override this method */
|
||||
return "vbulletin";
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\convert\App $app The application to reference for database and other information.
|
||||
* @param bool $needDB Establish a DB connection
|
||||
* @return void
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct( \IPS\convert\App $app, $needDB=TRUE )
|
||||
{
|
||||
$return = parent::__construct( $app, $needDB );
|
||||
|
||||
/* Is this vB3 or vB4? */
|
||||
try
|
||||
{
|
||||
if ( static::$isLegacy === NULL AND $needDB )
|
||||
{
|
||||
$version = $this->db->select('value', 'setting', array("varname=?", 'templateversion'))->first();
|
||||
|
||||
if (mb_substr($version, 0, 1) == '3') {
|
||||
static::$isLegacy = TRUE;
|
||||
} else {
|
||||
static::$isLegacy = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* If this is vB4, what is the content type ID for the cms? */
|
||||
if ( static::$_articleContentType === NULL AND ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) AND $needDB )
|
||||
{
|
||||
try
|
||||
{
|
||||
static::$_articleContentType = $this->db->select( 'contenttypeid', 'contenttype', array( "class=?", 'Article' ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
static::$_articleContentType = 24; # default
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch( \Exception $e ) {}
|
||||
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content we can convert from this software.
|
||||
@@ -70,6 +126,10 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'table' => 'cms_article',
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertAttachments' => array(
|
||||
'table' => 'attachment',
|
||||
'where' => array( "contenttypeid=?", static::$_articleContentType )
|
||||
)
|
||||
);
|
||||
|
||||
return $return;
|
||||
@@ -101,7 +161,6 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
case 'database':
|
||||
return 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
return parent::countRows( $table, $where, $recache );
|
||||
break;
|
||||
@@ -355,7 +414,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
{
|
||||
try
|
||||
{
|
||||
$node = $this->db->select( '*', 'cms_node', array( "contenttypeid=? AND contentid=?", $this->_articleContentType(), $row['contentid'] ) )->first();
|
||||
$node = $this->db->select( '*', 'cms_node', array( "contenttypeid=? AND contentid=?", static::$_articleContentType, $row['contentid'] ) )->first();
|
||||
$nodeinfo = $this->db->select( '*', 'cms_nodeinfo', array( "nodeid=?", $node['nodeid'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
@@ -436,38 +495,160 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\cms\Categories' . $database, 'count' => 0 ), 5, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\cms\Records'. $database ), 3, array( 'class' ) );
|
||||
|
||||
// This converter doesn't support tags at this time, uncomment when it does.
|
||||
//\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 3, array( 'app', 'link', 'class' ) );
|
||||
// Uncomment this once Tags are implemented for the cms;
|
||||
# \IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 3, array( 'app', 'link', 'class' ) );
|
||||
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 2, array( 'app', 'link', 'class' ) );
|
||||
}
|
||||
|
||||
return array( "f_recount_cms_categories", "f_rebuild_cms_tags" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Cached article content type
|
||||
*/
|
||||
protected $_articleContentType = NULL;
|
||||
|
||||
/**
|
||||
* Return the article content type
|
||||
* Convert attachments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _articleContentType()
|
||||
public function convertAttachments()
|
||||
{
|
||||
if ( $this->_articleContentType === NULL )
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'attachmentid' );
|
||||
|
||||
$where = NULL;
|
||||
$column = NULL;
|
||||
|
||||
if ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) )
|
||||
{
|
||||
$where = array( "contenttypeid=?", static::$_articleContentType );
|
||||
$column = 'contentid';
|
||||
$table = 'attachment';
|
||||
}
|
||||
|
||||
foreach( $this->fetch( $table, 'attachmentid', $where ) as $attachment )
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->_articleContentType = $this->db->select( 'contenttypeid', 'contenttype', array( "class=?", 'Article' ) )->first();
|
||||
{
|
||||
$vbRecordId = $this->db->select( 'contentid', 'cms_article', array( "contentid=?", $attachment[ $column ] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$this->_articleContentType = 24; # default
|
||||
/* Log this so that it's easier to diagnose */
|
||||
$this->app->log( 'attachment_vbcms_missing_parent', __METHOD__, \IPS\convert\App::LOG_WARNING, $attachment['attachmentid'] );
|
||||
|
||||
/* If the record is missing, there isn't much we can do. */
|
||||
$libraryClass->setLastKeyValue( $attachment['attachmentid'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) )
|
||||
{
|
||||
$filedata = $this->db->select( '*', 'filedata', array( "filedataid=?", $attachment['filedataid'] ) )->first();
|
||||
}
|
||||
else
|
||||
{
|
||||
$filedata = $attachment;
|
||||
$filedata['filedataid'] = $attachment['attachmentid'];
|
||||
}
|
||||
|
||||
$map = array(
|
||||
'id1' => $vbRecordId,
|
||||
'id2' => NULL,
|
||||
'id3' => 1
|
||||
);
|
||||
|
||||
$info = array(
|
||||
'attach_id' => $attachment['attachmentid'],
|
||||
'attach_file' => $attachment['filename'],
|
||||
'attach_date' => $attachment['dateline'],
|
||||
'attach_member_id' => $attachment['userid'],
|
||||
'attach_hits' => $attachment['counter'],
|
||||
'attach_ext' => $filedata['extension'],
|
||||
'attach_filesize' => $filedata['filesize'],
|
||||
);
|
||||
|
||||
if ( $this->app->_session['more_info']['convertAttachments']['file_location'] == 'database' )
|
||||
{
|
||||
/* Simples! */
|
||||
$data = $filedata['filedata'];
|
||||
$path = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = NULL;
|
||||
$path = implode( '/', preg_split( '//', $filedata['userid'], -1, PREG_SPLIT_NO_EMPTY ) );
|
||||
$path = rtrim( $this->app->_session['more_info']['convertAttachments']['file_location'], '/' ) . '/' . $path . '/' . $attachment['filedataid'] . '.attach';
|
||||
}
|
||||
|
||||
$attach_id = $libraryClass->convertAttachment( $info, $map, $path, $data );
|
||||
|
||||
/* Do some re-jiggery on the post itself to make sure attachment displays */
|
||||
/* The database is hardcoded to 1 while the conversion, so we have to use 1 here */
|
||||
$dbId = $this->app->getLink( 1, 'cms_databases' );
|
||||
$dbName = "cms_custom_database_" . $dbId;
|
||||
|
||||
try
|
||||
{
|
||||
$recordId = $this->app->getLink( $attachment[ $column ], 'cms_custom_database_' . $dbId );
|
||||
|
||||
/* Get the database object */
|
||||
$ipsDb = \IPS\cms\Databases::load( $dbId);
|
||||
|
||||
$post = \IPS\Db::i()->select( $ipsDb->field_content, $dbName, array( "primary_id_field=?", $recordId ) )->first();
|
||||
|
||||
if ( preg_match( "/\[ATTACH(.+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", $post ) )
|
||||
{
|
||||
$post = preg_replace( "/\[ATTACH=(.+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", '[attachment=' . $attach_id . ':name]', $post );
|
||||
\IPS\Db::i()->update( $dbName, array( 'field_2' => $post ), array( "primary_id_field=?", $recordId ) );
|
||||
}
|
||||
}
|
||||
catch( \OutOfRangeException $e ) { }
|
||||
|
||||
$libraryClass->setLastKeyValue( $attachment['attachmentid'] );
|
||||
}
|
||||
|
||||
return $this->_articleContentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of conversion methods that require additional information
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function checkConf()
|
||||
{
|
||||
return array( 'convertAttachments' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get More Information
|
||||
*
|
||||
* @param string $method Conversion method
|
||||
* @return array
|
||||
*/
|
||||
public function getMoreInfo( $method )
|
||||
{
|
||||
$return = array();
|
||||
switch( $method )
|
||||
{
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments'] = array(
|
||||
'file_location' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => 'database',
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array(
|
||||
'options' => array(
|
||||
'database' => \IPS\Member::loggedIn()->language()->addToStack( 'database' ),
|
||||
'file_system' => \IPS\Member::loggedIn()->language()->addToStack( 'file_system' ),
|
||||
),
|
||||
'userSuppliedInput' => 'file_system',
|
||||
),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => function( $value ) { if ( $value != 'database' AND !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
return ( isset( $return[ $method ] ) ) ? $return[ $method ] : array();
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Wordpress Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter XenForo Page Nodes Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter XenForoRm Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
Whitespace-only changes.
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter ExpressionEngine Master Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 14 June 2016
|
||||
*/
|
||||
@@ -334,13 +334,11 @@ class _Expressionengine extends \IPS\convert\Software
|
||||
{
|
||||
if ( $attachId !== FALSE )
|
||||
{
|
||||
$ourAttachment = \IPS\File::get( 'core_Signature', \IPS\Db::i()->select( 'attach_location', 'core_attachments', array( 'attach_id=?', $attachId ) )->first() );
|
||||
|
||||
$memberId = $this->app->getLink( $row['member_id'], 'core_members' );
|
||||
|
||||
$signature = \IPS\Db::i()->select( 'signature', 'core_members', array( "member_id=?", $memberId ) )->first();
|
||||
|
||||
$signature .= '<p><a href="<fileStore.core_Signature>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attachId . '" src="<fileStore.core_Signature>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>';
|
||||
$signature .= '[attachment=' . $attachId . ':name]';
|
||||
|
||||
\IPS\Db::i()->update( 'core_members', array( 'signature' => $signature ), array( "member_id=?", $memberId ) );
|
||||
}
|
||||
@@ -413,6 +411,15 @@ class _Expressionengine extends \IPS\convert\Software
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['group_id'] );
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
$libraryClass->convertGroupPromotion( $groupPromotion );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -671,13 +678,11 @@ class _Expressionengine extends \IPS\convert\Software
|
||||
{
|
||||
if ( $attachId !== FALSE )
|
||||
{
|
||||
$ourAttachment = \IPS\File::get( 'core_Attachment', \IPS\Db::i()->select( 'attach_location', 'core_attachments', array( 'attach_id=?', $attachId ) )->first() );
|
||||
|
||||
$pmId = $this->app->getLink( $row['message_id'], 'core_message_posts' );
|
||||
|
||||
$message = \IPS\Db::i()->select( 'msg_post', 'core_message_posts', array( "msg_id=?", $pmId ) )->first();
|
||||
|
||||
$message .= '<p><a href="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attachId . '" src="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>';
|
||||
$message .= '[attachment=' . $attachId . ':name]';
|
||||
|
||||
\IPS\Db::i()->update( 'core_message_posts', array( 'msg_post' => $message ), array( "msg_id=?", $pmId ) );
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Joomla Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -169,6 +169,15 @@ class _Joomla extends \IPS\convert\Software
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['id'] );
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
$libraryClass->convertGroupPromotion( $groupPromotion );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter MyBB Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -663,6 +663,15 @@ class _Mybb extends \IPS\convert\Software
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['gid'] );
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
$libraryClass->convertGroupPromotion( $groupPromotion );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Photopost Core Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 6 December 2016
|
||||
* @note Only redirect scripts are supported right now
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter phpBB Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -359,6 +359,9 @@ class _Phpbb extends \IPS\convert\Software
|
||||
/* Sort out emoticons */
|
||||
$post = preg_replace("/<!-- s(\S+?) --><img(?:[^<]+?)<!-- (?:\S+?) -->/", '$1', $post);
|
||||
|
||||
/* Sort out media */
|
||||
$post = preg_replace("#<!-- m --><a class=\"postlink\" href=\"([^\]]+?)\"([^>]+?)?>([^\]]+?)</a><!-- m -->#i", "$1", $post);
|
||||
|
||||
/* And sort out URLs */
|
||||
$post = preg_replace("#<a class=\"postlink\" href=\"([^\]]+?)\"([^>]+?)?>([^\]]+?)</a>#i", "[url=$1]$3[/url]", $post);
|
||||
|
||||
@@ -523,6 +526,16 @@ class _Phpbb extends \IPS\convert\Software
|
||||
$merge = ( $this->app->_session['more_info']['convertGroups']["map_group_{$row['group_id']}"] != 'none' ) ? $this->app->_session['more_info']['convertGroups']["map_group_{$row['group_id']}"] : NULL;
|
||||
|
||||
$libraryClass->convertGroup( $info, $merge );
|
||||
$libraryClass->setLastKeyValue( $row['group_id'] );
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
$libraryClass->convertGroupPromotion( $groupPromotion );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -737,14 +750,25 @@ class _Phpbb extends \IPS\convert\Software
|
||||
$data = array( 0 => NULL );
|
||||
}
|
||||
|
||||
$libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warn['warning_id'],
|
||||
'wl_member' => $warn['user_id'],
|
||||
'wl_moderator' => $log['user_id'],
|
||||
'wl_date' => $warn['warning_time'],
|
||||
'wl_points' => 1,
|
||||
'wl_note_member' => isset( $data[0] ) ? $data[0] : NULL,
|
||||
) );
|
||||
$warnId = $libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warn['warning_id'],
|
||||
'wl_member' => $warn['user_id'],
|
||||
'wl_moderator' => $log['user_id'],
|
||||
'wl_date' => $warn['warning_time'],
|
||||
'wl_points' => 1,
|
||||
'wl_note_member' => isset( $data[0] ) ? $data[0] : NULL,
|
||||
) );
|
||||
|
||||
/* Add a member history record for this member */
|
||||
$libraryClass->convertMemberHistory( array(
|
||||
'log_id' => 'w' . $warn['warning_id'],
|
||||
'log_member' => $warn['user_id'],
|
||||
'log_by' => $log['user_id'],
|
||||
'log_type' => 'warning',
|
||||
'log_data' => array( 'wid' => $warnId ),
|
||||
'log_date' => $warn['warning_time']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['user_id'] );
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter PhpMyForum Core Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 6 December 2016
|
||||
* @note Only redirect scripts are supported right now
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Punbb Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -237,6 +237,15 @@ class _Punbb extends \IPS\convert\Software
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['g_id'], $merge );
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
$libraryClass->convertGroupPromotion( $groupPromotion );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Converter Smf 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
|
||||
@@ -318,7 +318,7 @@ class _Smf extends \IPS\convert\Software
|
||||
$post = str_replace( $search, $replace, $post );
|
||||
|
||||
// And img tags
|
||||
$post = preg_replace("#\[img width=(\d+) height=(\d+)\]([a-zA-Z0-9.:\-/]+)\[\/img\]#i", "[img]$3[/img]", $post);
|
||||
$post = preg_replace("#\[img width=(\d+)(?: height=(\d+))?\]([a-zA-Z0-9.:\-/%\?&_]+)\[\/img\]#i", "[img]$3[/img]", $post);
|
||||
|
||||
//Quotes
|
||||
$post = preg_replace("#\[quote author=(.+?) link=(.+?)=(\d+)\.msg(\d+)(.+?)date=(\d+)\](.+)\[\/quote\]#i", "[quote name=\"$1\" post=\"$4\" timestamp=\"$6\"]$7[/quote]", $post);
|
||||
@@ -360,7 +360,7 @@ class _Smf extends \IPS\convert\Software
|
||||
$libraryClass->convertBanfilter( array(
|
||||
'ban_id' => $row['id_ban'],
|
||||
'ban_type' => 'email',
|
||||
'ban_content' => $row['email_address'],
|
||||
'ban_content' => str_replace( '%' ,'*', $row['email_address'] ),
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -579,6 +579,15 @@ class _Smf extends \IPS\convert\Software
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['id_group'] );
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
$libraryClass->convertGroupPromotion( $groupPromotion );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -654,7 +663,7 @@ class _Smf extends \IPS\convert\Software
|
||||
'bday_month' => $bday_month,
|
||||
'bday_year' => $bday_year,
|
||||
'mgroup_others' => $row['additional_groups'],
|
||||
'signature' => $row['signature'],
|
||||
'signature' => static::fixPostData( $row['signature'] ),
|
||||
'pp_reputation_points' => $row['karma_good'] - $row['karma_bad'],
|
||||
'timezone' => $row['time_offset'],
|
||||
'allow_admin_mails' => $row['notify_announcements'],
|
||||
@@ -787,7 +796,7 @@ class _Smf extends \IPS\convert\Software
|
||||
/* Clean filename per legacy SMF requirements */
|
||||
$cleanName = strtr( $attach['filename'], 'ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ', 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');
|
||||
$cleanName = strtr( $cleanName, array( 'Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u' ) );
|
||||
$cleanName = preg_replace( array( '/s/', '/[^w_.-]/' ), array( '_', '' ), $cleanName );
|
||||
$cleanName = preg_replace( array('/\s/', '/[^\w_\.\-]/'), array('_', ''), $cleanName );
|
||||
$location = $attach['id_attach'] . '_' . str_replace( '.', '_', $cleanName ) . md5( $cleanName );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Converter UBBthreads 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
|
||||
@@ -433,6 +433,15 @@ class _UBBthreads extends \IPS\convert\Software
|
||||
$libraryClass->convertGroup( $info, $merge );
|
||||
$libraryClass->setLastKeyValue( $row['GROUP_ID'] );
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
$libraryClass->convertGroupPromotion( $groupPromotion );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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\Core;
|
||||
@@ -53,25 +52,68 @@ class _Vanilla extends \IPS\convert\Software
|
||||
* @param \IPS\convert\App The application to reference for database and other information.
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct( \IPS\convert\App $app )
|
||||
public function __construct( \IPS\convert\App $app, $needDB=TRUE )
|
||||
{
|
||||
$return = parent::__construct( $app );
|
||||
$return = parent::__construct( $app, $needDB );
|
||||
|
||||
/* What is the activity type ID for status updates? */
|
||||
if ( static::$activityStatusType === NULL )
|
||||
if ( $needDB )
|
||||
{
|
||||
try
|
||||
/* What is the activity type ID for status updates? */
|
||||
if ( static::$activityStatusType === NULL )
|
||||
{
|
||||
static::$activityStatusType = $this->db->select( 'ActivityTypeID', 'ActivityType',
|
||||
array( 'Name=?', 'Status' ), NULL, 1
|
||||
)->first();
|
||||
try
|
||||
{
|
||||
static::$activityStatusType = $this->db->select( 'ActivityTypeID', 'ActivityType',
|
||||
array( 'Name=?', 'Status' ), NULL, 1
|
||||
)->first();
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
}
|
||||
catch ( \Exception $e ) {}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can we convert settings?
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canConvertSettings()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings Map Listing
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function settingsMapList()
|
||||
{
|
||||
$settings = array(
|
||||
'fluid' => array( 'title' => \IPS\Member::loggedIn()->language()->addToStack( 'use_fluid_view_convert' ), 'value' => true, 'our_key' => 'use_fluid_view_convert', 'our_title' => \IPS\Member::loggedIn()->language()->addToStack( 'use_fluid_view_convert' ) )
|
||||
);
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert one or more settings
|
||||
*
|
||||
* @param array $settings Settings to convert
|
||||
* @return void
|
||||
*/
|
||||
public function convertSettings( $settings=array() )
|
||||
{
|
||||
if ( !isset( $settings['use_fluid_view_convert'] ) OR $settings['use_fluid_view_convert'] == FALSE )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 'fluid' ), array( "conf_key=?", 'forums_default_view' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the filesystem location of a file from a path stored in the database
|
||||
* There are several different ways Vanilla may store these, including as remote URL's
|
||||
@@ -154,10 +196,6 @@ class _Vanilla extends \IPS\convert\Software
|
||||
'table' => 'User',
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertRemoteAvatars' => array(
|
||||
'table' => NULL,
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertStatuses' => array(
|
||||
'table' => 'Activity',
|
||||
'where' => array( 'ActivityTypeId=?', (int) static::$activityStatusType )
|
||||
@@ -331,6 +369,15 @@ class _Vanilla extends \IPS\convert\Software
|
||||
$libraryClass->convertGroup( $info, $merge );
|
||||
$libraryClass->setLastKeyValue( $row['RoleID'] );
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
$libraryClass->convertGroupPromotion( $groupPromotion );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -470,7 +517,7 @@ class _Vanilla extends \IPS\convert\Software
|
||||
'mt_date' => static::mysqlToDateTime( $row['DateInserted'] ),
|
||||
'mt_starter_id' => $row['InsertUserID'],
|
||||
'mt_last_post_time' => static::mysqlToDateTime( $row['DateUpdated'] ),
|
||||
'mt_to_count' => $row['CountParticipants'],
|
||||
'mt_to_count' => ( isset( $row['CountParticipants'] ) ) ? $row['CountParticipants'] : count( \unserialize( $row['Contributors'] ) ),
|
||||
'mt_replies' => $row['CountMessages'],
|
||||
);
|
||||
|
||||
@@ -490,7 +537,7 @@ class _Vanilla extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
$libraryClass->convertPrivateMessage( $topicInfo, $maps );
|
||||
$libraryClass->setLastKeyValue( $row['MessageID'] );
|
||||
$libraryClass->setLastKeyValue( $row['ConversationID'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter vBulletin 4.x Master Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -128,6 +128,10 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'table' => 'user',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertMemberHistory' => array(
|
||||
'table' => 'userchangelog',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertStatuses' => array(
|
||||
'table' => 'visitormessage',
|
||||
'where' => NULL
|
||||
@@ -151,6 +155,14 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'convertRanks' => array(
|
||||
'table' => 'usertitle',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertClubs' => array(
|
||||
'table' => 'socialgroup',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertClubMembers' => array(
|
||||
'table' => 'socialgroupmember',
|
||||
'where' => NULL
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -244,6 +256,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'convertProfileFields',
|
||||
'convertGroups',
|
||||
'convertMembers',
|
||||
'convertClubs'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -419,6 +432,24 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'convertClubs':
|
||||
$return['convertClubs'] = array();
|
||||
$return['convertClubs']['photo_location'] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => 'database',
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array(
|
||||
'options' => array(
|
||||
'database' => \IPS\Member::loggedIn()->language()->addToStack( 'database' ),
|
||||
'file_system' => \IPS\Member::loggedIn()->language()->addToStack( 'file_system' ),
|
||||
),
|
||||
'userSuppliedInput' => 'file_system',
|
||||
),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => function( $value ) { if ( $value != 'database' AND !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
return ( isset( $return[ $method ] ) ) ? $return[ $method ] : array();
|
||||
@@ -816,7 +847,6 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'g_bitoptions' => array(
|
||||
'gbw_promote_unit_type' => $gbw_promote_unit, // Type of group promotion to use. 1 is days since joining, 0 is content count. Corresponds to g_promotion
|
||||
'gbw_no_status_update' => !$checkpermission( 'visitormessagepermissions', 'canmessageownprofile' ), // Can NOT post status updates
|
||||
'gbw_soft_delete_own' => $checkpermission( 'forumpermissions', 'candeletepost' ), // Allow users of this group to hide their own submitted content
|
||||
'gbw_allow_upload_bgimage' => 1, // Can upload a cover photo?
|
||||
'gbw_view_reps' => $checkpermission( 'genericpermissions2', 'canprofilerep' ), // Can view who gave reputation?
|
||||
'gbw_no_status_import' => !$checkpermission( 'visitormessagepermissions', 'canmessageownprofile' ), // Can NOT import status updates from Facebook/Twitter
|
||||
@@ -825,6 +855,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'gbw_pm_override_inbox_full'=> $checkpermission( 'pmpermissions', 'canignorequota' ), // 1 means this group can send other members PMs even when that member's inbox is full
|
||||
'gbw_cannot_be_ignored' => ( ( $checkpermission( 'adminpermissions', 'ismoderator' ) OR $checkpermission( 'adminpermissions', 'cancontrolpanel' ) ) AND $this->_setting( 'ignoremods' ) ), // 1 means they cannot be ignored. 0 means they can
|
||||
),
|
||||
'g_hide_own_posts' => $checkpermission( 'forumpermissions', 'candeletepost' ),
|
||||
'g_pm_flood_mins' => $this->_setting( 'pmfloodtime' ) / 60,
|
||||
'g_post_polls' => $checkpermission( 'forumpermissions', 'canpostpoll' ) ? 1 : 0,
|
||||
'g_vote_polls' => $checkpermission( 'forumpermissions', 'canvote' ) ? 1 : 0,
|
||||
@@ -837,6 +868,81 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
|
||||
$libraryClass->setLastKeyValue( $group['usergroupid'] );
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
$libraryClass->convertGroupPromotion( $groupPromotion );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Member history type map
|
||||
*/
|
||||
protected $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'member_group_id', 'membergroupids' => 'mgroup_others' );
|
||||
|
||||
/**
|
||||
* Convert member history
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertMemberHistory()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'changeid' );
|
||||
|
||||
$fixGroups = function( $string )
|
||||
{
|
||||
$groups = explode( ',', $string );
|
||||
$newGroups = array();
|
||||
|
||||
array_walk( $groups, function( &$item, $key ) use ( &$newGroups )
|
||||
{
|
||||
try
|
||||
{
|
||||
$item = $this->app->getLink( $item, 'core_groups' );
|
||||
$newGroups[] = $item;
|
||||
}
|
||||
catch( \OutOfRangeException $e ){}
|
||||
});
|
||||
|
||||
return implode( ',', $newGroups );
|
||||
};
|
||||
|
||||
foreach( $this->fetch( 'userchangelog', 'changeid' ) AS $change )
|
||||
{
|
||||
if( !in_array( $change['fieldname'], array_keys( $this->changeLogTypes ) ) )
|
||||
{
|
||||
$libraryClass->setLastKeyValue( $change['changeid'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Any processing we need to do */
|
||||
switch( $this->changeLogTypes[ $change['fieldname'] ] )
|
||||
{
|
||||
case 'member_group_id':
|
||||
case 'mgroup_others':
|
||||
$change['oldvalue'] = $fixGroups( $change['oldvalue'] );
|
||||
$change['newvalue'] = $fixGroups( $change['newvalue'] );
|
||||
break;
|
||||
}
|
||||
|
||||
$libraryClass->convertMemberHistory( array(
|
||||
'log_id' => $change['changeid'],
|
||||
'log_member' => $change['userid'],
|
||||
'log_by' => $change['adminid'],
|
||||
'log_type' => $this->changeLogTypes[ $change['fieldname'] ],
|
||||
'log_data' => array( 'old' => $change['oldvalue'], 'new' => $change['newvalue'] ),
|
||||
'log_date' => $change['change_time']
|
||||
)
|
||||
);
|
||||
|
||||
$libraryClass->setLastKeyValue( $change['changeid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1152,15 +1258,26 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
/* And warn logs made on the profile - we'll do content specific later */
|
||||
foreach( $this->db->select( '*', 'infraction', array( "userid=? AND postid=?", $user['userid'], 0 ) ) AS $warn )
|
||||
{
|
||||
$libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warn['infractionid'],
|
||||
'wl_member' => $warn['userid'],
|
||||
'wl_moderator' => $warn['whoadded'],
|
||||
'wl_date' => $warn['dateline'],
|
||||
'wl_points' => $warn['points'],
|
||||
'wl_note_member' => $warn['note'],
|
||||
'wl_note_mods' => $warn['customreason'],
|
||||
) );
|
||||
$warnId = $libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warn['infractionid'],
|
||||
'wl_member' => $warn['userid'],
|
||||
'wl_moderator' => $warn['whoadded'],
|
||||
'wl_date' => $warn['dateline'],
|
||||
'wl_points' => $warn['points'],
|
||||
'wl_note_member' => $warn['note'],
|
||||
'wl_note_mods' => $warn['customreason'],
|
||||
) );
|
||||
|
||||
/* Add a member history record for this member */
|
||||
$libraryClass->convertMemberHistory( array(
|
||||
'log_id' => 'w' . $warn['infractionid'],
|
||||
'log_member' => $warn['userid'],
|
||||
'log_by' => $warn['whoadded'],
|
||||
'log_type' => 'warning',
|
||||
'log_data' => array( 'wid' => $warnId ),
|
||||
'log_date' => $warn['dateline']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $user['userid'] );
|
||||
@@ -1447,6 +1564,109 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert clubs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubs()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'groupid' );
|
||||
|
||||
foreach( $this->fetch( 'socialgroup', 'groupid' ) AS $group )
|
||||
{
|
||||
switch( $group['type'] )
|
||||
{
|
||||
case 'public':
|
||||
$type = 'public';
|
||||
break;
|
||||
|
||||
case 'moderated':
|
||||
$type = 'closed';
|
||||
break;
|
||||
|
||||
case 'inviteonly':
|
||||
$type = 'private';
|
||||
break;
|
||||
}
|
||||
|
||||
$icon = NULL;
|
||||
try
|
||||
{
|
||||
$icon = $this->db->select( '*', 'socialgroupicon', array( "groupid=?", $group['groupid'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
|
||||
$info = array(
|
||||
'club_id' => $group['groupid'],
|
||||
'name' => $group['name'],
|
||||
'type' => $type,
|
||||
'created' => $group['dateline'],
|
||||
'members' => $group['members'],
|
||||
'owner' => $group['creatoruserid'],
|
||||
'profile_photo' => ( $icon ) ? "clubicon{$group['groupid']}.{$icon['extension']}" : NULL,
|
||||
'about' => $group['description'],
|
||||
'last_activity' => $group['lastupdate']
|
||||
);
|
||||
|
||||
$iconpath = NULL;
|
||||
$icondata = NULL;
|
||||
if ( $icon )
|
||||
{
|
||||
if ( $this->app->_session['more_info']['convertClubs']['photo_location'] == 'database' )
|
||||
{
|
||||
$icondata = $icon['filedata'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$iconpath = $this->app->_session['more_info']['convertClubs']['photo_location'] . "/socialgroupicon_{$icon['groupid']}_{$icon['dateline']}.gif";
|
||||
}
|
||||
}
|
||||
|
||||
$libraryClass->convertClub( $info, $iconpath, $icondata );
|
||||
|
||||
$libraryClass->setLastKeyValue( $group['groupid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert club members
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubMembers()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
foreach( $this->fetch( 'socialgroupmember', 'groupid' ) AS $member )
|
||||
{
|
||||
$type = NULL;
|
||||
try
|
||||
{
|
||||
$group = $this->db->select( '*', 'socialgroup', array( "groupid=?", $member['groupid'] ) )->first();
|
||||
|
||||
if ( $member['userid'] == $group['creatoruserid'] )
|
||||
{
|
||||
$type = 'leader';
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
|
||||
if ( $type === NULL )
|
||||
{
|
||||
$type = ( $member['type'] === 'moderated' ) ? 'requested' : $member['type'];
|
||||
}
|
||||
|
||||
$libraryClass->convertClubMember( array(
|
||||
'club_id' => $member['groupid'],
|
||||
'member_id' => $member['userid'],
|
||||
'joined' => $member['dateline'],
|
||||
'status' => $type,
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
/* !vBulletin Specific Stuff */
|
||||
/**
|
||||
* @brief Silly Bit Options for Groups. Typically we would leave out app specific options (such as Forums here) however we need them for some general permissions, like uploading.
|
||||
@@ -1626,6 +1846,13 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'allowsmilies' => 4,
|
||||
'parseurl' => 8,
|
||||
'signature' => 16,
|
||||
),
|
||||
'cluboptions' => array(
|
||||
'owner_mod_queue' => 1,
|
||||
'join_to_view' => 2,
|
||||
'enable_group_messages' => 4,
|
||||
'enable_group_albums' => 8,
|
||||
'only_owner_discussions' => 16
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter vBulletin 5.x Master Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -70,6 +70,10 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
'table' => 'user',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertMemberHistory' => array(
|
||||
'table' => 'userchangelog',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertIgnoredUsers' => array(
|
||||
'table' => 'userlist',
|
||||
'where' => array( "type=?", 'ignore' )
|
||||
@@ -85,6 +89,14 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
'convertRanks' => array(
|
||||
'table' => 'usertitle',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertClubs' => array(
|
||||
'table' => 'node',
|
||||
'where' => 'clubs'
|
||||
),
|
||||
'convertClubMembers' => array(
|
||||
'table' => 'groupintopic',
|
||||
'where' => NULL
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -115,7 +127,7 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
case 'pm':
|
||||
try
|
||||
{
|
||||
$node = $this->db->select( 'nodeid', 'channel', array( "guid=?", 'vbulletin-4ecbdf567f3da8.31769341' ) )->first();
|
||||
$node = $this->db->select( 'nodeid', 'channel', array( "guid=?", static::$guids['private_messages'] ) )->first();
|
||||
|
||||
return $this->db->select( 'COUNT(*)', 'privatemessage', array( "privatemessage.msgtype=? AND node.parentid=?", 'message', $node ) )->join( 'node', 'privatemessage.nodeid = node.nodeid' )->first();
|
||||
}
|
||||
@@ -125,6 +137,28 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
}
|
||||
break;
|
||||
|
||||
case 'node':
|
||||
if ( $where === 'clubs' )
|
||||
{
|
||||
return count( $this->fetchClubs() );
|
||||
}
|
||||
else
|
||||
{
|
||||
return parent::countRows( $table, $where, $recache );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'groupintopic':
|
||||
$clubs = array();
|
||||
foreach( $this->fetchClubs() AS $club )
|
||||
{
|
||||
$clubs[] = $club['nodeid'];
|
||||
}
|
||||
|
||||
$where = array( $this->db->in( 'nodeid', $clubs ) );
|
||||
return parent::countRows( $table, $where, $recache );
|
||||
break;
|
||||
|
||||
default:
|
||||
return parent::countRows( $table, $where, $recache );
|
||||
break;
|
||||
@@ -210,6 +244,7 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
'convertProfileFields',
|
||||
'convertGroups',
|
||||
'convertMembers',
|
||||
'convertClubs'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -385,6 +420,24 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'convertClubs':
|
||||
$return['convertClubs'] = array();
|
||||
$return['convertClubs']['photo_location'] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => 'database',
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array(
|
||||
'options' => array(
|
||||
'database' => \IPS\Member::loggedIn()->language()->addToStack( 'database' ),
|
||||
'file_system' => \IPS\Member::loggedIn()->language()->addToStack( 'file_system' ),
|
||||
),
|
||||
'userSuppliedInput' => 'file_system',
|
||||
),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => function( $value ) { if ( $value != 'database' AND !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
return ( isset( $return[ $method ] ) ) ? $return[ $method ] : array();
|
||||
@@ -734,7 +787,6 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
'g_bitoptions' => array(
|
||||
'gbw_promote_unit_type' => $gbw_promote_unit, // Type of group promotion to use. 1 is days since joining, 0 is content count. Corresponds to g_promotion
|
||||
'gbw_no_status_update' => !$checkpermission( 'visitormessagepermissions', 'canmessageownprofile' ), // Can NOT post status updates
|
||||
'gbw_soft_delete_own' => $checkpermission( 'forumpermissions', 'candeletepost' ), // Allow users of this group to hide their own submitted content
|
||||
'gbw_allow_upload_bgimage' => 1, // Can upload a cover photo?
|
||||
'gbw_view_reps' => $checkpermission( 'genericpermissions2', 'canprofilerep' ), // Can view who gave reputation?
|
||||
'gbw_no_status_import' => !$checkpermission( 'visitormessagepermissions', 'canmessageownprofile' ), // Can NOT import status updates from Facebook/Twitter
|
||||
@@ -743,6 +795,7 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
'gbw_pm_override_inbox_full'=> $checkpermission( 'pmpermissions', 'canignorequota' ), // 1 means this group can send other members PMs even when that member's inbox is full
|
||||
'gbw_cannot_be_ignored' => ( ( $checkpermission( 'adminpermissions', 'ismoderator' ) OR $checkpermission( 'adminpermissions', 'cancontrolpanel' ) ) AND $this->_setting( 'ignoremods' ) ), // 1 means they cannot be ignored. 0 means they can
|
||||
),
|
||||
'g_hide_own_posts' => $checkpermission( 'forumpermissions', 'candeletepost' ),
|
||||
'g_pm_flood_mins' => $this->_setting( 'pmfloodtime' ) / 60,
|
||||
'g_post_polls' => $checkpermission( 'forumpermissions', 'canpostpoll' ) ? 1 : 0,
|
||||
'g_vote_polls' => $checkpermission( 'forumpermissions', 'canvote' ) ? 1 : 0,
|
||||
@@ -755,6 +808,82 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
|
||||
$libraryClass->setLastKeyValue( $group['usergroupid'] );
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
$libraryClass->convertGroupPromotion( $groupPromotion );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Member history type map
|
||||
*/
|
||||
protected $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'member_group_id', 'membergroupids' => 'mgroup_others' );
|
||||
|
||||
/**
|
||||
* Convert member history
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertMemberHistory()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'changeid' );
|
||||
|
||||
$fixGroups = function( $string )
|
||||
{
|
||||
$groups = explode( ',', $string );
|
||||
$newGroups = array();
|
||||
|
||||
array_walk( $groups, function( &$item, $key ) use ( &$newGroups )
|
||||
{
|
||||
try
|
||||
{
|
||||
$item = $this->app->getLink( $item, 'core_groups' );
|
||||
$newGroups[] = $item;
|
||||
}
|
||||
catch( \OutOfRangeException $e ){}
|
||||
});
|
||||
|
||||
return implode( ',', $newGroups );
|
||||
};
|
||||
|
||||
foreach( $this->fetch( 'userchangelog', 'changeid' ) AS $change )
|
||||
{
|
||||
if( !in_array( $change['fieldname'], array_keys( $this->changeLogTypes ) ) )
|
||||
{
|
||||
$libraryClass->setLastKeyValue( $change['changeid'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Any processing we need to do */
|
||||
switch( $this->changeLogTypes[ $change['fieldname'] ] )
|
||||
{
|
||||
case 'member_group_id':
|
||||
case 'mgroup_others':
|
||||
$change['oldvalue'] = $fixGroups( $change['oldvalue'] );
|
||||
$change['newvalue'] = $fixGroups( $change['newvalue'] );
|
||||
break;
|
||||
}
|
||||
|
||||
$libraryClass->convertMemberHistory( array(
|
||||
'log_id' => $change['changeid'],
|
||||
'log_member' => $change['userid'],
|
||||
'log_by' => $change['adminid'],
|
||||
'log_type' => $this->changeLogTypes[ $change['fieldname'] ],
|
||||
'log_data' => array( 'old' => $change['oldvalue'], 'new' => $change['newvalue'] ),
|
||||
'log_date' => $change['change_time'],
|
||||
'log_ip_address' => long2ip( $change['ipaddress'] )
|
||||
)
|
||||
);
|
||||
|
||||
$libraryClass->setLastKeyValue( $change['changeid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -894,6 +1023,8 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
'allow_admin_mails' => $checkpermission( 'useroptions', 'adminemail' ),
|
||||
'members_disable_pm' => !$checkpermission( 'useroptions', 'receivepm' ),
|
||||
'member_posts' => $user['posts'],
|
||||
'fb_uid' => $user['fbuserid'],
|
||||
'fb_token' => $user['fbaccesstoken']
|
||||
);
|
||||
|
||||
/* Profile Fields */
|
||||
@@ -1076,7 +1207,7 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
continue;
|
||||
}
|
||||
|
||||
$libraryClass->convertWarnLog( array(
|
||||
$warnId = $libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warn['nodeid'],
|
||||
'wl_member' => $warn['infracteduserid'],
|
||||
'wl_moderator' => $node['userid'],
|
||||
@@ -1085,6 +1216,17 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
'wl_note_member' => $node['description'],
|
||||
'wl_note_mods' => $warn['customreason'],
|
||||
) );
|
||||
|
||||
/* Add a member history record for this member */
|
||||
$libraryClass->convertMemberHistory( array(
|
||||
'log_id' => 'w' . $warn['nodeid'],
|
||||
'log_member' => $warn['infracteduserid'],
|
||||
'log_by' => $warn['userid'],
|
||||
'log_type' => 'warning',
|
||||
'log_data' => array( 'wid' => $warnId ),
|
||||
'log_date' => $warn['actiondateline']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $user['userid'] );
|
||||
@@ -1283,6 +1425,125 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert clubs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubs()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'nodeid' );
|
||||
|
||||
try
|
||||
{
|
||||
$mainNodeId = $this->db->select( 'nodeid', 'channel', array( "guid=?", static::$guids['clubs'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
/* shrug */
|
||||
throw new \IPS\convert\Software\Exception;
|
||||
}
|
||||
|
||||
$categories = array();
|
||||
foreach( $this->db->select( 'nodeid', 'node', array( "parentid=?", $mainNodeId ) ) AS $cat )
|
||||
{
|
||||
$categories[] = $cat;
|
||||
}
|
||||
|
||||
$checktype = function( $nodeoptions ) {
|
||||
if ( $nodeoptions & 8 )
|
||||
{
|
||||
return 'public';
|
||||
}
|
||||
else if ( $nodeoptions & 16 )
|
||||
{
|
||||
return 'private';
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'closed';
|
||||
}
|
||||
};
|
||||
|
||||
foreach( $this->fetch( 'node', 'nodeid', array( $this->db->in( 'parentid', $categories ) ) ) AS $row )
|
||||
{
|
||||
try
|
||||
{
|
||||
$channel = $this->db->select( '*', 'channel', array( "nodeid=?", $row['nodeid'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$channel = array( 'filedataid' => 0 );
|
||||
}
|
||||
|
||||
$filedata = NULL;
|
||||
if ( $channel['filedataid'] )
|
||||
{
|
||||
try
|
||||
{
|
||||
$filedata = $this->db->select( '*', 'filedata', array( "filedataid=?", $channel['filedataid'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
}
|
||||
|
||||
$info = array(
|
||||
'club_id' => $row['nodeid'],
|
||||
'name' => $row['title'],
|
||||
'type' => $checktype( $row['nodeoptions'] ),
|
||||
'created' => $row['publishdate'],
|
||||
'members' => $this->db->select( 'COUNT(*)', 'groupintopic', array( "nodeid=?", $row['nodeid'] ) )->first(),
|
||||
'owner' => $row['userid'],
|
||||
'profile_photo' => ( $filedata ) ? "club{$row['nodeid']}.{$filedata['extension']}" : NULL,
|
||||
'featured' => $row['sticky'], # I don't know if you can actually pin social groups, but the columns there so... may as well
|
||||
'about' => $row['description'],
|
||||
'last_activity' => $row['lastupdate'],
|
||||
);
|
||||
|
||||
$icondata = NULL;
|
||||
$iconpath = NULL;
|
||||
if ( $filedata )
|
||||
{
|
||||
if ( $this->app->_session['more_info']['convertClubs']['photo_location'] == 'database' )
|
||||
{
|
||||
$icondata = $filedata['filedata'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder = preg_split( '//', $filedata['userid'], NULL, PREG_SPLIT_NO_EMPTY );
|
||||
$folder = implode( '/', $folder );
|
||||
$iconpath = $this->app->_session['more_info']['convertClubs']['photo_location'] . '/' . $folder . '/' . $filedata['filedataid'] . '.attach';
|
||||
}
|
||||
}
|
||||
|
||||
$libraryClass->convertClub( $info, $iconpath, $icondata );
|
||||
$libraryClass->setLastKeyValue( $row['nodeid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Club Members
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubMembers()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$clubs = array();
|
||||
foreach( $this->fetchClubs() AS $club )
|
||||
{
|
||||
$clubs[ $club['nodeid'] ] = $club['userid'];
|
||||
}
|
||||
foreach( $this->fetch( 'groupintopic', 'nodeid', array( $this->db->in( 'nodeid', array_keys( $clubs ) ) ) ) AS $row )
|
||||
{
|
||||
$libraryClass->convertClubMember( array(
|
||||
'club_id' => $row['nodeid'],
|
||||
'member_id' => $row['userid'],
|
||||
'status' => ( $row['userid'] == $clubs[ $row['nodeid'] ] ) ? 'leader' : 'member',
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
/* !vBulletin Specific Stuff */
|
||||
/**
|
||||
* @brief Silly Bit Options for Groups. Typically we would leave out app specific options (such as Forums here) however we need them for some general permissions, like uploading.
|
||||
@@ -1522,6 +1783,46 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
return $forums;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Channel GUID Mappins.
|
||||
* @note As far as I can tell, these are static and not unique per installation. Only the ones that are used are present.
|
||||
*/
|
||||
public static $guids = array(
|
||||
'clubs' => 'vbulletin-4ecbdf567f3a38.99555306',
|
||||
'private_messages' => 'vbulletin-4ecbdf567f3da8.31769341'
|
||||
);
|
||||
|
||||
/**
|
||||
* Fetch Clubs
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function fetchClubs()
|
||||
{
|
||||
$clubs = array();
|
||||
|
||||
try
|
||||
{
|
||||
/* Get the main social group node ID from the channel GUID. */
|
||||
$mainNodeId = $this->db->select( 'nodeid', 'channel', array( "guid=?", static::$guids['clubs'] ) )->first();
|
||||
|
||||
$categories = array();
|
||||
foreach( $this->db->select( 'nodeid', 'node', array( "parentid=?", $mainNodeId ) ) AS $cat )
|
||||
{
|
||||
$categories[] = $cat;
|
||||
}
|
||||
|
||||
/* The actual clubs are all two levels deep from the main channel node, so we need to sub-query the categories. */
|
||||
foreach( $this->db->select( '*', 'node', array( $this->db->in( 'parentid', $categories ) ) ) AS $row )
|
||||
{
|
||||
$clubs[ $row['nodeid'] ] = $row;
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e ) { /* Just in case something goofy happened and there is no main channel */ }
|
||||
|
||||
return $clubs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Types Cache
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Wordpress Core Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 12 December 2015
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter XenForo 1.x Master Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -84,6 +84,10 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'table' => 'xf_user',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertMemberHistory' => array(
|
||||
'table' => 'xf_user_change_log',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertWarnReason' => array(
|
||||
'table' => 'xf_warning_definition',
|
||||
'where' => NULL
|
||||
@@ -374,6 +378,10 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
/* First Post Data */
|
||||
\IPS\Task::queue( 'convert', 'RebuildConversationFirstIds', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
|
||||
/* Rebuild Leaderboard */
|
||||
\IPS\Task::queue( 'core', 'RebuildReputationLeaderboard', array(), 4 );
|
||||
\IPS\Db::i()->delete('core_reputation_leaderboard_history');
|
||||
|
||||
return array( "f_search_index_rebuild", "f_clear_caches", "f_rebuild_pms", "f_signatures_rebuild" );
|
||||
}
|
||||
@@ -386,7 +394,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
*/
|
||||
public static function fixPostData( $post )
|
||||
{
|
||||
// run everything through htmlspecialchars to prevent XSS ( @see http://community.invisionpower.com/resources/bugs.html/_/ips-extras/converters/possible-xf-converter-xss-vector-r38108 )
|
||||
// run everything through htmlspecialchars to prevent XSS
|
||||
$post = htmlspecialchars( $post, \IPS\HTMLENTITIES | ENT_QUOTES, 'UTF-8', FALSE );
|
||||
|
||||
// find YouTube ID's and replace.
|
||||
@@ -424,7 +432,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$maps[$member_name] = preg_quote( $maps[$member_name], '#' );
|
||||
$member_name = preg_quote( $member_name, '#' );
|
||||
|
||||
$post = preg_replace( "#\[user={$member_id}\]\@{$member_name}\[\/user\]#i", "<a contenteditable=\"false\" rel=\"\" href=\"{$urls[$member_name]}\" data-mentionid=\"{$maps[$member_name]}\" data-ipshover-target=\"{$cardUrls[$member_name]}\" data-ipshover=\"\">@{$member_name}</a>", $post );
|
||||
$post = preg_replace( "#\[user={$member_id}\]@?{$member_name}\[\/user\]#i", "<a contenteditable=\"false\" rel=\"\" href=\"{$urls[$member_name]}\" data-mentionid=\"{$maps[$member_name]}\" data-ipshover-target=\"{$cardUrls[$member_name]}\" data-ipshover=\"\">@{$member_name}</a>", $post );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -487,19 +495,13 @@ class _Xenforo extends \IPS\convert\Software
|
||||
{
|
||||
if ( $attachId !== FALSE )
|
||||
{
|
||||
$ourAttachment = \IPS\File::get( 'core_Attachment', \IPS\Db::i()->select( 'attach_location', 'core_attachments', array( 'attach_id=?', $attachId ) )->first() );
|
||||
|
||||
$messagePostId = $this->app->getLink( $row['content_id'], 'core_message_posts' );
|
||||
|
||||
$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 ) )
|
||||
{
|
||||
$post = preg_replace( "/\[ATTACH(.+?)?\]" . $row['attachment_id'] . "\[\/ATTACH\]/i", '<p><a href="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attachId . '" src="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>', $post );
|
||||
}
|
||||
else
|
||||
{
|
||||
$post .= '<p><a href="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attachId . '" src="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>';
|
||||
$post = preg_replace( "/\[ATTACH(.+?)?\]" . $row['attachment_id'] . "\[\/ATTACH\]/i", '[attachment=' . $attachId . ':name]', $post );
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'core_message_posts', array( 'msg_post' => $post ), array( "msg_id=?", $messagePostId ) );
|
||||
@@ -716,6 +718,15 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['user_group_id'] );
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
$libraryClass->convertGroupPromotion( $groupPromotion );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -762,6 +773,72 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$libraryClass->setLastKeyValue( $row['warning_definition_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Member history type map
|
||||
*/
|
||||
protected $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'user_group_id' => 'member_group_id', 'secondar_group_ids' => 'mgroup_others' );
|
||||
|
||||
/**
|
||||
* Convert member history
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertMemberHistory()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'log_id' );
|
||||
|
||||
$fixGroups = function( $string )
|
||||
{
|
||||
$groups = explode( ',', $string );
|
||||
$newGroups = array();
|
||||
|
||||
array_walk( $groups, function( &$item, $key ) use ( &$newGroups )
|
||||
{
|
||||
try
|
||||
{
|
||||
$item = $this->app->getLink( $item, 'core_groups' );
|
||||
$newGroups[] = $item;
|
||||
}
|
||||
catch( \OutOfRangeException $e ){}
|
||||
});
|
||||
|
||||
return implode( ',', $newGroups );
|
||||
};
|
||||
|
||||
foreach( $this->fetch( 'xf_user_change_log', 'log_id' ) AS $change )
|
||||
{
|
||||
if( !in_array( $change['field'], array_keys( $this->changeLogTypes ) ) )
|
||||
{
|
||||
$libraryClass->setLastKeyValue( $change['log_id'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Any processing we need to do */
|
||||
switch( $this->changeLogTypes[ $change['field'] ] )
|
||||
{
|
||||
case 'member_group_id':
|
||||
case 'mgroup_others':
|
||||
$change['old_value'] = $fixGroups( $change['old_value'] );
|
||||
$change['new_value'] = $fixGroups( $change['new_value'] );
|
||||
break;
|
||||
}
|
||||
|
||||
$libraryClass->convertMemberHistory( array(
|
||||
'log_id' => $change['log_id'],
|
||||
'log_member' => $change['user_id'],
|
||||
'log_by' => ( $change['edit_user_id'] !== $change['user_id'] ) ? $change['edit_user_id'] : null,
|
||||
'log_type' => $this->changeLogTypes[ $change['field'] ],
|
||||
'log_data' => array( 'old' => $change['old_value'], 'new' => $change['new_value'] ),
|
||||
'log_date' => $change['edit_date']
|
||||
)
|
||||
);
|
||||
|
||||
$libraryClass->setLastKeyValue( $change['log_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert members
|
||||
@@ -785,6 +862,12 @@ class _Xenforo extends \IPS\convert\Software
|
||||
{
|
||||
$auth = $this->db->select( 'data', 'xf_user_authenticate', array( "user_id=?", $row['user_id'] ) )->first();
|
||||
$data = \unserialize( $auth );
|
||||
|
||||
if( !isset( $data['hash'] ) )
|
||||
{
|
||||
throw new \UnderflowException;
|
||||
}
|
||||
|
||||
$hash = $data['hash'];
|
||||
|
||||
/* vB, IPB, etc. */
|
||||
@@ -990,16 +1073,27 @@ class _Xenforo extends \IPS\convert\Software
|
||||
/* Warnings */
|
||||
foreach( $this->db->select( '*', 'xf_warning', array( "content_type=? AND user_id=?", 'user', $row['user_id'] ) ) AS $warning )
|
||||
{
|
||||
$libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warning['warning_id'],
|
||||
'wl_member' => $warning['user_id'],
|
||||
'wl_moderator' => $warning['warning_user_id'],
|
||||
'wl_date' => $warning['warning_date'],
|
||||
'wl_reason' => $warning['warning_definition_id'],
|
||||
'wl_points' => $warning['points'],
|
||||
'wl_note_mods' => $warning['notes'],
|
||||
'wl_expire_date' => $warning['expiry_date'],
|
||||
) );
|
||||
$warnId = $libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warning['warning_id'],
|
||||
'wl_member' => $warning['user_id'],
|
||||
'wl_moderator' => $warning['warning_user_id'],
|
||||
'wl_date' => $warning['warning_date'],
|
||||
'wl_reason' => $warning['warning_definition_id'],
|
||||
'wl_points' => $warning['points'],
|
||||
'wl_note_mods' => $warning['notes'],
|
||||
'wl_expire_date' => $warning['expiry_date'],
|
||||
) );
|
||||
|
||||
/* Add a member history record for this member */
|
||||
$libraryClass->convertMemberHistory( array(
|
||||
'log_id' => 'w' . $warning['warning_id'],
|
||||
'log_member' => $warning['user_id'],
|
||||
'log_by' => $warning['warning_user_id'],
|
||||
'log_type' => 'warning',
|
||||
'log_data' => array( 'wid' => $warnId ),
|
||||
'log_date' => $warning['warning_date']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['user_id'] );
|
||||
@@ -1157,9 +1251,9 @@ class _Xenforo extends \IPS\convert\Software
|
||||
foreach( $this->fetch( 'xf_user_ignored', 'user_id' ) AS $row )
|
||||
{
|
||||
$libraryClass->convertIgnoredUser( array(
|
||||
'ignore_id' => $row['user_id'] . '-' . $row['ignore_user_id'],
|
||||
'ignore_id' => $row['user_id'] . '-' . $row['ignored_user_id'],
|
||||
'ignore_owner_id' => $row['user_id'],
|
||||
'ignore_ignore_id' => $row['ignore_user_id']
|
||||
'ignore_ignore_id' => $row['ignored_user_id']
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
Whitespace-only changes.
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter XenForo Resource Manager Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -101,6 +101,19 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'convertDownloadsReviews'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish
|
||||
*
|
||||
* @return array Messages to display
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'class' => 'IPS\downloads\File', 'link' => 'downloads_files' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'class' => 'IPS\downloads\File\Review', 'link' => 'downloads_reviews' ), 2, array( 'app', 'link', 'class' ) );
|
||||
|
||||
return array( );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get More Information
|
||||
@@ -330,7 +343,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
$featured = 1;
|
||||
}
|
||||
catch( \UnderflowExceptioN $e ) {}
|
||||
catch( \UnderflowException $e ) {}
|
||||
|
||||
$info = array(
|
||||
'file_id' => $row['resource_id'],
|
||||
@@ -363,30 +376,48 @@ class _Xenforo extends \IPS\convert\Software
|
||||
}
|
||||
else
|
||||
{
|
||||
$file_data = $this->db->select( '*', 'xf_attachment', array( "xf_attachment.content_type=? AND xf_attachment.content_id=?", 'resource_version', $record['resource_version_id'] ) )->join( 'xf_attachment_data', "xf_attachment.data_id = xf_attachment_data.data_id" )->first();
|
||||
$group = floor( $row['user_id'] / 1000 );
|
||||
|
||||
try
|
||||
{
|
||||
$file_data = $this->db->select( '*', 'xf_attachment', array( "xf_attachment.content_type=? AND xf_attachment.content_id=?", 'resource_version', $record['resource_version_id'] ) )->join( 'xf_attachment_data', "xf_attachment.data_id = xf_attachment_data.data_id" )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$this->app->log( 'xenforo_resource_missing_record', __METHOD__, \IPS\convert\App::LOG_WARNING, $record['resource_update_id'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
$group = floor( $file_data['data_id'] / 1000 );
|
||||
|
||||
$records[] = array(
|
||||
'record_id' => $record['resource_update_id'],
|
||||
'record_type' => 'upload',
|
||||
'file_path' => rtrim( $this->app->_session['more_info']['convertDownloadsFiles']['file_location'], '/' ) . '/' . $group . '/' . $file_data['data_id'] . '-' . $file_data['file_hash'] . '.data',
|
||||
'record_time' => $record['release_date']
|
||||
'record_time' => $record['release_date'],
|
||||
'record_realname' => $file_data['filename']
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* And now screenshots */
|
||||
foreach( $this->db->select( '*', 'xf_attachment', array( "xf_attachment.content_type=? AND xf_attachment.content_id=?", 'resource_update', $record['resource_update_id'] ) )->join( 'xf_attachment_data', "xf_attachment.data_id = xf_attachment_data.data_id" ) AS $screen )
|
||||
try
|
||||
{
|
||||
$group = floor( $row['user_id'] / 1000 );
|
||||
|
||||
$records[] = array(
|
||||
'record_type' => 'ssupload',
|
||||
'file_path' => rtrim( $this->app->_session['more_info']['convertDownloadsFiles']['file_location'], '/' ) . '/' . $group . '/' . $screen['data_id'] . '-' . $screen['file_hash'] . '.data',
|
||||
'record_time' => $record['release_date']
|
||||
);
|
||||
foreach( $this->db->select( '*', 'xf_attachment', array( "xf_attachment.content_type=? AND xf_attachment.content_id=?", 'resource_update', $record['resource_update_id'] ) )->join( 'xf_attachment_data', "xf_attachment.data_id = xf_attachment_data.data_id" ) AS $screen )
|
||||
{
|
||||
$group = floor( $file_data['data_id'] / 1000 );
|
||||
|
||||
$records[] = array(
|
||||
'record_type' => 'ssupload',
|
||||
'file_path' => rtrim( $this->app->_session['more_info']['convertDownloadsFiles']['file_location'], '/' ) . '/' . $group . '/' . $screen['data_id'] . '-' . $screen['file_hash'] . '.data',
|
||||
'record_time' => $record['release_date'],
|
||||
'record_realname' => $screen['filename']
|
||||
);
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$this->app->log( 'xenforo_resource_missing_screenshot', __METHOD__, \IPS\convert\App::LOG_WARNING, $record['resource_update_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$cfields = array();
|
||||
foreach( $this->db->select( 'field_id, field_value', 'xf_resource_field_value', array( "resource_id=?", $row['resource_id'] ) )->setKeyField( 'field_id' )->setValueField( 'field_value' ) AS $key => $value )
|
||||
{
|
||||
|
||||
Whitespace-only changes.
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Software Exception Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter BBPress Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Nov 2016
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter ExpressionEngine Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 17 June 2016
|
||||
*/
|
||||
@@ -472,7 +472,7 @@ class _Expressionengine extends \IPS\convert\Software
|
||||
}
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item instanceof \IPS\Content\Item )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
if( $item->canView() )
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter MyBB Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -97,7 +97,8 @@ class _Mybb extends \IPS\convert\Software
|
||||
public static function checkConf()
|
||||
{
|
||||
return array(
|
||||
'convertAttachments'
|
||||
'convertAttachments',
|
||||
'convertForumsPosts'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -113,6 +114,36 @@ class _Mybb extends \IPS\convert\Software
|
||||
|
||||
switch( $method )
|
||||
{
|
||||
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(
|
||||
'rep_positive' => 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,
|
||||
),
|
||||
'rep_negative' => 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(
|
||||
@@ -144,6 +175,10 @@ class _Mybb 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' ) );
|
||||
|
||||
@@ -446,6 +481,8 @@ class _Mybb extends \IPS\convert\Software
|
||||
/* Reputation */
|
||||
foreach( $this->db->select( '*', 'reputation', array( "pid=?", $row['pid'] ) ) AS $rep )
|
||||
{
|
||||
$reaction = ( $rep['reputation'] > 0 ) ? $this->app->_session['more_info']['convertForumsPosts']['rep_positive'] : $this->app->_session['more_info']['convertForumsPosts']['rep_negative'];
|
||||
|
||||
$libraryClass->convertReputation( array(
|
||||
'id' => $rep['rid'],
|
||||
'app' => 'forums',
|
||||
@@ -454,7 +491,7 @@ class _Mybb extends \IPS\convert\Software
|
||||
'member_id' => $rep['adduid'],
|
||||
'member_received' => $rep['uid'],
|
||||
'rep_date' => $rep['dateline'],
|
||||
'rep_rating' => $rep['reputation']
|
||||
'reaction' => $reaction
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -559,7 +596,7 @@ class _Mybb extends \IPS\convert\Software
|
||||
}
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item instanceof \IPS\Content\Item )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
if( $item->canView() )
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter phpBB Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -101,8 +101,8 @@ class _Phpbb extends \IPS\convert\Software
|
||||
{
|
||||
if ( $forum['forum_password'] )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words["forum_password_{$forum['forum_id']}"] = \IPS\Member::loggedIn()->language()->addToStack( 'forum_password', FALSE, array( 'sprintf' => array( $forum['forum_name'] ) ) );
|
||||
\IPS\Member::loggedIn()->language()->words["forum_password_{$forum['forum_id']}_desc"] = \IPS\Member::loggedIn()->language()->addToStack( 'forum_password_desc' );
|
||||
\IPS\Member::loggedIn()->language()->words["forum_password_{$forum['forum_id']}"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_forum_password', FALSE, array( 'sprintf' => array( $forum['forum_name'] ) ) );
|
||||
\IPS\Member::loggedIn()->language()->words["forum_password_{$forum['forum_id']}_desc"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_forum_password_desc' );
|
||||
|
||||
$return['convertForumsForums']["forum_password_{$forum['forum_id']}"] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Text',
|
||||
@@ -430,14 +430,25 @@ class _Phpbb extends \IPS\convert\Software
|
||||
$data = array( 0 => NULL );
|
||||
}
|
||||
|
||||
$libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warn['warning_id'],
|
||||
'wl_member' => $warn['user_id'],
|
||||
'wl_moderator' => $log['user_id'],
|
||||
'wl_date' => $warn['warning_time'],
|
||||
'wl_points' => 1,
|
||||
'wl_note_member' => isset( $data[0] ) ? $data[0] : NULL,
|
||||
) );
|
||||
$warnId = $libraryClass->convertWarnLog( array(
|
||||
'wl_id' => $warning['warning_id'],
|
||||
'wl_member' => $warning['user_id'],
|
||||
'wl_moderator' => $log['user_id'],
|
||||
'wl_date' => $warning['warning_time'],
|
||||
'wl_points' => 1,
|
||||
'wl_note_member' => isset( $data[0] ) ? $data[0] : NULL,
|
||||
) );
|
||||
|
||||
/* Add a member history record for this member */
|
||||
$libraryClass->convertMemberHistory( array(
|
||||
'log_id' => 'w' . $warning['warning_id'],
|
||||
'log_member' => $warning['user_id'],
|
||||
'log_by' => $log['user_id'],
|
||||
'log_type' => 'warning',
|
||||
'log_data' => array( 'wid' => $warnId ),
|
||||
'log_date' => $warning['warning_time']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['post_id'] );
|
||||
@@ -472,7 +483,28 @@ class _Phpbb extends \IPS\convert\Software
|
||||
'attach_filesize' => $row['filesize'],
|
||||
);
|
||||
|
||||
$libraryClass->convertAttachment( $info, $map, rtrim( $this->app->_session['more_info']['convertAttachments']['attach_location'], '/' ) . '/' . $row['physical_filename'] );
|
||||
$attachId = $libraryClass->convertAttachment( $info, $map, rtrim( $this->app->_session['more_info']['convertAttachments']['attach_location'], '/' ) . '/' . $row['physical_filename'] );
|
||||
|
||||
/* Do some re-jiggery on the post itself to make sure attachment displays */
|
||||
if ( $attachId !== FALSE )
|
||||
{
|
||||
try
|
||||
{
|
||||
$pid = $this->app->getLink( $row['post_msg_id'], 'forums_posts' );
|
||||
|
||||
$post = \IPS\Db::i()->select( 'post', 'forums_posts', array( "pid=?", $pid ) )->first();
|
||||
|
||||
$attachmentName = preg_quote( $row['real_filename'], '/' );
|
||||
if ( preg_match( "/\[attachment=(.+?)?\]\<\!\-\- ia0 \-\-\>{$attachmentName}\<\!\-\- ia0 \-\-\>\[\/attachment\]/i", $post ) )
|
||||
{
|
||||
$post = preg_replace( "/\[attachment=(.+?)?\]\<\!\-\- ia0 \-\-\>{$attachmentName}\<\!\-\- ia0 \-\-\>\[\/attachment\]/i", '[attachment=' . $attachId . ':name]', $post );
|
||||
|
||||
\IPS\Db::i()->update( 'forums_posts', array( 'post' => $post ), array( "pid=?", $pid ) );
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
catch( \OutOfRangeException $e ) {}
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['attach_id'] );
|
||||
}
|
||||
@@ -499,7 +531,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
{
|
||||
$class = '\IPS\forums\Topic';
|
||||
$types = array( 'topics', 'forums_topics' );
|
||||
$oldId = \IPS\Request::i()->tid;
|
||||
$oldId = \IPS\Request::i()->tid ?: \IPS\Request::i()->t;
|
||||
}
|
||||
}
|
||||
elseif( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'viewforum.php' ) !== FALSE )
|
||||
@@ -523,7 +555,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
}
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item instanceof \IPS\Content\Item )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
if( $item->canView() )
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter PhpMyForum Forums Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 6 December 2016
|
||||
* @note Only redirect scripts are supported right now
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Punbb Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -334,7 +334,7 @@ class _Punbb extends \IPS\convert\Software
|
||||
}
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item instanceof \IPS\Content\Item )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
if( $item->canView() )
|
||||
{
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
/**
|
||||
* @brief Converter SMF Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
* @todo SMF supports karma which we should be able to convert to reactions (reputation), but we need a sample database that used karma
|
||||
*/
|
||||
|
||||
namespace IPS\convert\Software\Forums;
|
||||
@@ -69,7 +70,7 @@ class _Smf extends \IPS\convert\Software
|
||||
),
|
||||
'convertAttachments' => array(
|
||||
'table' => 'attachments',
|
||||
'where' => array( "id_msg<>?", 0 )
|
||||
'where' => array( "id_msg<>? AND attachment_type < ?", 0, 3 )
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -438,19 +439,11 @@ class _Smf extends \IPS\convert\Software
|
||||
|
||||
$libraryClass::setKey( 'id_attach' );
|
||||
|
||||
foreach( $this->fetch( 'attachments', 'id_attach' ) AS $row )
|
||||
foreach( $this->fetch( 'attachments', 'id_attach', array( "id_msg<>? AND attachment_type < ?", 0, 3 ) ) AS $row )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( $row['id_msg'] AND $row['attachment_type'] < 3 )
|
||||
{
|
||||
$post = $this->db->select( 'id_topic, poster_time', 'messages', array( "id_msg=?", $row['id_msg'] ) )->first();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Is an avatar or thumbnail */
|
||||
throw new \UnderflowException;
|
||||
}
|
||||
$post = $this->db->select( 'id_topic, poster_time', 'messages', array( "id_msg=?", $row['id_msg'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
@@ -474,13 +467,13 @@ class _Smf extends \IPS\convert\Software
|
||||
/* Clean filename per legacy SMF requirements */
|
||||
$cleanName = strtr( $row['filename'], 'ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ', 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');
|
||||
$cleanName = strtr( $cleanName, array( 'Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u' ) );
|
||||
$cleanName = preg_replace( array( '/s/', '/[^w_.-]/' ), array( '_', '' ), $cleanName );
|
||||
$cleanName = preg_replace( array('/\s/', '/[^\w_\.\-]/'), array('_', ''), $cleanName );
|
||||
|
||||
$location = $row['id_attach'] . '_' . str_replace( '.', '_', $cleanName ) . md5( $cleanName );
|
||||
}
|
||||
$location = str_replace( ' ', '_', $location );
|
||||
|
||||
/* Fix File Name */
|
||||
// http://community.invisionpower.com/tracker/issue-21020-smf-attachments-are-crazy/
|
||||
$row['filename'] = str_replace(' ', '_', $row['filename']);
|
||||
$row['filename'] = str_replace('!', '', $row['filename']);
|
||||
$row['filename'] = str_replace('(', '', $row['filename']);
|
||||
@@ -551,9 +544,10 @@ class _Smf extends \IPS\convert\Software
|
||||
}
|
||||
elseif( isset( \IPS\Request::i()->board ) )
|
||||
{
|
||||
$pieces = explode( '.', \IPS\Request::i()->board );
|
||||
$class = '\IPS\forums\Forum';
|
||||
$types = array( 'forums', 'forums_forums' );
|
||||
$oldId = \IPS\Request::i()->board;
|
||||
$oldId = $pieces[0];
|
||||
}
|
||||
|
||||
if( isset( $class ) )
|
||||
@@ -570,7 +564,7 @@ class _Smf extends \IPS\convert\Software
|
||||
}
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item instanceof \IPS\Content\Item )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
if( $item->canView() )
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Converter UBBthreads 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
|
||||
|
||||
@@ -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
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter vBulletin 4.x Forums Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -121,6 +121,18 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'table' => 'post',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertClubForums' => array(
|
||||
'table' => 'socialgroup',
|
||||
'where' => array( \IPS\Db::i()->bitwiseWhere( array( 'options' => static::$bitOptions['cluboptions'] ), 'enable_group_messages' ) )
|
||||
),
|
||||
'convertClubTopics' => array(
|
||||
'table' => 'discussion',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertClubPosts' => array(
|
||||
'table' => 'groupmessage',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertAttachments' => array(
|
||||
'table' => 'attachment',
|
||||
'where' => ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) ? array( "contenttypeid=?", static::$postContentType ) : NULL
|
||||
@@ -162,6 +174,10 @@ class _Vbulletin 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' ) );
|
||||
|
||||
@@ -186,7 +202,10 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
*/
|
||||
public static function checkConf()
|
||||
{
|
||||
return array( 'convertAttachments' );
|
||||
return array(
|
||||
'convertAttachments',
|
||||
'convertForumsPosts'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,6 +219,44 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$return = array();
|
||||
switch( $method )
|
||||
{
|
||||
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(
|
||||
'rep_neutral' => 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,
|
||||
),
|
||||
'rep_positive' => 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,
|
||||
),
|
||||
'rep_negative' => 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(
|
||||
'file_location' => array(
|
||||
@@ -425,7 +482,6 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'views' => $topic['views'],
|
||||
'approved' => $topic['visible'],
|
||||
'pinned' => $topic['sticky'],
|
||||
'topic_open_time' => $topic['dateline'],
|
||||
'topic_hiddenposts' => $topic['hiddencount'] + $topic['deletedcount']
|
||||
);
|
||||
|
||||
@@ -556,6 +612,11 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
/* Reputation */
|
||||
foreach( $this->db->select( '*', 'reputation', array( "postid=?", $post['postid'] ) ) AS $rep )
|
||||
{
|
||||
$reaction = ( $rep['reputation'] > 0 ) ?
|
||||
$this->app->_session['more_info']['convertForumsPosts']['rep_positive'] :
|
||||
( ( $rep['reputation'] == 0 ) ? $this->app->_session['more_info']['convertForumsPosts']['rep_neutral'] :
|
||||
$this->app->_session['more_info']['convertForumsPosts']['rep_negative'] );
|
||||
|
||||
$libraryClass->convertReputation( array(
|
||||
'id' => $rep['reputationid'],
|
||||
'app' => 'forums',
|
||||
@@ -564,7 +625,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'member_id' => $rep['whoadded'],
|
||||
'member_received' => $rep['userid'],
|
||||
'rep_date' => $rep['dateline'],
|
||||
'rep_rating' => $rep['reputation']
|
||||
'reaction' => $reaction
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -572,6 +633,8 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$latestedit = 0;
|
||||
$reason = NULL;
|
||||
$name = NULL;
|
||||
$newText = static::fixPostData( $post['pagetext'] );
|
||||
|
||||
foreach( $this->db->select( '*', 'postedithistory', array( "postid=?", $post['postid'] ) ) AS $edit )
|
||||
{
|
||||
$libraryClass->convertEditHistory( array(
|
||||
@@ -580,9 +643,12 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'comment_id' => $post['postid'],
|
||||
'member' => $edit['userid'],
|
||||
'time' => $edit['dateline'],
|
||||
'old' => $edit['pagetext']
|
||||
'old' => static::fixPostData( $edit['pagetext'] ),
|
||||
'new' => $newText
|
||||
) );
|
||||
|
||||
$newText = static::fixPostData( $edit['pagetext'] );
|
||||
|
||||
if ( $edit['dateline'] > $latestedit )
|
||||
{
|
||||
$latestedit = $edit['dateline'];
|
||||
@@ -724,6 +790,122 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$libraryClass->setLastKeyValue( $attachment['attachmentid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Club Forums
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubForums()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'groupid' );
|
||||
foreach( $this->fetch( 'socialgroup', 'groupid', array( \IPS\Db::i()->bitwiseWhere( array( 'options' => static::$bitOptions['cluboptions'] ), 'enable_group_messages' ) ) ) AS $row )
|
||||
{
|
||||
$libraryClass->convertClubForum( array(
|
||||
'id' => "clubforum{$row['groupid']}",
|
||||
'name' => "{$row['name']} Topics",
|
||||
'description' => "<p>{$row['description']}</p>",
|
||||
'topics' => $row['discussions'],
|
||||
'club_id' => $row['groupid']
|
||||
) );
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['groupid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Club Topics
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubTopics()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'discussionid' );
|
||||
foreach( $this->fetch( 'discussion', 'discussionid' ) AS $row )
|
||||
{
|
||||
try
|
||||
{
|
||||
$firstpost = $this->db->select( '*', 'groupmessage', array( "gmid=?", $row['firstpostid'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$libraryClass->setLastKeyValue( $row['discussionid'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
switch( $firstpost['state'] )
|
||||
{
|
||||
case 'visible':
|
||||
$approved = 1;
|
||||
break;
|
||||
|
||||
case 'moderation':
|
||||
$approved = 0;
|
||||
break;
|
||||
|
||||
case 'deleted':
|
||||
$approved = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
$libraryClass->convertClubTopic( array(
|
||||
'tid' => "clubtopic{$row['discussionid']}",
|
||||
'title' => $firstpost['title'],
|
||||
'forum_id' => "clubforum{$row['groupid']}",
|
||||
'state' => 'open',
|
||||
'starter_id' => $row['lastposterid'],
|
||||
'start_date' => $firstpost['dateline'],
|
||||
'last_poster_id' => $row['lastposterid'],
|
||||
'last_post' => $row['lastpost'],
|
||||
'starter_name' => $firstpost['postusername'],
|
||||
'last_poster_name' => $row['lastposter'],
|
||||
'approved' => $approved,
|
||||
) );
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['discussionid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Club Posts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubPosts()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'gmid' );
|
||||
foreach( $this->fetch( 'groupmessage', 'gmid' ) AS $row )
|
||||
{
|
||||
switch( $row['state'] )
|
||||
{
|
||||
case 'visible':
|
||||
$queued = 0;
|
||||
break;
|
||||
|
||||
case 'moderation':
|
||||
$queued = 1;
|
||||
break;
|
||||
|
||||
case 'deleted':
|
||||
$queued = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
$libraryClass->convertClubPost( array(
|
||||
'pid' => "clubpost{$row['gmid']}",
|
||||
'topic_id' => "clubtopic{$row['discussionid']}",
|
||||
'post' => static::fixPostData( $row['pagetext'] ),
|
||||
'author_id' => $row['postuserid'],
|
||||
'author_name' => $row['postusername'],
|
||||
'post_date' => $row['dateline'],
|
||||
'queued' => $queued,
|
||||
) );
|
||||
$libraryClass->setLastKeyValue( $row['gmid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/* !vBulletin Stuff */
|
||||
|
||||
@@ -755,6 +937,13 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'displaywrt' => 1048576,
|
||||
'canreputation' => 2097152,
|
||||
),
|
||||
'cluboptions' => array(
|
||||
'owner_mod_queue' => 1,
|
||||
'join_to_view' => 2,
|
||||
'enable_group_messages' => 4,
|
||||
'enable_group_albums' => 8,
|
||||
'only_owner_discussions' => 16
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter vBulletin 5.x Forums Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -136,6 +136,10 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'forums_posts', 'class' => 'IPS\forums\Topic\Post' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\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');
|
||||
|
||||
return array( 'f_rebuild_posts', 'f_recounting_forums', 'f_recounting_topics' );
|
||||
}
|
||||
@@ -158,7 +162,10 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
*/
|
||||
public static function checkConf()
|
||||
{
|
||||
return array( 'convertAttachments' );
|
||||
return array(
|
||||
'convertAttachments',
|
||||
'convertForumsPosts'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,6 +179,28 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
$return = array();
|
||||
switch( $method )
|
||||
{
|
||||
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(
|
||||
'rep_like' => 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(
|
||||
'file_location' => array(
|
||||
@@ -205,8 +234,8 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'node.nodeid' );
|
||||
|
||||
foreach( $this->fetch( 'node', 'nodeid', array( "node.nodeid<>? AND closure.parent=? AND node.contenttypeid=?", 2, 2, $this->fetchType( 'Channel' ) ) )->join( 'closure', "closure.child=node.nodeid" ) AS $forum )
|
||||
$clubs = $this->fetchClubs();
|
||||
foreach( $this->fetch( 'node', 'nodeid', array( "node.nodeid<>2 AND ( ( node.parentid=? AND node.contenttypeid=? ) OR " . $this->db->in( 'nodeid', array_keys( $clubs ) ) . " )", $this->fetchType( 'Thread' ), $this->fetchType( 'Channel' ) ) ) AS $forum )
|
||||
{
|
||||
$self = $this;
|
||||
$checkpermission = function( $name, $perm ) use ( $forum, $self )
|
||||
@@ -234,12 +263,13 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
'last_post' => $forum['lastcontent'],
|
||||
'last_poster_id' => $forum['lastauthorid'],
|
||||
'last_poster_name' => $forum['lastcontentauthor'],
|
||||
'parent_id' => $forum['parentid'],
|
||||
'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'],
|
||||
'preview_posts' => $checkpermission( 'forumoptions', 'moderatenewpost' ),
|
||||
'inc_postcount' => 1,
|
||||
'forum_allow_rating' => 1,
|
||||
'sub_can_post' => ( $forum['parentid'] == 2 ) ? 0 : 1,
|
||||
'sub_can_post' => ( $forum['parentid'] == 2 AND !array_key_exists( $forum['nodeid'], $clubs ) ) ? 0 : 1,
|
||||
);
|
||||
|
||||
$libraryClass->convertForumsForum( $info );
|
||||
@@ -259,7 +289,8 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
|
||||
$libraryClass::setKey( 'node.nodeid' );
|
||||
|
||||
foreach( $this->fetch( 'node', 'node.nodeid', array( \IPS\Db::i()->in( 'node.parentid', array_keys( $this->fetchForums() ) ) . " AND " . \IPS\Db::i()->in( 'node.contenttypeid', array( $this->fetchType( 'Text' ), $this->fetchType( 'Poll' ), $this->fetchType( 'Gallery' ), $this->fetchType( 'Video' ), $this->fetchType( 'Link' ) ) ) ) )->join( 'text', 'text.nodeid = node.nodeid' ) AS $topic )
|
||||
$clubs = $this->fetchClubs();
|
||||
foreach( $this->fetch( 'node', 'node.nodeid', array( "( " . \IPS\Db::i()->in( 'node.parentid', array_keys( $this->fetchForums() ) ) . " OR " . $this->db->in( 'node.parentid', array_keys( $clubs ) ) . " ) AND " . \IPS\Db::i()->in( 'node.contenttypeid', array( $this->fetchType( 'Text' ), $this->fetchType( 'Poll' ), $this->fetchType( 'Gallery' ), $this->fetchType( 'Video' ), $this->fetchType( 'Link' ) ) ) ) )->join( 'text', 'text.nodeid = node.nodeid' ) AS $topic )
|
||||
{
|
||||
/* Pesky Polls */
|
||||
$poll = NULL;
|
||||
@@ -445,7 +476,7 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
'member_id' => $rep['whoadded'],
|
||||
'member_received' => $rep['userid'],
|
||||
'rep_date' => $rep['dateline'],
|
||||
'rep_rating' => $rep['reputation']
|
||||
'reaction' => $this->app->_session['more_info']['convertForumsPosts']['rep_like']
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -453,6 +484,8 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
$latestedit = 0;
|
||||
$reason = NULL;
|
||||
$name = NULL;
|
||||
$newText = $post['rawtext'];
|
||||
|
||||
foreach( $this->db->select( '*', 'postedithistory', array( "nodeid=?", $post['nodeid'] ) ) AS $edit )
|
||||
{
|
||||
$libraryClass->convertEditHistory( array(
|
||||
@@ -461,9 +494,12 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
'comment_id' => $post['nodeid'],
|
||||
'member' => $edit['userid'],
|
||||
'time' => $edit['dateline'],
|
||||
'old' => $edit['pagetext']
|
||||
'old' => $edit['pagetext'],
|
||||
'new' => $newText
|
||||
) );
|
||||
|
||||
$newText = $edit['pagetext'];
|
||||
|
||||
if ( $edit['dateline'] > $latestedit )
|
||||
{
|
||||
$latestedit = $edit['dateline'];
|
||||
@@ -566,6 +602,19 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
$data = NULL;
|
||||
$path = implode( '/', preg_split( '//', $attachment['userid'], -1, PREG_SPLIT_NO_EMPTY ) );
|
||||
$path = rtrim( $this->app->_session['more_info']['convertAttachments']['file_location'], '/' ) . '/' . $path . '/' . $attachment['filedataid'] . '.attach';
|
||||
|
||||
/* Apparently vBulletin had a bug between 5.0.0 and 5.1.3 where attachments were incorrectly stored in /path/userid/file.attach rather than in the user ID split location */
|
||||
if ( !file_exists( $path ) )
|
||||
{
|
||||
$path = rtrim( $this->app->_session['more_info']['convertAttachments']['file_location'], '/' ) . '/' . $attachment['userid'] . '/' . $attachment['filedataid'] . '.attach';
|
||||
}
|
||||
|
||||
/* Still not there? It might be in the database still */
|
||||
if ( !file_exists( $path ) AND $attachment['filedata'] )
|
||||
{
|
||||
$data = $attachment['filedata'];
|
||||
$path = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
$attach_id = $libraryClass->convertAttachment( $info, $map, $path, $data );
|
||||
@@ -657,8 +706,8 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
protected function fetchForums()
|
||||
{
|
||||
$forums = array();
|
||||
|
||||
foreach( $this->db->select( '*', 'node', array( "node.nodeid<>2 AND closure.parent=? AND node.contenttypeid=?", $this->fetchType( 'Thread' ), $this->fetchType( 'Channel' ) ) )->join( 'closure', "closure.child = node.nodeid" ) AS $node )
|
||||
$clubs = $this->fetchClubs();
|
||||
foreach( $this->db->select( '*', 'node', array( "node.nodeid<>2 AND ( ( closure.parent=? AND node.contenttypeid=? ) OR " . $this->db->in( 'nodeid', array_keys( $clubs ) ) . " )", $this->fetchType( 'Thread' ), $this->fetchType( 'Channel' ) ) )->join( 'closure', "closure.child = node.nodeid" ) AS $node )
|
||||
{
|
||||
$forums[$node['nodeid']] = $node;
|
||||
}
|
||||
@@ -666,6 +715,37 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
return $forums;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch Clubs
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function fetchClubs()
|
||||
{
|
||||
$clubs = array();
|
||||
|
||||
try
|
||||
{
|
||||
/* Get the main social group node ID from the channel GUID. */
|
||||
$mainNodeId = $this->db->select( 'nodeid', 'channel', array( "guid=?", \IPS\convert\Software\Core\Vbulletin5::$guids['clubs'] ) )->first();
|
||||
|
||||
$categories = array();
|
||||
foreach( $this->db->select( 'nodeid', 'node', array( "parentid=?", $mainNodeId ) ) AS $cat )
|
||||
{
|
||||
$categories[] = $cat;
|
||||
}
|
||||
|
||||
/* The actual clubs are all two levels deep from the main channel node, so we need to sub-query the categories. */
|
||||
foreach( $this->db->select( '*', 'node', array( $this->db->in( 'parentid', $categories ) ) ) AS $row )
|
||||
{
|
||||
$clubs[ $row['nodeid'] ] = $row;
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e ) { /* Just in case something goofy happened and there is no main channel */ }
|
||||
|
||||
return $clubs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Types Cache
|
||||
*/
|
||||
@@ -703,7 +783,7 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
{
|
||||
$url = \IPS\Request::i()->url();
|
||||
|
||||
if( preg_match( '#(?<!topic)/([0-9]+)\-([^/]*?)#', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
|
||||
if( preg_match( '#(?<!topic|file|image)/([0-9]+)\-([^/]*?)#', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter XenForo Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -102,7 +102,8 @@ class _Xenforo extends \IPS\convert\Software
|
||||
public static function checkConf()
|
||||
{
|
||||
return array(
|
||||
'convertAttachments'
|
||||
'convertAttachments',
|
||||
'convertForumsPosts'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -117,6 +118,28 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$return = array();
|
||||
switch( $method )
|
||||
{
|
||||
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(
|
||||
'rep_like' => 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(
|
||||
@@ -523,6 +546,8 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'type_id' => $row['post_id'],
|
||||
'member_id' => $like['user_id'],
|
||||
'member_received' => $row['user_id'],
|
||||
'reaction' => $this->app->_session['more_info']['convertForumsPosts']['rep_like'],
|
||||
'rep_date' => $row['post_date']
|
||||
) );
|
||||
}
|
||||
}
|
||||
@@ -545,6 +570,8 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$latestedit = 0;
|
||||
$reason = NULL;
|
||||
$name = NULL;
|
||||
$newText = static::fixPostData( $row['message'] );
|
||||
|
||||
foreach( $this->db->select( '*', 'xf_edit_history', array( "content_type=? AND content_id=?", 'post', $row['post_id'] ) ) AS $edit )
|
||||
{
|
||||
$libraryClass->convertEditHistory( array(
|
||||
@@ -553,8 +580,11 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'comment_id' => $row['post_id'],
|
||||
'member' => $edit['edit_user_id'],
|
||||
'time' => $edit['edit_date'],
|
||||
'old' => $edit['old_text']
|
||||
'old' => static::fixPostData( $edit['old_text'] ),
|
||||
'new' => $newText
|
||||
) );
|
||||
|
||||
$newText = static::fixPostData( $edit['old_text'] );
|
||||
|
||||
if ( $edit['edit_date'] > $latestedit )
|
||||
{
|
||||
@@ -618,22 +648,15 @@ class _Xenforo extends \IPS\convert\Software
|
||||
{
|
||||
if ( $attachId !== FALSE )
|
||||
{
|
||||
$ourAttachment = \IPS\File::get( 'core_Attachment', \IPS\Db::i()->select( 'attach_location', 'core_attachments', array( 'attach_id=?', $attachId ) )->first() );
|
||||
|
||||
$pid = $this->app->getLink( $row['content_id'], 'forums_posts' );
|
||||
|
||||
$post = \IPS\Db::i()->select( 'post', 'forums_posts', array( "pid=?", $pid ) )->first();
|
||||
|
||||
if ( preg_match( "/\[ATTACH(.+?)?\]" . $row['attachment_id'] . "\[\/ATTACH\]/i", $post ) )
|
||||
{
|
||||
$post = preg_replace( "/\[ATTACH(.+?)?\]" . $row['attachment_id'] . "\[\/ATTACH\]/i", '<p><a href="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attachId . '" src="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>', $post );
|
||||
$post = preg_replace( "/\[ATTACH(.+?)?\]" . $row['attachment_id'] . "\[\/ATTACH\]/i", '[attachment=' . $attachId . ':name]', $post );
|
||||
\IPS\Db::i()->update( 'forums_posts', array( 'post' => $post ), array( "pid=?", $pid ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$post .= '<p><a href="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attachId . '" src="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>';
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'forums_posts', array( 'post' => $post ), array( "pid=?", $pid ) );
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
@@ -690,7 +713,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
}
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item instanceof \IPS\Content\Item )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
if( $item->canView() )
|
||||
{
|
||||
|
||||
Whitespace-only changes.
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Coppermine Gallery Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter PhotoPlog Gallery Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 02 October 2016
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Photopost Gallery Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 6 December 2016
|
||||
* @note Only redirect scripts are supported right now
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter vBulletin 4.x Gallery Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter XenForo Media Gallery Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @package Invision Community
|
||||
* @subpackage Converter
|
||||
* @since 21 Jan 2015
|
||||
*/
|
||||
@@ -157,6 +157,24 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_xf_gal_path'),
|
||||
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
|
||||
);
|
||||
|
||||
/* 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['convertGalleryImages']['rep_like'] = 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;
|
||||
}
|
||||
|
||||
@@ -433,7 +451,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
try
|
||||
{
|
||||
$em = \IPS\Text\Parser::embeddableMedia( $row['media_embed_url'] );
|
||||
$em = \IPS\Text\Parser::embeddableMedia( \IPS\Http\Url::createFromString( $row['media_embed_url'] ) );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
@@ -495,6 +513,8 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'type_id' => $row['media_id'],
|
||||
'member_id' => $like['user_id'],
|
||||
'member_received' => $row['user_id'],
|
||||
'reaction' => $this->app->_session['more_info']['convertGalleryImages']['rep_like'],
|
||||
'rep_date' => $row['media_date']
|
||||
) );
|
||||
}
|
||||
}
|
||||
@@ -613,6 +633,8 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'type_id' => $row['comment_id'],
|
||||
'member_id' => $like['user_id'],
|
||||
'member_received' => $row['user_id'],
|
||||
'reaction' => $this->app->_session['more_info']['convertGalleryImages']['rep_like'],
|
||||
'rep_date' => $row['comment_date']
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Reference in new issue
Block a user