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

@@ -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'];