Version 5.0.0 beta 4

This commit is contained in:
Neo committed 2025-12-19 16:57:00 -08:00
1 parent e86153356a
commit 2f24f9de48
276 files changed
+8614 -6044

No files matched your search

+37 -49
View File
@@ -17,6 +17,7 @@ use ErrorException;
use Exception;
use IPS\blog\Blog as BlogClass;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\DateTime;
use IPS\Db;
use IPS\File;
@@ -48,7 +49,7 @@ class Blog extends Core
/**
* @brief Application
*/
public $app = 'blog';
public string $app = 'blog';
/**
* 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
@@ -56,7 +57,7 @@ class Blog 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();
@@ -213,11 +214,12 @@ class Blog extends Core
* @param string $method Method we are truncating
* @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();
@@ -253,8 +255,7 @@ class Blog extends Core
break;
case 'convertAttachments':
$return['convertAttachments'] = array(
'core_attachments' => Db::i()->in( 'attach_id', (string) Db::i()->select( 'attachment_id', 'core_attachments_map', array( "location_key=?", 'blog_Entries' ) ) ),
$return['convertAttachments'] = array( 'core_attachments' => array( 'attach_id IN ( ' . Db::i()->select( 'attachment_id', 'core_attachments_map', array( "location_key=?", 'blog_Entries' ) ) . ')' ),
'core_attachments_map' => array( "location_key=?", 'blog_Entries' )
);
break;
@@ -264,11 +265,11 @@ class Blog extends Core
break;
case 'convertClubBlogEntries':
$return['convertClubBlogEntries'] = array( 'blog_entries' => array( 'entry_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_blog_entries' AND app={$this->software->app->app_id}" ) ) . ')' ) );
$return['convertClubBlogEntries'] = array( 'blog_entries' => array( 'entry_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_blog_entries' AND app={$this->software->app->app_id}" ) ) . ')' ) );
break;
case 'convertClubBlogComments':
$return['convertClubBlogComments'] = array( 'blog_comments' => array( 'comment_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_blog_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
$return['convertClubBlogComments'] = array( 'blog_comments' => array( 'comment_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_blog_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
break;
}
}
@@ -295,11 +296,11 @@ class Blog extends Core
*
* @param array $info Array of blog information
* @param array|NULL $socialgroup Array of data to be stored in core_sys_social_groups and core_sys_social_group_members
* @param string|NULL|boolean $filepath URL/Path to cover photo, NULL to use raw file data, or FALSE to not convert
* @param string|NULL|bool $filepath URL/Path to cover photo, NULL to use raw file data, or FALSE to not convert
* @param string|NULL $filedata If $filepath is NULL, this should contain the raw contents of the cover photo
* @return integer|boolean The ID of the inserted blog, or FALSE on failure.
* @return int|bool The ID of the inserted blog, or FALSE on failure.
*/
public function convertBlog( array $info, $socialgroup=NULL, $filepath=FALSE, $filedata=NULL )
public function convertBlog( array $info, ?array $socialgroup=NULL, string|null|bool $filepath=FALSE, ?string $filedata=NULL ) : bool|int
{
if ( !isset( $info['blog_id'] ) )
{
@@ -497,7 +498,7 @@ class Blog extends Core
/* Well update this later if we need too */
$info['blog_social_group'] = 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['blog_member_id'] ) );
$members = array();
@@ -532,12 +533,7 @@ class Blog extends Core
$info['blog_cover_photo'] = (string) $file;
$info['blog_cover_photo_offset'] = 0;
}
catch( Exception $e )
{
$info['blog_cover_photo'] = NULL;
$info['blog_cover_photo_offset'] = NULL;
}
catch( ErrorException $e )
catch( Exception|ErrorException $e )
{
$info['blog_cover_photo'] = NULL;
$info['blog_cover_photo_offset'] = NULL;
@@ -609,9 +605,9 @@ class Blog extends Core
* Convert a Blog Category
*
* @param array $info Array of blog information
* @return integer|boolean The ID of the inserted category, or FALSE on failure.
* @return int|bool The ID of the inserted category, or FALSE on failure.
*/
public function convertBlogCategory( array $info )
public function convertBlogCategory( array $info ) : bool|int
{
if ( !isset( $info['category_id'] ) )
{
@@ -693,9 +689,9 @@ class Blog extends Core
* @param array $info Array of entry information
* @param string|NULL $filepath Path to the Cover Photo, or NULL
* @param string|NULL $filedata Binary data for cover photo, or NULL
* @return integer|boolean The ID of the inserted entry, or FALSE on failure
* @return int|bool The ID of the inserted entry, or FALSE on failure
*/
public function convertBlogEntry( array $info, $filepath=NULL, $filedata=NULL )
public function convertBlogEntry( array $info, ?string $filepath=NULL, ?string $filedata=NULL ) : bool|int
{
if ( !isset( $info['entry_id'] ) )
{
@@ -953,9 +949,9 @@ class Blog extends Core
* Convert a Blog Entry Category
*
* @param array $info Array of blog information
* @return integer|boolean The ID of the inserted category, or FALSE on failure.
* @return int|bool The ID of the inserted category, or FALSE on failure.
*/
public function convertBlogEntryCategory( array $info )
public function convertBlogEntryCategory( array $info ) : bool|int
{
if ( !isset( $info['entry_category_id'] ) )
{
@@ -969,19 +965,11 @@ class Blog extends Core
return FALSE;
}
if ( isset( $info['entry_category_blog_id'] ) )
try
{
try
{
$info['entry_category_blog_id'] = $this->software->app->getLink( $info['entry_category_blog_id'], 'blog_blogs' );
}
catch( OutOfRangeException $e )
{
$this->software->app->log( 'blog_entry_category_missing_blog_id', __METHOD__, App::LOG_WARNING, $info['entry_category_id'] );
return FALSE;
}
$info['entry_category_blog_id'] = $this->software->app->getLink( $info['entry_category_blog_id'], 'blog_blogs' );
}
else
catch( OutOfRangeException $e )
{
$this->software->app->log( 'blog_entry_category_missing_blog_id', __METHOD__, App::LOG_WARNING, $info['entry_category_id'] );
return FALSE;
@@ -1027,9 +1015,9 @@ class Blog extends Core
* Convert a blog comment
*
* @param array $info Array of comment information
* @return integer|boolean The ID of the inserted comment, or FALSE on failure.
* @return int|bool The ID of the inserted comment, or FALSE on failure.
*/
public function convertBlogComment( array $info )
public function convertBlogComment( array $info ) : bool|int
{
if ( !isset( $info['comment_id'] ) )
{
@@ -1148,9 +1136,9 @@ class Blog extends Core
* Convert a blog RSS import
*
* @param array $info Array of RSS Import information
* @return integer|boolean The ID of the inserted RSS import, or FALSE on failure
* @return int|bool The ID of the inserted RSS import, or FALSE on failure
*/
public function convertBlogRssImport( array $info )
public function convertBlogRssImport( array $info ) : bool|int
{
$info['rss_import_class'] = 'IPS\\blogs\\Entry';
@@ -1165,13 +1153,13 @@ class Blog extends Core
* @param string|NULL $filepath URL/Path to attachment or NULL to use raw file data
* @param string|NULL $filedata If $filepath is NULL, this should contain the raw contents of the attachment
* @param string|NULL $thumbnailpath Path to thumbnail, or NULL
* @return integer|boolean The ID of the inserted attachment, or FALSE on failure.
* @return int|bool The ID of the 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['id1_type'] = 'blog_entries';
$map['id1_from_parent'] = FALSE;
if ( !isset( $map['id2'] ) OR is_null( $map['id2'] ) )
if ( !isset( $map['id2'] ) OR empty( $map['id2'] ) )
{
$map['location_key'] = 'blog_Entries';
}
@@ -1194,9 +1182,9 @@ class Blog extends Core
* Convert Club Blog
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly insertd blog, or FALSE on failure.
* @return int|bool The ID of the newly insertd blog, or FALSE on failure.
*/
public function convertClubBlog( $info=array() )
public function convertClubBlog( array $info=array() ) : bool|int
{
$insertedId = $this->convertBlog( $info );
if ( $insertedId )
@@ -1210,9 +1198,9 @@ class Blog extends Core
* Convert a Club Blog Entry
*
* @param array $info Data to insert
* @return integer|boolean The ID of the newly inserted entry, or FALSE on failure.
* @return int|bool The ID of the newly inserted entry, or FALSE on failure.
*/
public function convertClubBlogEntry( $info=array() )
public function convertClubBlogEntry( array $info=array() ) : bool|int
{
$insertedId = $this->convertBlogEntry( $info );
if ( $insertedId )
@@ -1226,9 +1214,9 @@ class Blog extends Core
* Convert a Club Blog 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 convertClubBlogComment( $info=array() )
public function convertClubBlogComment( array $info=array() ) : bool|int
{
$insertedId = $this->convertBlogComment( $info );
if ( $insertedId )
@@ -1241,9 +1229,9 @@ class Blog extends Core
/**
* Get Parent ID for Orphaned Blogs
*
* @return integer The ID of the forum created for forums that do not have a parent forum.
* @return int The ID of the forum created for forums that do not have a parent forum.
*/
protected function _getOrphanedBlogCategory()
protected function _getOrphanedBlogCategory() : int
{
try
{