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 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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user