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
@@ -17,6 +17,7 @@ use ErrorException;
|
||||
use Exception;
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\DateTime;
|
||||
use IPS\Db;
|
||||
use IPS\downloads\Category;
|
||||
@@ -48,7 +49,7 @@ class Downloads extends Core
|
||||
/**
|
||||
* @brief Application
|
||||
*/
|
||||
public $app = 'downloads';
|
||||
public string $app = 'downloads';
|
||||
|
||||
/**
|
||||
* 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 Downloads 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();
|
||||
@@ -244,11 +245,12 @@ class Downloads 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();
|
||||
@@ -299,15 +301,15 @@ class Downloads extends Core
|
||||
break;
|
||||
|
||||
case 'convertClubDownloadsFiles':
|
||||
$return['convertClubDownloadsFiles'] = array( 'downloads_files' => array( 'file_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_files' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
$return['convertClubDownloadsFiles'] = array( 'downloads_files' => array( 'file_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_files' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
|
||||
case 'convertClubDownloadsComments':
|
||||
$return['convertClubDownloadsComments'] = array( 'downloads_comments' => array( 'comment_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
$return['convertClubDownloadsComments'] = array( 'downloads_comments' => array( 'comment_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_comments' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
|
||||
case 'convertClubDownloadsReviews':
|
||||
$return['convertClubDownloadsFiles'] = array( 'downloads_reviews' => array( 'review_id IN ( ' . (string) Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_reviews' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
$return['convertClubDownloadsFiles'] = array( 'downloads_reviews' => array( 'review_id IN ( ' . Db::i()->select( 'ipb_id', 'convert_link', array( "type='core_clubs_downloads_reviews' AND app={$this->software->app->app_id}" ) ) . ')' ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -323,9 +325,9 @@ class Downloads extends Core
|
||||
|
||||
/**
|
||||
* A note on logging -
|
||||
* If the data is missing and it is unlikely that any source software would be able to provide this, we do not need to log anything and can use default data (for example, group_layout in convertLeaderGroups).
|
||||
* If the data is missing and it is likely that a majority of the source software can provide this, we should log a NOTICE and use default data (for example, a_casesensitive in convertAcronyms).
|
||||
* If the data is missing and it is required to convert the item, we should log a WARNING and return FALSE.
|
||||
* If the data is missing, and it is unlikely that any source software would be able to provide this, we do not need to log anything and can use default data (for example, group_layout in convertLeaderGroups).
|
||||
* If the data is missing, and it is likely that a majority of the source software can provide this, we should log a NOTICE and use default data (for example, a_casesensitive in convertAcronyms).
|
||||
* If the data is missing, and it is required to convert the item, we should log a WARNING and return FALSE.
|
||||
* If the conversion absolutely cannot proceed at all (filestorage locations not writable, for example), then we should log an ERROR and throw an \IPS\convert\Exception to completely halt the process and redirect to an error screen showing the last logged error.
|
||||
*/
|
||||
|
||||
@@ -333,9 +335,9 @@ class Downloads extends Core
|
||||
* Convert a Custom Field
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted field, or FALSE on failure.
|
||||
* @return int|bool The ID of the newly inserted field, or FALSE on failure.
|
||||
*/
|
||||
public function convertDownloadsCfield( $info=array() )
|
||||
public function convertDownloadsCfield( array $info=array() ) : bool|int
|
||||
{
|
||||
$validFields = array_merge( static::$fieldTypes, Field::$additionalFieldTypes );
|
||||
|
||||
@@ -406,8 +408,8 @@ class Downloads extends Core
|
||||
}
|
||||
|
||||
$id = $info['cf_id'];
|
||||
$fieldName = isset( $info['cf_name'] ) ? $info['cf_name'] : NULL;
|
||||
$fieldDescription = isset( $info['cf_desc'] ) ? $info['cf_desc'] : NULL;
|
||||
$fieldName = $info['cf_name'] ?? NULL;
|
||||
$fieldDescription = $info['cf_desc'] ?? NULL;
|
||||
unset( $info['cf_id'], $info['cf_name'], $info['cf_desc'] );
|
||||
|
||||
$inserted_id = Db::i()->insert( 'downloads_cfields', $info );
|
||||
@@ -511,7 +513,7 @@ class Downloads extends Core
|
||||
* @param array $fieldInfo The Custom Field Information to format. This SHOULD be in $foreign_id => $content format, however field_$foreign_id => $content is also accepted.
|
||||
* @return array An array of data formatted for downloads_ccontent
|
||||
*/
|
||||
protected function _formatCustomFieldContent( $file_id, $fieldInfo )
|
||||
protected function _formatCustomFieldContent( int $file_id, array $fieldInfo ) : array
|
||||
{
|
||||
$return = array( 'file_id' => $file_id );
|
||||
|
||||
@@ -549,9 +551,9 @@ class Downloads extends Core
|
||||
* Convert a 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 convertDownloadsCategory( $info=array() )
|
||||
public function convertDownloadsCategory( array $info=array() ) : bool|int
|
||||
{
|
||||
if ( !isset( $info['cid'] ) )
|
||||
{
|
||||
@@ -799,9 +801,9 @@ class Downloads extends Core
|
||||
* @param array $info Data to insert
|
||||
* @param array $records Record Data to insert
|
||||
* @param array $customFields Custom Field Data to insert
|
||||
* @return integer|boolean The ID of the newly inserted file, or FALSE on failure.
|
||||
* @return int|bool The ID of the newly inserted file, or FALSE on failure.
|
||||
*/
|
||||
public function convertDownloadsFile( $info=array(), $records=array(), $customFields=array() )
|
||||
public function convertDownloadsFile( array $info=array(), array $records=array(), array $customFields=array() ) : bool|int
|
||||
{
|
||||
if ( !isset( $info['file_id'] ) )
|
||||
{
|
||||
@@ -1098,7 +1100,7 @@ class Downloads extends Core
|
||||
|
||||
if ( !isset( $record['record_realname'] ) )
|
||||
{
|
||||
if ( isset( $record['file_path'] ) AND !is_null( $record['file_path'] ) )
|
||||
if ( isset( $record['file_path'] ) AND !empty( $record['file_path'] ) )
|
||||
{
|
||||
$fileName = explode( '/', $record['file_path'] );
|
||||
$fileName = array_pop( $fileName );
|
||||
@@ -1194,9 +1196,9 @@ class Downloads extends Core
|
||||
/**
|
||||
* Get Orphaned Files Category
|
||||
*
|
||||
* @return integer The Category ID.
|
||||
* @return int The Category ID.
|
||||
*/
|
||||
protected function _orphanedFilesCategory()
|
||||
protected function _orphanedFilesCategory() : int
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -1215,9 +1217,9 @@ class Downloads 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 convertDownloadsComment( $info=array() )
|
||||
public function convertDownloadsComment( array $info=array() ) : bool|int
|
||||
{
|
||||
if ( !isset( $info['comment_id'] ) )
|
||||
{
|
||||
@@ -1331,9 +1333,9 @@ class Downloads extends Core
|
||||
* Convert a 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 convertDownloadsReview( $info=array() )
|
||||
public function convertDownloadsReview( array $info=array() ) : bool|int
|
||||
{
|
||||
if ( !isset( $info['review_id'] ) )
|
||||
{
|
||||
@@ -1528,9 +1530,9 @@ class Downloads extends Core
|
||||
* @param string|NULL $filepath Path to the file, or NULL.
|
||||
* @param string|NULL $filedata Binary data for the file, 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'] = 'downloads_Downloads';
|
||||
$map['id1_type'] = 'downloads_files';
|
||||
@@ -1558,9 +1560,9 @@ class Downloads extends Core
|
||||
* Convert a Club Downloads 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 convertClubDownloadsCategory( $info=array() )
|
||||
public function convertClubDownloadsCategory( array $info=array() ) : bool|int
|
||||
{
|
||||
$insertedId = $this->convertDownloadsCategory( $info );
|
||||
if ( $insertedId )
|
||||
@@ -1575,9 +1577,9 @@ class Downloads extends Core
|
||||
*
|
||||
* @param array $info Data to insert
|
||||
* @param array $records File Records
|
||||
* @return integer|boolean The ID of the newly inserted file, or FALSE on failure.
|
||||
* @return int|bool The ID of the newly inserted file, or FALSE on failure.
|
||||
*/
|
||||
public function convertClubDownloadsFile( $info=array(), $records=array() )
|
||||
public function convertClubDownloadsFile( array $info=array(), array $records=array() ) : bool|int
|
||||
{
|
||||
$insertedId = $this->convertDownloadsFile( $info, $records );
|
||||
if ( $insertedId )
|
||||
@@ -1591,9 +1593,9 @@ class Downloads extends Core
|
||||
* Convert a Club Downloads 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 convertClubDownloadsComment( $info=array() )
|
||||
public function convertClubDownloadsComment( array $info=array() ) : bool|int
|
||||
{
|
||||
$insertedId = $this->convertDownloadsComment( $info );
|
||||
if ( $insertedId )
|
||||
@@ -1607,9 +1609,9 @@ class Downloads extends Core
|
||||
* Convert a Club Downloads Review
|
||||
*
|
||||
* @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 convertClubDownloadsReview( $info=array() )
|
||||
public function convertClubDownloadsReview( array $info=array() ) : bool|int
|
||||
{
|
||||
$insertedId = $this->convertDownloadsReview( $info );
|
||||
if ( $insertedId )
|
||||
|
||||
Reference in new issue
Block a user