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
@@ -46,17 +46,17 @@ class Xenforo extends Software
|
||||
/**
|
||||
* @brief The similarities between XF1 and XF2 are close enough that we can use the same converter
|
||||
*/
|
||||
public static $isLegacy = NULL;
|
||||
public static ?bool $isLegacy = NULL;
|
||||
|
||||
/**
|
||||
* @brief XF2 Has prefixes on RM tables
|
||||
*/
|
||||
public static $tablePrefix = 'xengallery_';
|
||||
public static string $tablePrefix = 'xengallery_';
|
||||
|
||||
/**
|
||||
* @brief XF2.1 changed serialized data to json decoded
|
||||
*/
|
||||
public static $useJson = FALSE;
|
||||
public static bool $useJson = FALSE;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -66,9 +66,9 @@ class Xenforo extends Software
|
||||
* @return void
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct( App $app, $needDB=TRUE )
|
||||
public function __construct( App $app, bool $needDB=TRUE )
|
||||
{
|
||||
$return = parent::__construct( $app, $needDB );
|
||||
parent::__construct( $app, $needDB );
|
||||
|
||||
if ( $needDB )
|
||||
{
|
||||
@@ -97,16 +97,14 @@ class Xenforo extends Software
|
||||
}
|
||||
catch( Exception $e ) {} # If we can't query, we won't be able to do anything anyway
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Software Name
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public static function softwareName()
|
||||
public static function softwareName(): string
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "XenForo Media Gallery (1.5.x/2.0.x/2.1.x/2.2.x)";
|
||||
@@ -115,9 +113,9 @@ class Xenforo extends Software
|
||||
/**
|
||||
* Software Key
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public static function softwareKey()
|
||||
public static function softwareKey(): string
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "xenforo";
|
||||
@@ -126,9 +124,9 @@ class Xenforo extends Software
|
||||
/**
|
||||
* Content we can convert from this software.
|
||||
*
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public static function canConvert()
|
||||
public static function canConvert(): ?array
|
||||
{
|
||||
return array(
|
||||
'convertGalleryCategories' => array(
|
||||
@@ -153,13 +151,13 @@ class Xenforo extends Software
|
||||
/**
|
||||
* Count Source Rows for a specific step
|
||||
*
|
||||
* @param string $table The table containing the rows to count.
|
||||
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
|
||||
* @param bool $recache Skip cache and pull directly (updating cache)
|
||||
* @return integer
|
||||
* @param string $table The table containing the rows to count.
|
||||
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
|
||||
* @param bool $recache Skip cache and pull directly (updating cache)
|
||||
* @return integer
|
||||
* @throws \IPS\convert\Exception
|
||||
*/
|
||||
public function countRows( $table, $where=NULL, $recache=FALSE )
|
||||
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
|
||||
{
|
||||
switch( $table )
|
||||
{
|
||||
@@ -178,16 +176,17 @@ class Xenforo extends Software
|
||||
|
||||
default:
|
||||
return parent::countRows( $table, $where, $recache );
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses Prefix
|
||||
*
|
||||
* @return bool
|
||||
* @return bool
|
||||
*/
|
||||
public static function usesPrefix()
|
||||
public static function usesPrefix(): bool
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -195,9 +194,9 @@ class Xenforo extends Software
|
||||
/**
|
||||
* Requires Parent
|
||||
*
|
||||
* @return boolean
|
||||
* @return boolean
|
||||
*/
|
||||
public static function requiresParent()
|
||||
public static function requiresParent(): bool
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -205,9 +204,9 @@ class Xenforo extends Software
|
||||
/**
|
||||
* Possible Parent Conversions
|
||||
*
|
||||
* @return array
|
||||
* @return array|null
|
||||
*/
|
||||
public static function parents()
|
||||
public static function parents(): ?array
|
||||
{
|
||||
return array( 'core' => array( 'xenforo' ) );
|
||||
}
|
||||
@@ -215,9 +214,9 @@ class Xenforo extends Software
|
||||
/**
|
||||
* List of conversion methods that require additional information
|
||||
*
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
public static function checkConf()
|
||||
public static function checkConf(): array
|
||||
{
|
||||
return array(
|
||||
'convertGalleryAlbums',
|
||||
@@ -228,10 +227,10 @@ class Xenforo extends Software
|
||||
/**
|
||||
* Get More Information
|
||||
*
|
||||
* @param string $method Conversion method
|
||||
* @return array
|
||||
* @param string $method Conversion method
|
||||
* @return array|null
|
||||
*/
|
||||
public function getMoreInfo( $method )
|
||||
public function getMoreInfo( string $method ): ?array
|
||||
{
|
||||
$return = array();
|
||||
switch( $method )
|
||||
@@ -297,9 +296,9 @@ class Xenforo extends Software
|
||||
/**
|
||||
* Finish - Adds everything it needs to the queues and clears data store
|
||||
*
|
||||
* @return array Messages to display
|
||||
* @return array Messages to display
|
||||
*/
|
||||
public function finish()
|
||||
public function finish(): array
|
||||
{
|
||||
/* Content Rebuilds */
|
||||
Task::queue( 'convert', 'RebuildGalleryImages', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
@@ -321,7 +320,7 @@ class Xenforo extends Software
|
||||
* @param string $xfTwoTitle XF2 Phrase Title
|
||||
* @return string|null
|
||||
*/
|
||||
protected function getPhrase( $xfOneTitle, $xfTwoTitle )
|
||||
protected function getPhrase( string $xfOneTitle, string $xfTwoTitle ) : ?string
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -339,7 +338,7 @@ class Xenforo extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertGalleryCategories()
|
||||
public function convertGalleryCategories() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -349,10 +348,10 @@ class Xenforo extends Software
|
||||
{
|
||||
$libraryClass->convertGalleryCategory( array(
|
||||
'category_id' => $row['category_id'],
|
||||
'category_name' => isset( $row['category_title'] ) ? $row['category_title'] : $row['title'],
|
||||
'category_desc' => isset( $row['category_description'] ) ? $row['category_description'] : $row['description'],
|
||||
'category_name' => $row['category_title'] ?? $row['title'],
|
||||
'category_desc' => $row['category_description'] ?? $row['description'],
|
||||
'category_parent_id' => $row['parent_category_id'],
|
||||
'category_count_imgs' => isset( $row['category_media_count'] ) ? $row['category_media_count'] : $row['media_count'],
|
||||
'category_count_imgs' => $row['category_media_count'] ?? $row['media_count'],
|
||||
'category_position' => $row['display_order']
|
||||
) );
|
||||
|
||||
@@ -382,7 +381,7 @@ class Xenforo extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertGalleryAlbums()
|
||||
public function convertGalleryAlbums() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -466,15 +465,15 @@ class Xenforo extends Software
|
||||
|
||||
$info = array(
|
||||
'album_id' => $row['album_id'],
|
||||
'album_owner_id' => isset( $row['album_user_id'] ) ? $row['album_user_id'] : $row['user_id'],
|
||||
'album_description' => isset( $row['album_description'] ) ? $row['album_description'] : $row['description'],
|
||||
'album_name' => isset( $row['album_title'] ) ? $row['album_title'] : $row['title'],
|
||||
'album_owner_id' => $row['album_user_id'] ?? $row['user_id'],
|
||||
'album_description' => $row['album_description'] ?? $row['description'],
|
||||
'album_name' => $row['album_title'] ?? $row['title'],
|
||||
'album_type' => $type,
|
||||
'album_count_imgs' => isset( $row['album_media_count'] ) ? $row['album_media_count'] : $row['media_count'],
|
||||
'album_count_comments' => isset( $row['album_comment_count'] ) ? $row['album_comment_count'] : $row['comment_count'],
|
||||
'album_rating_aggregate' => isset( $row['album_rating_avg'] ) ? $row['album_rating_avg'] : $row['rating_avg'],
|
||||
'album_rating_count' => isset( $row['album_rating_count'] ) ? $row['album_rating_count'] : $row['rating_count'],
|
||||
'album_rating_total' => isset( $row['album_rating_sum'] ) ? $row['album_rating_sum'] : $row['rating_sum'],
|
||||
'album_count_imgs' => $row['album_media_count'] ?? $row['media_count'],
|
||||
'album_count_comments' => $row['album_comment_count'] ?? $row['comment_count'],
|
||||
'album_rating_aggregate' => $row['album_rating_avg'] ?? $row['rating_avg'],
|
||||
'album_rating_count' => $row['album_rating_count'] ?? $row['rating_count'],
|
||||
'album_rating_total' => $row['album_rating_sum'] ?? $row['rating_sum'],
|
||||
);
|
||||
|
||||
$category = $this->app->_session['more_info']['convertGalleryAlbums']['members_gallery_category'];
|
||||
@@ -513,7 +512,7 @@ class Xenforo extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertGalleryImages()
|
||||
public function convertGalleryImages() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -579,7 +578,7 @@ class Xenforo extends Software
|
||||
$group = floor( $file_data['data_id'] / 1000 );
|
||||
$path = rtrim( $this->app->_session['more_info']['convertGalleryImages']['file_location'], '/' ) . '/' . $group . '/' . $file_data['data_id'] . '-' . $file_data['file_hash'] . '.data';
|
||||
$file_name = $file_data['filename'];
|
||||
$description = isset( $row['media_description'] ) ? $row['media_description'] : $row['description'];
|
||||
$description = $row['media_description'] ?? $row['description'];
|
||||
|
||||
break;
|
||||
|
||||
@@ -610,7 +609,7 @@ class Xenforo extends Software
|
||||
continue 2;
|
||||
}
|
||||
|
||||
$description = ( isset( $row['media_description'] ) ? $row['media_description'] : $row['description'] );
|
||||
$description = ( $row['media_description'] ?? $row['description'] );
|
||||
$description = $em . "<br>" . $description;
|
||||
|
||||
break;
|
||||
@@ -621,8 +620,8 @@ class Xenforo extends Software
|
||||
'image_album_id' => $row['album_id'],
|
||||
'image_category_id' => $row['category_id'],
|
||||
'image_member_id' => $row['user_id'],
|
||||
'image_caption' => isset( $row['media_title'] ) ? $row['media_title'] : $row['title'],
|
||||
'image_views' => isset( $row['media_view_count'] ) ? $row['media_view_count'] : $row['view_count'],
|
||||
'image_caption' => $row['media_title'] ?? $row['title'],
|
||||
'image_views' => $row['media_view_count'] ?? $row['view_count'],
|
||||
'image_comments' => $row['comment_count'],
|
||||
'image_ratings_total' => $row['rating_sum'],
|
||||
'image_ratings_count' => $row['rating_count'],
|
||||
@@ -726,9 +725,9 @@ class Xenforo extends Software
|
||||
$libraryClass->convertTag( array(
|
||||
'tag_meta_app' => 'gallery',
|
||||
'tag_meta_area' => 'gallery',
|
||||
'tag_meta_parent_id' => ( $row['album_id'] ) ? $row['album_id'] : $row['category_id'],
|
||||
'tag_meta_parent_id' => ( $row['album_id'] ) ?: $row['category_id'],
|
||||
'tag_meta_id' => $row['media_id'],
|
||||
'tag_text' => isset( $tag['tag_clean'] ) ? $tag['tag_clean'] : $tag['tag'], // Select 1.0 or 1.1 version
|
||||
'tag_text' => $tag['tag_clean'] ?? $tag['tag'], // Select 1.0 or 1.1 version
|
||||
'tag_prefix' => 0,
|
||||
'tag_member_id' => $row['user_id'],
|
||||
'tag_added' => $row['media_date']
|
||||
@@ -745,7 +744,7 @@ class Xenforo extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertGalleryComments()
|
||||
public function convertGalleryComments() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
|
||||
Reference in new issue
Block a user