Version 5.0.0 beta 4
This commit is contained in:
1 parent
e86153356a
commit
2f24f9de48
276 files changed
+8614
-6044
No files matched your search
@@ -16,6 +16,7 @@ namespace IPS\convert\Library;
|
||||
use ErrorException;
|
||||
use Exception;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\DateTime;
|
||||
use IPS\Db;
|
||||
use IPS\File;
|
||||
@@ -52,7 +53,7 @@ class Gallery extends Core
|
||||
/**
|
||||
* @brief Application
|
||||
*/
|
||||
public $app = 'gallery';
|
||||
public string $app = 'gallery';
|
||||
|
||||
/**
|
||||
* Returns an array of items that we can convert, including the amount of rows stored in the Community Suite as well as the recommend value of rows to convert per cycle
|
||||
@@ -60,7 +61,7 @@ class Gallery extends Core
|
||||
* @param bool $rowCounts enable row counts
|
||||
* @return array
|
||||
*/
|
||||
public function menuRows( $rowCounts=FALSE )
|
||||
public function menuRows( bool $rowCounts=FALSE ) : array
|
||||
{
|
||||
$return = array();
|
||||
$extraRows = $this->software->extraMenuRows();
|
||||
@@ -277,11 +278,12 @@ class Gallery extends Core
|
||||
* @param string $method Method to truncate
|
||||
* @return array
|
||||
*/
|
||||
protected function truncate( $method )
|
||||
protected function truncate( string $method ) : array
|
||||
{
|
||||
$return = array();
|
||||
$classname = get_class( $this->software );
|
||||
|
||||
/* @var Software $classname */
|
||||
if( $classname::canConvert() === NULL )
|
||||
{
|
||||
return array();
|
||||
@@ -332,15 +334,15 @@ class Gallery extends Core
|
||||
break;
|
||||
|
||||
case 'convertClubGalleryImages':
|
||||
$return['convertClubGalleryImages'] = array( 'gallery_images' => array( 'image_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_gallery_images' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
$return['convertClubGalleryImages'] = array( 'gallery_images' => array( 'image_id IN ( ' . 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) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_gallery_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
$return['convertClubGalleryComments'] = array( 'gallery_comments' => array( 'comment_id IN ( ' . 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) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_gallery_reviews' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
$return['convertClubGalleryReviews'] = array( 'gallery_reviews' => array( 'review_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_gallery_reviews' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -366,9 +368,9 @@ class Gallery extends Core
|
||||
* Convert a category
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly converted category, or FALSE on error.
|
||||
* @return int|bool The ID of the newly converted category, or FALSE on error.
|
||||
*/
|
||||
public function convertGalleryCategory( $info=array() )
|
||||
public function convertGalleryCategory( array $info=array() ) : bool|int
|
||||
{
|
||||
if ( !isset( $info['category_id'] ) )
|
||||
{
|
||||
@@ -519,10 +521,10 @@ class Gallery extends Core
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @param array|NULL $socialgroup Array of social group data, or NULL.
|
||||
* @param integer|NULL $category If the source software only has albums, and not categories, an existing category ID can be passed here to store converted albums. NULL to auto-create.
|
||||
* @return integer|boolean The ID of the newly converted album, or FALSE on error.
|
||||
* @param int|NULL $category If the source software only has albums, and not categories, an existing category ID can be passed here to store converted albums. NULL to auto-create.
|
||||
* @return int|bool The ID of the newly converted album, or FALSE on error.
|
||||
*/
|
||||
public function convertGalleryAlbum( $info=array(), $socialgroup=NULL, $category=NULL )
|
||||
public function convertGalleryAlbum( array $info=array(), ?array $socialgroup=NULL, ?int $category=NULL ) : bool|int
|
||||
{
|
||||
if ( !isset( $info['album_id'] ) )
|
||||
{
|
||||
@@ -640,7 +642,7 @@ class Gallery extends Core
|
||||
}
|
||||
|
||||
$info['album_allowed_access'] = NULL;
|
||||
if ( !is_null( $socialgroup ) AND is_array( $socialgroup ) )
|
||||
if ( is_array( $socialgroup ) )
|
||||
{
|
||||
$socialGroupId = Db::i()->insert( 'core_sys_social_groups', array( 'owner_id' => $info['album_owner_id'] ) );
|
||||
$members = array();
|
||||
@@ -678,9 +680,9 @@ class Gallery extends Core
|
||||
/**
|
||||
* Orphaned Albums Category
|
||||
*
|
||||
* @return integer Orphaned Albums Category ID
|
||||
* @return int Orphaned Albums Category ID
|
||||
*/
|
||||
protected function _orphanedAlbumsCategory()
|
||||
protected function _orphanedAlbumsCategory() : int
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -714,10 +716,10 @@ class Gallery extends Core
|
||||
*
|
||||
* @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.
|
||||
* @param string|NULL $filedata The binary data for the image, or NULL
|
||||
* @return int|bool The ID of the newly inserted image, or FALSE on failure.
|
||||
*/
|
||||
public function convertGalleryImage( $info=array(), $filepath=NULL, $filedata=NULL )
|
||||
public function convertGalleryImage( array $info=array(), ?string $filepath=NULL, ?string $filedata=NULL ) : bool|int
|
||||
{
|
||||
if ( !isset( $info['image_id'] ) )
|
||||
{
|
||||
@@ -759,7 +761,7 @@ class Gallery extends Core
|
||||
$info['image_album_id'] = 0;
|
||||
}
|
||||
|
||||
if ( isset( $info['image_category_id'] ) AND $categoryFound == FALSE )
|
||||
if ( isset( $info['image_category_id'] ) AND !$categoryFound )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -772,7 +774,7 @@ class Gallery extends Core
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $categoryFound == FALSE )
|
||||
if ( !$categoryFound )
|
||||
{
|
||||
$info['image_category_id'] = $this->_orphanedAlbumsCategory();
|
||||
}
|
||||
@@ -918,17 +920,12 @@ class Gallery extends Core
|
||||
$info['image_file_size'] = $image->filesize();
|
||||
}
|
||||
}
|
||||
catch( Exception $e )
|
||||
catch( Exception|ErrorException $e )
|
||||
{
|
||||
$this->software->app->log( $e->getMessage(), __METHOD__, App::LOG_WARNING, $info['image_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
catch( ErrorException $e )
|
||||
{
|
||||
$this->software->app->log( $e->getMessage(), __METHOD__, App::LOG_WARNING, $info['image_id'] );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if ( !isset( $info['image_approved'] ) )
|
||||
{
|
||||
$info['image_approved'] = 1;
|
||||
@@ -1076,9 +1073,9 @@ class Gallery extends Core
|
||||
* Convert an album comment
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
|
||||
* @return int|bool The ID of the newly inserted comment, or FALSE on failure.
|
||||
*/
|
||||
public function convertGalleryAlbumComment( $info=array() )
|
||||
public function convertGalleryAlbumComment( array $info=array() ) : bool|int
|
||||
{
|
||||
if ( !isset( $info['comment_id'] ) )
|
||||
{
|
||||
@@ -1197,9 +1194,9 @@ class Gallery extends Core
|
||||
* Convert an album review
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted reiew, or FALSE on failure.
|
||||
* @return int|bool The ID of the newly inserted reiew, or FALSE on failure.
|
||||
*/
|
||||
public function convertGalleryAlbumReview( $info=array() )
|
||||
public function convertGalleryAlbumReview( array $info=array() ) : bool|int
|
||||
{
|
||||
if ( !isset( $info['review_id'] ) )
|
||||
{
|
||||
@@ -1384,9 +1381,9 @@ class Gallery extends Core
|
||||
* Convert a comment
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted comment, or FALSE on failure.
|
||||
* @return int|bool The ID of the newly inserted comment, or FALSE on failure.
|
||||
*/
|
||||
public function convertGalleryComment( $info=array() )
|
||||
public function convertGalleryComment( array $info=array() ) : bool|int
|
||||
{
|
||||
if ( !isset( $info['comment_id'] ) )
|
||||
{
|
||||
@@ -1505,9 +1502,9 @@ class Gallery extends Core
|
||||
* Convert a review
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted reiew, or FALSE on failure.
|
||||
* @return int|bool The ID of the newly inserted reiew, or FALSE on failure.
|
||||
*/
|
||||
public function convertGalleryReview( $info=array() )
|
||||
public function convertGalleryReview( array $info=array() ) : bool|int
|
||||
{
|
||||
if ( !isset( $info['review_id'] ) )
|
||||
{
|
||||
@@ -1696,9 +1693,9 @@ class Gallery extends Core
|
||||
* @param string|NULL $filepath The path to the attachment, or NULL.
|
||||
* @param string|NULL $filedata The binary data of the attachment, or NULL.
|
||||
* @param string|NULL $thumbnailpath Path to thumbnail, or NULL.
|
||||
* @return integer|boolean The ID of the newly inserted attachment, or FALSE on failure.
|
||||
* @return int|bool The ID of the newly inserted attachment, or FALSE on failure.
|
||||
*/
|
||||
public function convertAttachment( $info=array(), $map=array(), $filepath=NULL, $filedata=NULL, $thumbnailpath = NULL )
|
||||
public function convertAttachment( array $info=array(), array $map=array(), ?string $filepath=NULL, ?string $filedata=NULL, ?string $thumbnailpath = NULL ) : bool|int
|
||||
{
|
||||
$map['location_key'] = 'gallery_Gallery';
|
||||
$map['id1_type'] = 'gallery_images';
|
||||
@@ -1726,9 +1723,9 @@ class Gallery extends Core
|
||||
* 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.
|
||||
* @return int|bool The ID of the newly inserted category, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubGalleryCategory( $info=array() )
|
||||
public function convertClubGalleryCategory( array $info=array() ) : bool|int
|
||||
{
|
||||
$insertedId = $this->convertGalleryCategory( $info );
|
||||
if ( $insertedId )
|
||||
@@ -1744,9 +1741,9 @@ class Gallery extends Core
|
||||
* @param array $info Data to insert
|
||||
* @param string|NULL $filepath The path to the image, or NULL.
|
||||
* @param string|NULL $filedata The binary data for the image, or NULL
|
||||
* @return integer|boolean The ID of the newly inserted image, or FALSE on failure.
|
||||
* @return int|bool The ID of the newly inserted image, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubGalleryImage( $info=array(), $filepath=NULL, $filedata=NULL )
|
||||
public function convertClubGalleryImage( array $info=array(), ?string $filepath=NULL, ?string $filedata=NULL ) : bool|int
|
||||
{
|
||||
$insertedId = $this->convertGalleryImage( $info, $filepath, $filedata );
|
||||
if ( $insertedId )
|
||||
@@ -1760,9 +1757,9 @@ class Gallery extends Core
|
||||
* 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.
|
||||
* @return int|bool The ID of the newly inserted comment, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubGalleryComment( $info=array() )
|
||||
public function convertClubGalleryComment( array $info=array() ) : bool|int
|
||||
{
|
||||
$insertedId = $this->convertGalleryComment( $info );
|
||||
if ( $insertedId )
|
||||
@@ -1776,9 +1773,9 @@ class Gallery extends Core
|
||||
* 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.
|
||||
* @return int|bool The ID of the newly inserted review, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubGalleryReview( $info=array() )
|
||||
public function convertClubGalleryReview( array $info=array() ) : bool|int
|
||||
{
|
||||
$insertedId = $this->convertGalleryReview( $info );
|
||||
if ( $insertedId )
|
||||
|
||||
Reference in new issue
Block a user