Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

@@ -12,16 +12,28 @@
namespace IPS\convert\Software\Gallery;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use DomainException;
use IPS\convert\Software;
use IPS\Db;
use IPS\Member;
use IPS\Patterns\ActiveRecordIterator;
use IPS\Task;
use function defined;
use function intval;
use function is_array;
use function unserialize;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Photoplog Gallery Converter
*/
class _Photoplog extends \IPS\convert\Software
class Photoplog extends Software
{
/**
* Software Name
@@ -113,11 +125,11 @@ class _Photoplog extends \IPS\convert\Software
public function finish()
{
/* Content Rebuilds */
\IPS\Task::queue( 'convert', 'RebuildGalleryImages', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'gallery_comments', 'class' => 'IPS\gallery\Image\Comment' ), 2, array( 'app', 'link', 'class' ) );
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\gallery\Image' ), 3, array( 'class' ) );
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Album', 'count' => 0 ), 4, array( 'class' ) );
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Category', 'count' => 0 ), 5, array( 'class' ) );
Task::queue( 'convert', 'RebuildGalleryImages', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'gallery_comments', 'class' => 'IPS\gallery\Image\Comment' ), 2, array( 'app', 'link', 'class' ) );
Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\gallery\Image' ), 3, array( 'class' ) );
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Album', 'count' => 0 ), 4, array( 'class' ) );
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Category', 'count' => 0 ), 5, array( 'class' ) );
return array( "f_gallery_images_rebuild", "f_gallery_cat_recount", "f_gallery_album_recount", "f_gallery_image_recount" );
}
@@ -135,7 +147,7 @@ class _Photoplog extends \IPS\convert\Software
{
case 'convertGalleryAlbums':
$options = array();
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'gallery_categories' ), 'IPS\gallery\Category' ) AS $category )
foreach( new ActiveRecordIterator( Db::i()->select( '*', 'gallery_categories' ), 'IPS\gallery\Category' ) AS $category )
{
$options[ $category->_id ] = $category->_title;
}
@@ -156,8 +168,8 @@ class _Photoplog extends \IPS\convert\Software
'field_default' => NULL,
'field_required' => TRUE,
'field_extra' => array(),
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_photoplog_hint'),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
'field_hint' => Member::loggedIn()->language()->addToStack('convert_photoplog_hint'),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new DomainException( 'path_invalid' ); } },
);
break;
}
@@ -235,10 +247,10 @@ class _Photoplog extends \IPS\convert\Software
foreach( $this->fetch( 'fileuploads', 'fileid' ) AS $row )
{
$album = \unserialize( $row['albumids'] );
$album = unserialize( $row['albumids'] );
$albumId = NULL;
if( \is_array( $album ) )
if( is_array( $album ) )
{
$albumId = $album[0];
}
@@ -253,9 +265,9 @@ class _Photoplog extends \IPS\convert\Software
'image_comments' => $row['num_comments0'] + $row['num_comments1'],
'image_ratings_total' => $row['sum_ratings1'],
'image_ratings_count' => $row['num_ratings1'],
'image_rating' => $row['num_ratings1'] > 0 ? \intval( $row['sum_ratings1'] / $row['num_ratings1'] ) : 0,
'image_rating' => $row['num_ratings1'] > 0 ? intval( $row['sum_ratings1'] / $row['num_ratings1'] ) : 0,
'image_date' => $row['dateline'],
'image_metadata' => json_encode( \unserialize( $row['exifinfo'] ) ),
'image_metadata' => json_encode( unserialize( $row['exifinfo'] ) ),
'image_file_name' => $row['filename'],
'image_description' => $row['description'],
'image_approved' => $row['moderate'] == 1 ? 0 : 1,