Version 4.7.0

This commit is contained in:
Neo committed 2025-12-19 16:00:35 -08:00
1 parent 517a5e1f70
commit 8ba7d43898
1933 files changed
+65613 -11332

No files matched your search

+51 -33
View File
@@ -671,7 +671,7 @@ class _Core extends \IPS\convert\Library
break;
case 'convertPrivateMessages':
$return['convertPrivateMessages'] = array( 'core_message_topics' => NULL, 'core_message_topic_user_map' => NULL );
$return['convertPrivateMessages'] = array( 'core_message_topics' => NULL, 'core_message_topic_user_map' => NULL, 'core_message_posts' => NULL );
break;
case 'convertPrivateMessageReplies':
@@ -856,7 +856,7 @@ class _Core extends \IPS\convert\Library
{
$imageData = file_get_contents( $imagePath );
}
$file = \IPS\File::create( 'core_Badges', $info['icon'], $imageData, NULL, FALSE, NULL, FALSE );
$file = \IPS\File::create( 'core_Ranks', $info['icon'], $imageData, NULL, FALSE, NULL, FALSE );
$info['icon'] = (string) $file;
}
catch( \ErrorException | \Exception $e )
@@ -1095,6 +1095,16 @@ class _Core extends \IPS\convert\Library
$info['announce_location'] = '*';
}
if ( !isset( $info['announce_permissions'] ) )
{
$info['announce_permissions'] = '*';
}
if ( !isset( $info['announce_color'] ) )
{
$info['announce_color'] = 'none';
}
if ( !isset( $info['announce_page_location'] ) )
{
$info['announce_page_location'] = array( 'sidebar' );
@@ -2975,7 +2985,7 @@ class _Core extends \IPS\convert\Library
{
$group = \IPS\Member\Group::load( $info['ips_group_id'] )->g_id;
}
catch( \ OutOfRangeException $ex ) {}
catch( \OutOfRangeException $ex ) {}
unset( $info['ips_group_id'] );
}
@@ -3352,23 +3362,23 @@ class _Core extends \IPS\convert\Library
{
try
{
$container = 'monthly_' . date( 'Y', $info['joined'] ) . '_' . date( 'm', $info['joined'] );
if ( \is_null( $profileFileData ) AND !\is_null( $profilePhotoPath ) )
{
$profileFileData = file_get_contents( rtrim( $profilePhotoPath, '/' ) . '/' . $profilePhotoName );
\IPS\File::$copyFiles = TRUE;
$photo = \IPS\File::create( 'core_Profile', $profilePhotoName, NULL, $container, FALSE, rtrim( $profilePhotoPath, '/' ) . '/' . $profilePhotoName );
\IPS\File::$copyFiles = FALSE;
}
$photo = \IPS\File::create( 'core_Profile', $profilePhotoName, $profileFileData );
else
{
$photo = \IPS\File::create( 'core_Profile', $profilePhotoName, $profileFileData, $container );
}
$info['pp_photo_type'] = 'custom';
$info['pp_main_photo'] = (string) $photo;
$info['pp_thumb_photo'] = (string) $photo->thumbnail( 'core_Profile', \IPS\PHOTO_THUMBNAIL_SIZE, \IPS\PHOTO_THUMBNAIL_SIZE, TRUE );
$info['pp_thumb_photo'] = NULL;
}
catch( \Exception $e )
{
$info['pp_photo_type'] = '';
$info['pp_main_photo'] = NULL;
$info['pp_thumb_photo'] = NULL;
}
catch( \ErrorException $e )
catch( \ErrorException | \Exception $e )
{
$info['pp_photo_type'] = '';
$info['pp_main_photo'] = NULL;
@@ -3396,12 +3406,7 @@ class _Core extends \IPS\convert\Library
/* Designs are different so this will never likely be correct, we'll try it if one is supplied though */
$info['pp_cover_offset'] = isset( $info['pp_cover_offset'] ) ? $info['pp_cover_offset'] : 0;
}
catch( \Exception $e )
{
$info['pp_cover_photo'] = '';
$info['pp_cover_offset'] = 0;
}
catch( \ErrorException $e )
catch( \ErrorException | \Exception $e )
{
$info['pp_cover_photo'] = '';
$info['pp_cover_offset'] = 0;
@@ -3484,6 +3489,11 @@ class _Core extends \IPS\convert\Library
{
$info['member_posts'] = 0;
}
/* If number is larger than the field we have */
elseif( $info['member_posts'] > 8388606 )
{
$info['member_posts'] = 0;
}
if ( isset( $info['member_last_post'] ) )
{
@@ -4013,7 +4023,7 @@ class _Core extends \IPS\convert\Library
if ( \count( $maps ) == 0 )
{
$this->software->app->log( 'private_message_topic_no_users', __METHOD__, \IPS\convert\App::LOG_WARNING );
$this->software->app->log( 'private_message_topic_no_users', __METHOD__, \IPS\convert\App::LOG_WARNING, $topic['mt_id'] );
return FALSE;
}
@@ -4369,16 +4379,24 @@ class _Core extends \IPS\convert\Library
{
$info['perms'] = json_encode( $info['perms'] );
}
switch( $info['type'] )
try
{
case 'm':
$info['id'] = $this->software->app->getLink( $info['id'], 'core_members' );
break;
case 'g':
$info['id'] = $this->software->app->getLink( $info['id'], 'core_groups' );
break;
switch( $info['type'] )
{
case 'm':
$info['id'] = $this->software->app->getLink( $info['id'], 'core_members' );
break;
case 'g':
$info['id'] = $this->software->app->getLink( $info['id'], 'core_groups' );
break;
}
}
catch( \OutOfRangeException $e )
{
$this->software->app->log( 'moderator_missing', __METHOD__, \IPS\convert\App::LOG_WARNING, $info['id'] );
return FALSE;
}
try
@@ -6150,11 +6168,11 @@ class _Core extends \IPS\convert\Library
* Convert an RSS Imported Item... or try to, anyway.
*
* @param array $info Data to insert
* @param array $contentType Content Link Type
* @param string $type Link type for RSS Feed
* @param mixed $contentType Content Link Type
* @return boolean TRUE on success, or FALSE on failure.
*/
public function convertRssImported( $info=array(), $contentType, $type='core_rss_import' )
public function convertRssImported( $info=array(), $type='core_rss_import', $contentType )
{
/* Godspeed */
if ( isset( $info['rss_imported_import_id'] ) )
@@ -6285,7 +6303,7 @@ class _Core extends \IPS\convert\Library
$info['tag_member_id'] = 0;
}
if ( isset( $info['tag_added'] ) )
if ( !empty( $info['tag_added'] ) )
{
if ( $info['tag_added'] instanceof \IPS\DateTime )
{
@@ -140,7 +140,7 @@ class _Downloads extends Core
$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" ) ) ) ) ),
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files', array( \IPS\Db::i()->in( 'file_cat', \IPS\Db::i()->select( 'cid', 'downloads_categories', array( "cclub_id IS NOT NULL" ) ) ) ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 10,
'dependencies' => array( 'convertClubDownloadsCategories' ),
@@ -152,7 +152,7 @@ class _Downloads extends Core
$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" ) ) ) ) ) ) ) ),
'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_cat', \IPS\Db::i()->select( 'cid', 'downloads_categories', array( "cclub_id IS NOT NULL" ) ) ) ) ) ) ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 200,
'dependencies' => array( 'convertClubDownloadsFiles' ),
@@ -164,7 +164,7 @@ class _Downloads extends Core
$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" ) ) ) ) ) ) ) ),
'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_cat', \IPS\Db::i()->select( 'cid', 'downloads_categories', array( "cclub_id IS NOT NULL" ) ) ) ) ) ) ) ),
'source_rows' => array( 'table' => $v['table'], 'where' => $v['where'] ),
'per_cycle' => 200,
'dependencies' => array( 'convertClubDownloadsFiles' ),
@@ -385,13 +385,15 @@ class _Downloads extends Core
$id = $info['cf_id'];
$fieldName = isset( $info['cf_name'] ) ? $info['cf_name'] : NULL;
unset( $info['cf_id'], $info['cf_name'] );
$fieldDescription = isset( $info['cf_desc'] ) ? $info['cf_desc'] : NULL;
unset( $info['cf_id'], $info['cf_name'], $info['cf_desc'] );
$inserted_id = \IPS\Db::i()->insert( 'downloads_cfields', $info );
$this->software->app->addLink( $inserted_id, $id, 'downloads_cfields' );
/* Field Name */
\IPS\Lang::saveCustom( 'downloads', "downloads_field_{$inserted_id}", $fieldName ?: "Converted Field {$inserted_id}" );
\IPS\Lang::saveCustom( 'downloads', "downloads_field_{$inserted_id}_desc", $fieldDescription ?: '' );
/* Now... create our column */
$columnDefinition = array( 'name' => "field_{$inserted_id}" );
@@ -658,7 +660,7 @@ class _Downloads extends Core
$info['ctypes'] = NULL;
}
if ( !isset( $info['csortorder'] ) OR !\in_array( $info['csortoder'], array( 'updated', 'last_comment', 'title', 'rating', 'date', 'num_comments', 'num_reviews', 'views' ) ) )
if ( !isset( $info['csortorder'] ) OR !\in_array( $info['csortorder'], array( 'updated', 'last_comment', 'title', 'rating', 'date', 'num_comments', 'num_reviews', 'views' ) ) )
{
$info['csortorder'] = 'updated';
}
@@ -1042,6 +1044,7 @@ class _Downloads extends Core
/* Now our records */
$totalFileSize = 0;
$primaryScreenshot = FALSE;
foreach( $records AS $record )
{
/* We don't really need this */
@@ -1080,6 +1083,18 @@ class _Downloads extends Core
$record['record_realname'] = $fileName;
}
}
if ( isset( $record['record_time'] ) )
{
if ( $record['record_time'] instanceof \IPS\DateTime )
{
$record['record_time'] = $record['record_time']->getTimestamp();
}
}
else
{
$record['record_time'] = $info['file_submitted'];
}
try
{
@@ -1088,6 +1103,9 @@ class _Downloads extends Core
$record['file_data'] = NULL;
}
/* Figure out the container */
$container = 'monthly_' . date( 'Y', $record['record_time'] ) . '_' . date( 'm', $record['record_time'] );
/* We need the file storage to copy the file rather than move it */
\IPS\File::$copyFiles = TRUE;
@@ -1098,7 +1116,7 @@ class _Downloads extends Core
}
else if ( $record['record_type'] == 'upload' )
{
$file = \IPS\File::create( 'downloads_Files', $record['record_realname'], $record['file_data'], NULL, TRUE, $record['file_path'] );
$file = \IPS\File::create( 'downloads_Files', $record['record_realname'], $record['file_data'], $container, TRUE, $record['file_path'] );
$record['record_location'] = (string) $file;
$record['record_size'] = $file->filesize();
@@ -1109,7 +1127,7 @@ class _Downloads extends Core
}
else
{
$file = \IPS\File::create( 'downloads_Screenshots', $record['record_realname'], $record['file_data'], NULL, TRUE, $record['file_path'] );
$file = \IPS\File::create( 'downloads_Screenshots', $record['record_realname'], $record['file_data'], $container, TRUE, $record['file_path'] );
$record['record_location'] = (string) $file;
$record['record_thumb'] = (string) $file->thumbnail( 'downloads_Screenshots' );
$record['record_size'] = $file->filesize();
@@ -1130,18 +1148,6 @@ class _Downloads extends Core
\IPS\File::$copyFiles = FALSE;
unset( $record['file_data'], $file, $record['file_path'] );
if ( isset( $record['record_time'] ) )
{
if ( $record['record_time'] instanceof \IPS\DateTime )
{
$record['record_time'] = $record['record_time']->getTimestamp();
}
}
else
{
$record['record_time'] = $info['file_submitted'];
}
if ( $hasId )
{
$recordId = $record['record_id'];
@@ -1709,7 +1709,7 @@ class _Forums extends Core
*/
public function convertForumsRssImported( $info=array() )
{
return parent::convertRssImported( $info, 'forums_topics', 'forums_rss_import' );
return parent::convertRssImported( $info, 'forums_rss_import', 'forums_topics' );
}
/**
@@ -406,13 +406,13 @@ class _Gallery extends Core
/* Album Sort Order */
$sortOrders = array( 'album_last_img_date', 'album_last_comment', 'album_rating_aggregate', 'album_comments','album_reviews', 'album_name', 'album_count_comments', 'album_count_imgs' );
if ( !isset( $info['category_sort_options'] ) OR !in_array( $info['category_sort_options'], $sortOrders ) )
if ( !isset( $info['category_sort_options'] ) OR !\in_array( $info['category_sort_options'], $sortOrders ) )
{
$info['category_sort_options'] = 'album_last_img_date';
}
/* Image Sort Order */
if ( !isset( $info['category_sort_options_img'] ) OR !in_array( $info['category_sort_options_img'], array( 'updated', 'last_comment', 'title', 'rating', 'date', 'num_comments', 'num_reviews', 'views' ) ) )
if ( !isset( $info['category_sort_options_img'] ) OR !\in_array( $info['category_sort_options_img'], array( 'updated', 'last_comment', 'title', 'rating', 'date', 'num_comments', 'num_reviews', 'views' ) ) )
{
$info['category_sort_options_img'] = 'updated';
}
@@ -869,6 +869,7 @@ class _Gallery extends Core
if( isset( $info['image_container'] ) )
{
$container = $info['image_container'];
unset( $info['image_container'] );
}
/* Okay, let's create our image. We can use data returned from this later if it's missing. */