Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

@@ -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;
}
}