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

@@ -12,38 +12,51 @@
namespace IPS\convert\Software\Blog;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use DomainException;
use InvalidArgumentException;
use IPS\Application;
use IPS\convert\App;
use IPS\convert\Library;
use IPS\convert\Software;
use IPS\Db;
use IPS\Db\Exception as DbException;
use IPS\Member;
use IPS\Task;
use UnderflowException;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
class Invisioncommunity extends \IPS\convert\Software
class Invisioncommunity extends Software
{
/**
* @brief Whether the versions of IPS4 match
*/
public static $versionMatch = FALSE;
public static bool $versionMatch = FALSE;
/**
* @brief Whether the database has been required
*/
public static $dbNeeded = FALSE;
public static bool $dbNeeded = FALSE;
/**
* Constructor
*
* @param \IPS\convert\App $app The application to reference for database and other information.
* @param App $app The application to reference for database and other information.
* @param bool $needDB Establish a DB connection
* @return void
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
*/
public function __construct( \IPS\convert\App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
/* Set filename obscuring flag */
\IPS\convert\Library::$obscureFilenames = FALSE;
Library::$obscureFilenames = FALSE;
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if( $needDB )
{
@@ -54,37 +67,35 @@ class Invisioncommunity extends \IPS\convert\Software
$version = $this->db->select( 'app_version', 'core_applications', array( 'app_directory=?', 'core' ) )->first();
/* We're matching against the human version since the long version can change with patches */
if ( $version == \IPS\Application::load( 'core' )->version )
if ( $version == Application::load( 'core' )->version )
{
static::$versionMatch = TRUE;
}
}
catch( \IPS\Db\Exception $e ) {}
catch( DbException $e ) {}
/* Get parent sauce */
$this->parent = $this->app->_parent->getSource();
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return 'Invision Community (' . \IPS\Application::load( 'core' )->version . ')';
return 'Invision Community (' . Application::load( 'core' )->version . ')';
}
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "invisioncommunity";
@@ -93,9 +104,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -103,9 +114,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'invisioncommunity' ) );
}
@@ -113,10 +124,10 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Content we can convert from this software.
*
* @return array|NULL
* @return array|NULL
* @note NULL indicates this converter cannot be used yet, useful to move redirect scripts into the 4.x framework
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertBlogCategories' => array(
@@ -141,7 +152,7 @@ class Invisioncommunity extends \IPS\convert\Software
),
'convertAttachments' => array(
'table' => 'core_attachments_map',
'where' => array( \IPS\Db::i()->in( 'location_key', array( 'blog_Blogs', 'blog_Entries' ) ) )
'where' => array( Db::i()->in( 'location_key', array( 'blog_Blogs', 'blog_Entries' ) ) )
)
);
}
@@ -149,9 +160,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return FALSE;
}
@@ -159,9 +170,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return FALSE;
}
@@ -169,9 +180,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Settings Map
*
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array();
}
@@ -179,9 +190,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
return array();
}
@@ -189,9 +200,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string|NULL
* @return string|NULL
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return NULL;
}
@@ -199,9 +210,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertAttachments'
@@ -211,26 +222,26 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
{
case 'convertAttachments':
\IPS\Member::loggedIn()->language()->words["upload_path"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input' );
\IPS\Member::loggedIn()->language()->words["upload_path_desc"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input_desc' );
Member::loggedIn()->language()->words["upload_path"] = Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input' );
Member::loggedIn()->language()->words["upload_path_desc"] = Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input_desc' );
$return[ $method ] = array(
'upload_path' => array(
'field_class' => 'IPS\\Helpers\\Form\\Text',
'field_default' => isset( $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ) ? $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] : NULL,
'field_default' => $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ?? NULL,
'field_required' => TRUE,
'field_extra' => array(),
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_invision_upload_path'),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
'field_hint' => Member::loggedIn()->language()->addToStack('convert_invision_upload_path'),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new DomainException( 'path_invalid' ); } },
)
);
break;
@@ -242,36 +253,25 @@ class Invisioncommunity extends \IPS\convert\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 */
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\blog\Entry\Category', 'count' => 0 ), 4, array( 'class' ) );
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'blog_entries', 'class' => 'IPS\blog\Entry' ), 2, array( 'app', 'link', 'class' ) );
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'blog_comments', 'class' => 'IPS\blog\Entry\Comment' ), 2, array( 'app', 'link', 'class' ) );
\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'blog_entries', 'class' => 'IPS\blog\Entry' ), 3, array( 'app', 'link', 'class' ) );
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\blog\Entry\Category', 'count' => 0 ), 4, array( 'class' ) );
Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'blog_entries', 'class' => 'IPS\blog\Entry' ), 2, array( 'app', 'link', 'class' ) );
Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'blog_comments', 'class' => 'IPS\blog\Entry\Comment' ), 2, array( 'app', 'link', 'class' ) );
Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'blog_entries', 'class' => 'IPS\blog\Entry' ), 3, array( 'app', 'link', 'class' ) );
return array( "f_blog_entries_rebuilding", "f_entry_comments_rebuilding", "f_blogs_recounting", "f_entry_tags_cache" );
}
/**
* Fix post data
*
* @param string raw post data
* @return string parsed post data
*/
public static function fixPostData( $post )
{
return $post;
}
/**
* Convert Blog Categories
*
* @return void
*/
public function convertBlogCategories()
public function convertBlogCategories() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'category_id' );
@@ -291,7 +291,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertBlogs()
public function convertBlogs() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'blog_id' );
@@ -306,7 +306,7 @@ class Invisioncommunity extends \IPS\convert\Software
{
$socialgroup = iterator_to_array( $this->db->select( 'member_id', 'core_sys_social_group_members', array( "group_id=?", $row['blog_social_group'] ) ) );
}
catch( \UnderflowException ) { }
catch( UnderflowException ) { }
}
$cover = NULL;
@@ -333,7 +333,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertBlogEntryCategories()
public function convertBlogEntryCategories() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'entry_category_id' );
@@ -350,7 +350,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertBlogEntries()
public function convertBlogEntries() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'entry_id' );
@@ -387,7 +387,7 @@ class Invisioncommunity extends \IPS\convert\Software
$libraryClass->convertReputation( $rep );
}
$libraryClass->setLasyKeyValue( $row['entry_id'] );
$libraryClass->setLastKeyValue( $row['entry_id'] );
}
}
@@ -396,7 +396,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertBlogComments()
public function convertBlogComments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'comment_id' );
@@ -422,7 +422,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'attach_id' );
@@ -431,9 +431,9 @@ class Invisioncommunity extends \IPS\convert\Software
{
try
{
$attachmentMap = $this->db->select( '*', 'core_attachments_map', array( 'attachment_id=? AND ' . \IPS\Db::i()->in( 'location_key', array( 'blog_Blogs', 'blog_Entries' ) ), $row['attach_id'] ) )->first();
$attachmentMap = $this->db->select( '*', 'core_attachments_map', array( 'attachment_id=? AND ' . Db::i()->in( 'location_key', array( 'blog_Blogs', 'blog_Entries' ) ), $row['attach_id'] ) )->first();
}
catch( \UnderflowException $e )
catch( UnderflowException $e )
{
$libraryClass->setLastKeyValue( $row['attach_id'] );
continue;
@@ -45,12 +45,12 @@ class Vbulletin extends Software
/**
* @brief vBulletin 4 Stores all attachments under one table - this will store the content type for the blog app.
*/
protected static $entryContentType = NULL;
protected static mixed $entryContentType = NULL;
/**
* @brief The schematic for vB3 and vB4 is similar enough that we can make specific concessions in a single converter for either version.
*/
protected static $isLegacy = NULL;
protected static ?bool $isLegacy = NULL;
/**
* Constructor
@@ -60,9 +60,9 @@ class Vbulletin 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 );
/* Is this vB3 or vB4? */
try
@@ -89,16 +89,14 @@ class Vbulletin extends Software
}
}
catch( Exception $e ) {}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "vBulletin Blog (3.8.x/4.x)";
@@ -107,9 +105,9 @@ class Vbulletin extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin";
@@ -118,9 +116,9 @@ class Vbulletin extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
$attachmentTable = 'blog_attachment';
$attachmentWhere = NULL;
@@ -157,32 +155,30 @@ class Vbulletin 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 )
{
default:
return parent::countRows( $table, $where );
break;
case 'blog_text':
return $this->db->select( 'COUNT(*)', 'blog_text', array( 'blogtextid NOT IN (' . (string) $this->db->select( 'firstblogtextid', 'blog' ) . ')' ) )->first();
break;
return $this->db->select( 'COUNT(*)', 'blog_text', array( 'blogtextid NOT IN (' . $this->db->select( 'firstblogtextid', 'blog' ) . ')' ) )->first();
}
}
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -190,9 +186,9 @@ class Vbulletin extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'vbulletin' ) );
}
@@ -200,9 +196,9 @@ class Vbulletin 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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\blog\Entry\Category', 'count' => 0 ), 4, array( 'class' ) );
@@ -216,22 +212,22 @@ class Vbulletin extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
{
return CalendarClass::fixPostData( $post, $className, $contentId );
return VbulletinClass::fixPostData( $post, $className, $contentId );
}
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array( 'convertAttachments' );
}
@@ -239,10 +235,10 @@ class Vbulletin 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 )
@@ -275,7 +271,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertBlogs()
public function convertBlogs() : void
{
$libraryClass = $this->getLibrary();
@@ -361,7 +357,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertBlogEntryCategories()
public function convertBlogEntryCategories() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'blogcategoryid' );
@@ -385,7 +381,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertBlogEntries()
public function convertBlogEntries() : void
{
$libraryClass = $this->getLibrary();
@@ -447,7 +443,7 @@ class Vbulletin extends Software
'entry_edit_time' => $edittime,
'entry_edit_name' => $editname,
'entry_edit_reason' => $editReason,
'entry_append_edit' => $edittime ? TRUE : FALSE,
'entry_append_edit' => (bool)$edittime,
'entry_ip_address' => long2ip( (int) $text['ipaddress'] ),
'entry_category_id' => $mainCategory
);
@@ -526,14 +522,14 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertBlogComments()
public function convertBlogComments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'blogtextid' );
// Exclude text of blog entry from iterator
foreach( $this->fetch( 'blog_text', 'blogtextid', array( 'blogtextid NOT IN (' . (string) $this->db->select( 'firstblogtextid', 'blog' ) . ')' ) ) AS $comment )
foreach( $this->fetch( 'blog_text', 'blogtextid', array( 'blogtextid NOT IN (' . $this->db->select( 'firstblogtextid', 'blog' ) . ')' ) ) AS $comment )
{
$edittime = $editname = NULL;
try
@@ -583,7 +579,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
@@ -679,8 +675,7 @@ class Vbulletin extends Software
Db::i()->update( 'blog_entries', array( 'entry_content' => $post ), array( "entry_id=?", $entry_id ) );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
}
$libraryClass->setLastKeyValue( $attachment['attachmentid'] );
@@ -690,9 +685,9 @@ class Vbulletin extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -12,38 +12,50 @@
namespace IPS\convert\Software\Calendar;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use DomainException;
use InvalidArgumentException;
use IPS\Application;
use IPS\convert\App;
use IPS\convert\Library;
use IPS\convert\Software;
use IPS\Db\Exception as DbException;
use IPS\Member;
use IPS\Task;
use UnderflowException;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
class Invisioncommunity extends \IPS\convert\Software
class Invisioncommunity extends Software
{
/**
* @brief Whether the versions of IPS4 match
*/
public static $versionMatch = FALSE;
public static bool $versionMatch = FALSE;
/**
* @brief Whether the database has been required
*/
public static $dbNeeded = FALSE;
public static bool $dbNeeded = FALSE;
/**
* Constructor
*
* @param \IPS\convert\App $app The application to reference for database and other information.
* @param App $app The application to reference for database and other information.
* @param bool $needDB Establish a DB connection
* @return void
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
*/
public function __construct( \IPS\convert\App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
/* Set filename obscuring flag */
\IPS\convert\Library::$obscureFilenames = FALSE;
Library::$obscureFilenames = FALSE;
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if( $needDB )
{
@@ -54,37 +66,35 @@ class Invisioncommunity extends \IPS\convert\Software
$version = $this->db->select( 'app_version', 'core_applications', array( 'app_directory=?', 'core' ) )->first();
/* We're matching against the human version since the long version can change with patches */
if ( $version == \IPS\Application::load( 'core' )->version )
if ( $version == Application::load( 'core' )->version )
{
static::$versionMatch = TRUE;
}
}
catch( \IPS\Db\Exception $e ) {}
catch( DbException $e ) {}
/* Get parent sauce */
$this->parent = $this->app->_parent->getSource();
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return 'Invision Community (' . \IPS\Application::load( 'core' )->version . ')';
return 'Invision Community (' . Application::load( 'core' )->version . ')';
}
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "invisioncommunity";
@@ -93,9 +103,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -103,9 +113,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'invisioncommunity' ) );
}
@@ -113,10 +123,10 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Content we can convert from this software.
*
* @return array|NULL
* @return array|NULL
* @note NULL indicates this converter cannot be used yet, useful to move redirect scripts into the 4.x framework
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertCalendarCalendars' => array(
@@ -161,9 +171,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return FALSE;
}
@@ -171,9 +181,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return FALSE;
}
@@ -181,9 +191,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Settings Map
*
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array();
}
@@ -191,9 +201,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
return array();
}
@@ -201,9 +211,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string|NULL
* @return string|NULL
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return NULL;
}
@@ -211,9 +221,9 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertAttachments'
@@ -223,26 +233,26 @@ class Invisioncommunity extends \IPS\convert\Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
{
case 'convertAttachments':
\IPS\Member::loggedIn()->language()->words["upload_path"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input' );
\IPS\Member::loggedIn()->language()->words["upload_path_desc"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input_desc' );
Member::loggedIn()->language()->words["upload_path"] = Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input' );
Member::loggedIn()->language()->words["upload_path_desc"] = Member::loggedIn()->language()->addToStack( 'convert_invision_upload_input_desc' );
$return[ $method ] = array(
'upload_path' => array(
'field_class' => 'IPS\\Helpers\\Form\\Text',
'field_default' => isset( $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ) ? $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] : NULL,
'field_default' => $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ?? NULL,
'field_required' => TRUE,
'field_extra' => array(),
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_invision_upload_path'),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
'field_hint' => Member::loggedIn()->language()->addToStack('convert_invision_upload_path'),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new DomainException( 'path_invalid' ); } },
)
);
break;
@@ -254,36 +264,25 @@ class Invisioncommunity extends \IPS\convert\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 */
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_events', 'class' => 'IPS\calendar\Event' ), 2, array( 'app', 'link', 'class' ) );
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_event_comments', 'class' => 'IPS\calendar\Event\Comment' ), 2, array( 'app', 'link', 'class' ) );
\IPS\Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_event_reviews', 'class' => 'IPS\calendar\Event\Review' ), 2, array( 'app', 'link', 'class' ) );
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\calendar\Event' ), 3, array( 'class' ) );
Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_events', 'class' => 'IPS\calendar\Event' ), 2, array( 'app', 'link', 'class' ) );
Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_event_comments', 'class' => 'IPS\calendar\Event\Comment' ), 2, array( 'app', 'link', 'class' ) );
Task::queue( 'convert', 'InvisionCommunityRebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_event_reviews', 'class' => 'IPS\calendar\Event\Review' ), 2, array( 'app', 'link', 'class' ) );
Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\calendar\Event' ), 3, array( 'class' ) );
return array( "f_rebuild_events", "f_recount_calendar" );
}
/**
* Fix post data
*
* @param string raw post data
* @return string parsed post data
*/
public static function fixPostData( $post )
{
return $post;
}
/**
* Convert Calendars
*
* @return void
*/
public function convertCalendarCalendars()
public function convertCalendarCalendars() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'cal_id' );
@@ -313,7 +312,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertCalendarVanues()
public function convertCalendarVanues() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'venue_id' );
@@ -331,7 +330,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertCalendarEvents()
public function convertCalendarEvents() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'event_id' );
@@ -376,7 +375,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertCalendarComments()
public function convertCalendarComments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'comment_id' );
@@ -402,7 +401,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertCalendarReviews()
public function convertCalendarReviews() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'review_id' );
@@ -428,7 +427,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertCalendarReminders()
public function convertCalendarReminders() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'reminder_id' );
@@ -446,7 +445,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* return void
*/
public function convertCalendarRsvps()
public function convertCalendarRsvps() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'rsvp_id' );
@@ -464,7 +463,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertCalendarFeeds()
public function convertCalendarFeeds() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'feed_id' );
@@ -482,7 +481,7 @@ class Invisioncommunity extends \IPS\convert\Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'attach_id' );
@@ -493,7 +492,7 @@ class Invisioncommunity extends \IPS\convert\Software
{
$attachmentMap = $this->db->select( '*', 'core_attachments_map', array( 'attachment_id=? AND location_key=?', $row['attach_id'], 'calendar_Calendar' ) )->first();
}
catch( \UnderflowException $e )
catch( UnderflowException $e )
{
$libraryClass->setLastKeyValue( $row['attach_id'] );
continue;
@@ -33,9 +33,9 @@ class Mybb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "MyBB 1.8.x";
@@ -44,9 +44,9 @@ class Mybb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "mybb";
@@ -55,9 +55,9 @@ class Mybb 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(
'convertCalendarCalendars' => array(
@@ -74,9 +74,9 @@ class Mybb extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -84,9 +84,9 @@ class Mybb extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'mybb' ) );
}
@@ -94,9 +94,9 @@ class Mybb 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', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_events', 'class' => 'IPS\calendar\Event' ), 2, array( 'app', 'link', 'class' ) );
@@ -110,7 +110,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertCalendarCalendars()
public function convertCalendarCalendars() : void
{
$libraryClass = $this->getLibrary();
@@ -133,7 +133,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertCalendarEvents()
public function convertCalendarEvents() : void
{
$libraryClass = $this->getLibrary();
@@ -33,9 +33,9 @@ class Vbulletin extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "vBulletin Calendar (3.8.x/4.x)";
@@ -44,9 +44,9 @@ class Vbulletin extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin";
@@ -55,9 +55,9 @@ class Vbulletin 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(
'convertCalendarCalendars'=> array(
@@ -74,9 +74,9 @@ class Vbulletin extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -84,9 +84,9 @@ class Vbulletin extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'vbulletin' ) );
}
@@ -94,9 +94,9 @@ class Vbulletin 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', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'calendar_events', 'class' => 'IPS\calendar\Event' ), 2, array( 'app', 'link', 'class' ) );
@@ -108,9 +108,9 @@ class Vbulletin extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -123,7 +123,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCalendarCalendars()
public function convertCalendarCalendars() : void
{
$libraryClass = $this->getLibrary();
@@ -147,7 +147,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCalendarEvents()
public function convertCalendarEvents() : void
{
$libraryClass = $this->getLibrary();
@@ -33,9 +33,9 @@ class Joomla extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Joomla";
@@ -44,9 +44,9 @@ class Joomla extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "joomla";
@@ -55,9 +55,9 @@ class Joomla 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(
'convertCmsDatabases' => array(
@@ -78,32 +78,30 @@ class Joomla 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 )
{
case 'cms_database':
return 1;
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -111,9 +109,9 @@ class Joomla extends Software
/**
* Requires Parent?
*
* @return bool
* @return bool
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -121,9 +119,9 @@ class Joomla extends Software
/**
* Available Parents
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'joomla' ) );
}
@@ -131,9 +129,9 @@ class Joomla 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
{
try
{
@@ -154,7 +152,7 @@ class Joomla extends Software
*
* @return void
*/
public function convertCmsDatabases()
public function convertCmsDatabases() : void
{
$libraryClass = $this->getLibrary();
@@ -198,13 +196,13 @@ class Joomla extends Software
*
* @return void
*/
public function convertCmsDatabaseCategories()
public function convertCmsDatabaseCategories() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
foreach( $this->fetch( 'categories', 'id' ) as $row )
foreach( $this->fetch( 'categories' ) as $row )
{
$info = array(
'category_id' => $row['id'],
@@ -225,13 +223,13 @@ class Joomla extends Software
*
* @return void
*/
public function convertCmsDatabaseRecords()
public function convertCmsDatabaseRecords() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
foreach( $this->fetch( 'content', 'id' ) as $row )
foreach( $this->fetch( 'content' ) as $row )
{
/* Set the basic details */
$info = array(
@@ -43,19 +43,19 @@ class Vbulletin extends Software
/**
* @brief The schematic for vB3 and vB4 is similar enough that we can make specific concessions in a single converter for either version.
*/
protected static $isLegacy = NULL;
protected static ?bool $isLegacy = NULL;
/**
* @brief Cached article content type
*/
protected static $_articleContentType = NULL;
protected static mixed $_articleContentType = NULL;
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "vBulletin CMS (4.x only)";
@@ -64,9 +64,9 @@ class Vbulletin extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin";
@@ -80,9 +80,9 @@ class Vbulletin 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 );
/* Is this vB3 or vB4? */
try
@@ -113,19 +113,16 @@ class Vbulletin extends Software
}
catch( \Exception $e ) {}
return $return;
}
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
$return = array(
return array(
'convertCmsBlocks' => array(
'table' => 'cms_widget',
'where' => NULL,
@@ -151,20 +148,18 @@ class Vbulletin extends Software
'where' => array( "contenttypeid=?", static::$_articleContentType )
)
);
return $return;
}
/**
* 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 )
{
@@ -182,24 +177,22 @@ class Vbulletin extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
case 'page':
case 'database':
return 1;
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -207,9 +200,9 @@ class Vbulletin extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'vbulletin' ) );
}
@@ -217,9 +210,9 @@ class Vbulletin extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -233,7 +226,7 @@ class Vbulletin extends Software
* @param string $key The setting key
* @return mixed
*/
protected function _setting( $key )
protected function _setting( string $key ) : mixed
{
if ( isset( $this->settingsCache[$key] ) )
{
@@ -267,7 +260,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCmsBlocks()
public function convertCmsBlocks() : void
{
$libraryClass = $this->getLibrary();
@@ -326,7 +319,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCmsPages()
public function convertCmsPages() : void
{
$this->getLibrary()->convertCmsPage( array(
'page_id' => 1,
@@ -341,7 +334,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCmsDatabases()
public function convertCmsDatabases() : void
{
$convertedForums = FALSE;
try
@@ -402,7 +395,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCmsDatabaseCategories()
public function convertCmsDatabaseCategories() : void
{
$libraryClass = $this->getLibrary();
@@ -428,7 +421,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCmsDatabaseRecords()
public function convertCmsDatabaseRecords() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'contentid' );
@@ -584,9 +577,9 @@ class Vbulletin 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
{
foreach( Db::i()->select( 'ipb_id', 'convert_link', array( 'type=? AND app=?', 'cms_databases', $this->app->app_id ) ) as $database )
{
@@ -609,7 +602,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
@@ -712,9 +705,9 @@ class Vbulletin 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( 'convertAttachments' );
}
@@ -722,10 +715,10 @@ class Vbulletin 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 )
@@ -14,11 +14,15 @@ namespace IPS\convert\Software\Cms;
/* To prevent PHP errors (extending class does not exist) revealing path */
use DomainException;
use DOMXPath;
use IPS\convert\Software;
use IPS\convert\Software\Exception;
use IPS\DateTime;
use IPS\Db;
use IPS\Member;
use IPS\Task;
use IPS\Text\DOMParser;
use IPS\Xml\DOMDocument;
use OutOfRangeException;
use UnderflowException;
use function defined;
@@ -30,16 +34,16 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
}
/**
* Wordpress Pages Converter
* WordPress Pages Converter
*/
class Wordpress extends Software
{
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "WordPress (5.x)";
@@ -48,9 +52,9 @@ class Wordpress extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "wordpress";
@@ -59,9 +63,9 @@ class Wordpress 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(
'convertCmsPages' => array(
@@ -94,32 +98,30 @@ class Wordpress 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 )
{
case 'cms_database':
return 1;
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Requires Parent?
*
* @return bool
* @return bool
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -127,9 +129,9 @@ class Wordpress extends Software
/**
* Available Parents
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'wordpress', 'wpforo' ) );
}
@@ -137,9 +139,9 @@ class Wordpress 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(
'convertAttachments',
@@ -150,10 +152,10 @@ class Wordpress 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();
@@ -188,9 +190,9 @@ class Wordpress 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
{
try
{
@@ -215,7 +217,7 @@ class Wordpress extends Software
*
* @return void
*/
public function convertCmsPages()
public function convertCmsPages() : void
{
$libraryClass = $this->getLibrary();
@@ -239,7 +241,7 @@ class Wordpress extends Software
*
* @return void
*/
public function convertCmsDatabases()
public function convertCmsDatabases() : void
{
$libraryClass = $this->getLibrary();
@@ -283,7 +285,7 @@ class Wordpress extends Software
*
* @return void
*/
public function convertCmsDatabaseCategories()
public function convertCmsDatabaseCategories() : void
{
$libraryClass = $this->getLibrary();
@@ -309,7 +311,7 @@ class Wordpress extends Software
*
* @return void
*/
public function convertCmsDatabaseRecords()
public function convertCmsDatabaseRecords() : void
{
$libraryClass = $this->getLibrary();
@@ -435,7 +437,7 @@ class Wordpress extends Software
*
* @return void
*/
public function convertCmsDatabaseComments()
public function convertCmsDatabaseComments() : void
{
$libraryClass = $this->getLibrary();
@@ -475,14 +477,14 @@ class Wordpress extends Software
}
}
protected $postContent = [];
protected array $postContent = [];
/**
* Convert attachments
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$database = $this->app->getLink( 1, 'cms_databases' );
$contentField = $this->app->getLink( 2, 'cms_database_fields' );
@@ -499,7 +501,7 @@ class Wordpress extends Software
$libraryClass->setLastKeyValue( $row['ID'] );
continue;
}
catch( \UnderflowException $e ) {}
catch( UnderflowException $e ) {}
try
{
@@ -507,10 +509,10 @@ class Wordpress extends Software
$postId = $this->app->getLink( $wpPost['ID'], "cms_custom_database_" . $database );
if( !isset( $this->postContent[ $postId ] ) )
{
$this->postContent[ $postId ] = \IPS\Db::i()->select( 'field_' . $contentField, 'cms_custom_database_' . $database, array( "primary_id_field=?", $postId ) )->first();
$this->postContent[ $postId ] = Db::i()->select( 'field_' . $contentField, 'cms_custom_database_' . $database, array( "primary_id_field=?", $postId ) )->first();
}
}
catch( \UnderflowException | \OutOfRangeException $e )
catch( UnderflowException|OutOfRangeException $e )
{
$libraryClass->setLastKeyValue( $row['ID'] );
continue;
@@ -541,9 +543,9 @@ class Wordpress extends Software
if( $attachId !== FALSE AND mb_stristr( $this->postContent[ $postId ], $meta['_wp_attached_file'] ) )
{
$dom = new \IPS\Xml\DOMDocument( '1.0', 'UTF-8' );
$dom->loadHTML( \IPS\Xml\DOMDocument::wrapHtml( $this->postContent[ $postId ] ) );
$xPath = new \DOMXPath( $dom );
$dom = new DOMDocument( '1.0', 'UTF-8' );
$dom->loadHTML( DOMDocument::wrapHtml( $this->postContent[ $postId ] ) );
$xPath = new DOMXPath( $dom );
foreach ( $xPath->query( "//img[contains(@src, '" . $meta['_wp_attached_file'] ."')] | //a[contains(@href, '" . $meta['_wp_attached_file'] ."')]" ) as $tag )
{
@@ -552,7 +554,7 @@ class Wordpress extends Software
}
/* Get DOMDocument output */
$content = \IPS\Text\DOMParser::getDocumentBodyContents( $dom );
$content = DOMParser::getDocumentBodyContents( $dom );
/* Replace file storage tags */
$content = preg_replace( '/&lt;fileStore\.([\d\w\_]+?)&gt;/i', '<fileStore.$1>', $content );
@@ -567,7 +569,7 @@ class Wordpress extends Software
/* Do the updates */
foreach( $this->postContent as $pid => $content )
{
\IPS\Db::i()->update( 'cms_custom_database_' . $database, array( 'field_' . $contentField => $content ), array( 'primary_id_field=?', $pid ) );
Db::i()->update( 'cms_custom_database_' . $database, array( 'field_' . $contentField => $content ), array( 'primary_id_field=?', $pid ) );
}
}
}
@@ -31,9 +31,9 @@ class Xenforo extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "XenForo Page Nodes (1.5.x/2.0.x/2.1.x/2.2.x)";
@@ -42,9 +42,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";
@@ -53,9 +53,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(
'convertCmsPages' => array(
@@ -68,9 +68,9 @@ class Xenforo extends Software
/**
* Uses Prefix
*
* @return bool
* @return bool
*/
public static function usesPrefix()
public static function usesPrefix(): bool
{
return FALSE;
}
@@ -78,9 +78,9 @@ class Xenforo extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -88,9 +88,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' ) );
}
@@ -100,7 +100,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertCmsPages()
public function convertCmsPages() : void
{
$libraryClass = $this->getLibrary();
@@ -36,19 +36,19 @@ class Xenfororm 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 = '';
public static string $tablePrefix = '';
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "XenForo Resource Manager Articles (1.5.x/2.0.x/2.1.x/2.2.x)";
@@ -62,9 +62,9 @@ class Xenfororm 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 )
{
@@ -88,16 +88,14 @@ class Xenfororm extends Software
}
catch( \Exception $e ) {} # If we can't query, we won't be able to do anything anyway
}
return $return;
}
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "xenfororm";
@@ -106,9 +104,9 @@ class Xenfororm 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(
'convertCmsDatabases' => array(
@@ -129,32 +127,30 @@ class Xenfororm 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 )
{
case 'cms_databases':
return 1;
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Uses Prefix
*
* @return bool
* @return bool
*/
public static function usesPrefix()
public static function usesPrefix(): bool
{
return FALSE;
}
@@ -162,9 +158,9 @@ class Xenfororm extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -172,9 +168,9 @@ class Xenfororm extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'xenforo' ) );
}
@@ -184,7 +180,7 @@ class Xenfororm extends Software
*
* @return void
*/
public function convertCmsDatabases()
public function convertCmsDatabases() : void
{
$libraryClass = $this->getLibrary();
@@ -235,7 +231,7 @@ class Xenfororm extends Software
*
* @return void
*/
public function convertCmsDatabaseCategories()
public function convertCmsDatabaseCategories() : void
{
$libraryClass = $this->getLibrary();
@@ -254,7 +250,7 @@ class Xenfororm extends Software
$info = array(
'category_id' => $row['resource_category_id'],
'category_database_id' => 1,
'category_name' => isset( $row['category_title'] ) ? $row['category_title'] : $row['title'],
'category_name' => $row['category_title'] ?? $row['title'],
'category_parent_id' => $row['parent_category_id'],
'category_position' => $row['display_order'],
'category_fields' => array( 'resource_title', 'resource_tagline', 'resource_content' ),
@@ -271,7 +267,7 @@ class Xenfororm extends Software
*
* @return void
*/
public function convertCmsDatabaseRecords()
public function convertCmsDatabaseRecords() : void
{
$libraryClass = $this->getLibrary();
@@ -319,9 +315,9 @@ class Xenfororm 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
{
try
{
@@ -49,9 +49,9 @@ class Expressionengine extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
return "Expression Engine";
}
@@ -59,9 +59,9 @@ class Expressionengine extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
return 'expressionengine';
}
@@ -69,9 +69,9 @@ class Expressionengine 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(
'convertProfileFields' => array(
@@ -109,9 +109,9 @@ class Expressionengine extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$rows['convertPmAttachments'] = array(
@@ -130,9 +130,9 @@ class Expressionengine extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -140,9 +140,9 @@ class Expressionengine extends Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return FALSE;
}
@@ -150,9 +150,9 @@ class Expressionengine extends Software
/**
* List of Conversion Methods that require more information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertAttachments',
@@ -166,9 +166,9 @@ class Expressionengine extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -179,10 +179,10 @@ class Expressionengine 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();
@@ -311,9 +311,9 @@ class Expressionengine extends Software
/**
* Finish
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -344,7 +344,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
@@ -389,8 +389,7 @@ class Expressionengine extends Software
Db::i()->update( 'core_members', array( 'signature' => $signature ), array( "member_id=?", $memberId ) );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
$libraryClass->setLastKeyValue( $row['member_id'] );
}
@@ -401,7 +400,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -432,7 +431,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -473,7 +472,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -579,7 +578,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -635,7 +634,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -662,7 +661,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertPmAttachments()
public function convertPmAttachments() : void
{
$libraryClass = $this->getLibrary();
@@ -708,8 +707,7 @@ class Expressionengine extends Software
Db::i()->update( 'core_message_posts', array( 'msg_post' => $message ), array( "msg_id=?", $pmId ) );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
$libraryClass->setLastKeyValue( $row['attachment_id'] );
}
@@ -718,9 +716,9 @@ class Expressionengine extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -753,7 +751,7 @@ class Expressionengine extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$length = strlen( $member->conv_password );
$providedHash = FALSE;
@@ -778,6 +776,6 @@ class Expressionengine extends Software
break;
}
return ( Login::compareHashes( $member->conv_password, $providedHash ) ) ? TRUE : FALSE;
return Login::compareHashes( $member->conv_password, $providedHash );
}
}
@@ -26,6 +26,7 @@ use IPS\convert\Software;
use IPS\Data\Cache;
use IPS\Data\Store;
use IPS\Db;
use IPS\Db\Exception as DbException;
use IPS\File;
use IPS\Http\Url;
use IPS\Member;
@@ -52,12 +53,12 @@ class Invisioncommunity extends Software
/**
* @brief Whether the versions of IPS4 match
*/
public static $versionMatch = FALSE;
public static bool $versionMatch = FALSE;
/**
* @brief Whether the database has been required
*/
public static $dbNeeded = FALSE;
public static bool $dbNeeded = FALSE;
/**
* Constructor
@@ -67,12 +68,12 @@ class Invisioncommunity extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
/* Set filename obscuring flag */
Library::$obscureFilenames = FALSE;
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if( $needDB )
{
@@ -88,18 +89,16 @@ class Invisioncommunity extends Software
static::$versionMatch = TRUE;
}
}
catch( \IPS\Db\Exception $e ) {}
catch( DbException $e ) {}
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return 'Invision Community (' . Application::load( 'core' )->version . ')';
@@ -108,9 +107,9 @@ class Invisioncommunity extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "invisioncommunity";
@@ -119,9 +118,9 @@ class Invisioncommunity extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
if( !static::$versionMatch AND static::$dbNeeded )
{
@@ -239,9 +238,9 @@ class Invisioncommunity extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -249,9 +248,9 @@ class Invisioncommunity 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(
'convertEmoticons',
@@ -268,10 +267,10 @@ class Invisioncommunity extends Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -288,7 +287,7 @@ class Invisioncommunity extends Software
$return[ $method ] = array(
'upload_path' => array(
'field_class' => 'IPS\\Helpers\\Form\\Text',
'field_default' => isset( $this->app->_session['more_info']['convertEmoticons']['upload_path'] ) ? $this->app->_session['more_info']['convertEmoticons']['upload_path'] : NULL,
'field_default' => $this->app->_session['more_info']['convertEmoticons']['upload_path'] ?? NULL,
'field_required' => TRUE,
'field_extra' => array(),
'field_hint' => Member::loggedIn()->language()->addToStack('convert_invision_upload_path'),
@@ -365,9 +364,9 @@ class Invisioncommunity 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -450,7 +449,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertAcronyms()
public function convertAcronyms() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'a_id' );
@@ -471,7 +470,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
@@ -491,14 +490,14 @@ class Invisioncommunity extends Software
/* Remap rows */
$name = explode( '/', $row['image'] );
$row['filename'] = isset( $name[1] ) ? $name[1] : $name[0];
$row['filename'] = $name[1] ?? $name[0];
$path = ( isset( $name[1] ) ) ? $this->app->_session['more_info']['convertEmoticons']['upload_path'] . "/{$name[0]}" : $this->app->_session['more_info']['convertEmoticons']['upload_path'];
$path2 = NULL;
if( $row['image_2x'] )
{
$name2 = explode( '/', $row['image_2x'] );
$row['filenamex2'] = isset( $name2[1] ) ? $name2[1] : $name2[0];
$row['filenamex2'] = $name2[1] ?? $name2[0];
$path2 = ( isset( $name2[1] ) ) ? $this->app->_session['more_info']['convertEmoticons']['upload_path'] . "/{$name2[0]}" : $this->app->_session['more_info']['convertEmoticons']['upload_path'];
}
@@ -543,7 +542,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertBanFilters()
public function convertBanFilters() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'ban_id' );
@@ -563,7 +562,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'g_id' );
@@ -598,7 +597,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertProfileFieldGroups()
public function convertProfileFieldGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'pf_group_id' );
@@ -621,7 +620,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'pf_id' );
@@ -648,7 +647,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'member_id' );
@@ -706,7 +705,7 @@ class Invisioncommunity extends Software
unset( $row['members_bitoptions'], $row['members_bitoptions2'] );
$path = $this->app->_session['more_info']['convertMembers']['upload_path'] . '/';
$libraryClass->convertMember( $row, $profileFields, $profilePhotoName, $path . ( isset( $bits[0] ) ? $bits[0] : '' ), NULL, $coverPhotoName, $path . ( isset( $coverBits[0] ) ? $coverBits[0] : '' ) );
$libraryClass->convertMember( $row, $profileFields, $profilePhotoName, $path . ( $bits[0] ?? '' ), NULL, $coverPhotoName, $path . ( $coverBits[0] ?? '' ) );
/* Any friends need converting to followers? */
foreach( $this->db->select( '*', 'core_follow', array( 'follow_app=? AND follow_area=? AND follow_rel_id=?', 'core', 'member', $row['member_id'] ) ) as $follow )
@@ -748,7 +747,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertProfanityFilters()
public function convertProfanityFilters() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'wid' );
@@ -768,7 +767,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertQuestionAndAnswers()
public function convertQuestionAndAnswers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'qa_id' );
@@ -793,7 +792,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertReputationLevels()
public function convertReputationLevels() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'level_id' );
@@ -819,7 +818,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertReactions()
public function convertReactions() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'reaction_id' );
@@ -834,7 +833,7 @@ class Invisioncommunity extends Software
/* Remap rows */
$name = explode( '/', $row['reaction_icon'] );
$row['filename'] = isset( $name[1] ) ? $name[1] : $name[0];
$row['filename'] = $name[1] ?? $name[0];
$path = ( isset( $name[1] ) ) ? $this->app->_session['more_info']['convertReactions']['upload_path'] . "/{$name[0]}" : $this->app->_session['more_info']['convertReactions']['upload_path'];
/* We'll figure this out later */
@@ -851,7 +850,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertWarnReasons()
public function convertWarnReasons() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'wr_id' );
@@ -874,7 +873,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertAnnouncements()
public function convertAnnouncements() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'announce_id' );
@@ -894,7 +893,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertDnameChanges()
public function convertDnameChanges() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'log_id' );
@@ -915,7 +914,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'ignore_id' );
@@ -935,7 +934,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'mt_id' );
@@ -957,7 +956,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'msg_id' );
@@ -977,7 +976,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertModerators()
public function convertModerators() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
@@ -997,7 +996,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertClubs()
public function convertClubs() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
@@ -1025,7 +1024,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertClubMembers()
public function convertClubMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'club_id' );
@@ -1045,7 +1044,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertClubPages()
public function convertClubPages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'page_id' );
@@ -1065,12 +1064,12 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'attach_id' );
$mapTypes = array_keys( Application::load('core')->extensions( 'core', 'EditorLocations', FALSE, FALSE ) );
$mapTypes = array_keys( Application::load('core')->extensions( 'core', 'EditorLocations', FALSE ) );
array_walk( $mapTypes, function( &$value )
{
$value = 'core_' . $value;
@@ -1118,7 +1117,6 @@ class Invisioncommunity extends Software
// Can't convert this type
$libraryClass->setLastKeyValue( $row['attach_id'] );
continue 2;
break;
}
/* This applies to all options */
@@ -1146,7 +1144,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertMemberHistory()
public function convertMemberHistory() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'log_id' );
@@ -1165,14 +1163,14 @@ class Invisioncommunity extends Software
/**
* @brief Default language
*/
protected $_defaultLanguage = NULL;
protected ?int $_defaultLanguage = NULL;
/**
* Get default language id
*
* @return int
*/
protected function _defaultLanguage()
protected function _defaultLanguage() : int
{
if( $this->_defaultLanguage !== NULL )
{
@@ -1185,7 +1183,7 @@ class Invisioncommunity extends Software
/**
* @brief Word storage
*/
protected $_words = [];
protected array $_words = [];
/**
* Get word from language system
@@ -1193,7 +1191,7 @@ class Invisioncommunity extends Software
* @param string $key Word key
* @return string
*/
public function getWord( $key )
public function getWord( string $key ) : string
{
if( isset( $this->_words[ $key ] ) )
{
@@ -1202,7 +1200,7 @@ class Invisioncommunity extends Software
try
{
$result = $this->_words[ $key ] = $this->db->select( 'word_custom, word_default', 'core_sys_lang_words', array( 'word_key=? AND lang_id=?', $key, $this->_defaultLanguage() ) )->first();
$result = $this->db->select( 'word_custom, word_default', 'core_sys_lang_words', array( 'word_key=? AND lang_id=?', $key, $this->_defaultLanguage() ) )->first();
}
/* Can't find the word, so return the original string */
catch( UnderflowException $e )
@@ -1222,17 +1220,17 @@ class Invisioncommunity extends Software
/**
* @brief Table schema storage
*/
protected $_schemas = array();
protected array $_schemas = array();
/**
* Remove non-standard columns from row data
*
* @param array $row Database result row
* @param string $table Table name
* @param string $app App to check
* @param string|null $app App to check
* @return void
*/
public function unsetNonStandardColumns( &$row, $table, $app=NULL )
public function unsetNonStandardColumns( array &$row, string $table, ?string $app=NULL ) : void
{
if( $app === NULL )
{
@@ -1261,9 +1259,9 @@ class Invisioncommunity extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -40,9 +40,9 @@ class Joomla extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Joomla";
@@ -51,9 +51,9 @@ class Joomla extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "joomla";
@@ -62,9 +62,9 @@ class Joomla 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(
'convertGroups' => array(
@@ -81,9 +81,9 @@ class Joomla extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -91,9 +91,9 @@ class Joomla 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(
'convertGroups'
@@ -103,10 +103,10 @@ class Joomla extends Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -144,9 +144,9 @@ class Joomla 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -166,7 +166,7 @@ class Joomla extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -202,7 +202,7 @@ class Joomla extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -254,14 +254,14 @@ class Joomla extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
/* Joomla 3 */
if( preg_match( '/^\$2[ay]\$(0[4-9]|[1-2][0-9]|3[0-1])\$[a-zA-Z0-9.\/]{53}/', $member->conv_password ) )
{
require_once \IPS\ROOT_PATH . "/applications/convert/sources/Login/PasswordHash.php";
$ph = new PasswordHash( 8, TRUE );
return $ph->CheckPassword( $password, $member->conv_password ) ? TRUE : FALSE;
return $ph->CheckPassword( $password, $member->conv_password );
}
/* Joomla 2 */
@@ -51,9 +51,9 @@ class Mybb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "MyBB 1.8.x";
@@ -62,9 +62,9 @@ class Mybb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "mybb";
@@ -73,9 +73,9 @@ class Mybb 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(
'convertBanfilters' => array(
@@ -132,9 +132,9 @@ class Mybb extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -142,9 +142,9 @@ class Mybb 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(
'convertEmoticons',
@@ -157,10 +157,10 @@ class Mybb 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 )
@@ -286,9 +286,9 @@ class Mybb 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -318,9 +318,9 @@ class Mybb extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -342,7 +342,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertAnnouncements()
public function convertAnnouncements() : void
{
$libraryClass = $this->getLibrary();
@@ -369,7 +369,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertBanfilters()
public function convertBanfilters() : void
{
$libraryClass = $this->getLibrary();
@@ -408,7 +408,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -448,7 +448,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertWarnActions()
public function convertWarnActions() : void
{
$libraryClass = $this->getLibrary();
@@ -475,7 +475,6 @@ class Mybb extends Software
}
else
{
$suspend_unit = 'h';
$suspend = floor( $action['length'] / 3600 );
}
break;
@@ -489,7 +488,6 @@ class Mybb extends Software
}
else
{
$rpa_unit = 'h';
$rpa = floor( $action['length'] / 3600 );
}
break;
@@ -503,7 +501,6 @@ class Mybb extends Software
}
else
{
$mq_unit = 'h';
$mq = floor( $action['length'] / 3600 );
}
break;
@@ -529,7 +526,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertWarnReasons()
public function convertWarnReasons() : void
{
$libraryClass = $this->getLibrary();
@@ -553,7 +550,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -597,31 +594,28 @@ class Mybb extends Software
* @param string $type MyBB Type
* @return string IPS Type
*/
protected function _fieldMap( $type )
protected function _fieldMap( string $type ) : string
{
switch( $type )
{
case 'text':
return 'Text';
break;
case 'textarea':
return "TextArea";
break;
case 'select':
case 'multiselect':
return 'Select';
break;
case 'checkbox':
return 'CheckboxSet';
break;
case 'radio':
return 'Radio';
break;
}
return '';
}
/**
@@ -629,7 +623,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -656,7 +650,6 @@ class Mybb extends Software
/* Bubble up */
throw new UnderflowException;
}
$promotion_unit = 0;
$promotion_data = array( $promotion['newusergroup'], $promotion['posts'] );
break;
@@ -665,7 +658,6 @@ class Mybb extends Software
{
throw new UnderflowException;
}
$promotion_unit = 0;
$promotion_data = array( $promotion['newusergroup'], $promotion['registered'] );
break;
}
@@ -674,8 +666,8 @@ class Mybb extends Software
/* Username Styles */
$style = explode( '{username}', $row['namestyle'] );
$prefix = isset( $style[0] ) ? $style[0] : '';
$suffix = isset( $style[1] ) ? $style[1] : '';
$prefix = $style[0] ?? '';
$suffix = $style[1] ?? '';
$info = array(
'g_id' => $row['gid'],
@@ -729,7 +721,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -982,7 +974,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -1025,7 +1017,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -1051,7 +1043,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertProfanityFilters()
public function convertProfanityFilters() : void
{
$libraryClass = $this->getLibrary();
@@ -1074,7 +1066,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertQuestionAndAnswers()
public function convertQuestionAndAnswers() : void
{
$libraryClass = $this->getLibrary();
@@ -1094,9 +1086,9 @@ class Mybb extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -1129,7 +1121,7 @@ class Mybb extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
if ( Login::compareHashes( $member->conv_password, md5( md5( $member->misc ) . md5( $password ) ) ) )
{
@@ -44,9 +44,9 @@ class Photopost extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Photopost (8.x)";
@@ -55,9 +55,9 @@ class Photopost extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "photopost";
@@ -66,9 +66,9 @@ class Photopost 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(
'convertGroups' => array(
@@ -85,9 +85,9 @@ class Photopost 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(
'convertGroups',
@@ -98,10 +98,10 @@ class Photopost 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();
@@ -173,9 +173,9 @@ class Photopost 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -199,7 +199,7 @@ class Photopost extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -233,7 +233,7 @@ class Photopost extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -307,9 +307,9 @@ class Photopost extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -54,9 +54,9 @@ class Phpbb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "phpBB (3.1.x/3.2.x/3.3.x)";
@@ -65,9 +65,9 @@ class Phpbb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "phpbb";
@@ -76,9 +76,9 @@ class Phpbb 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(
'convertEmoticons' => array(
@@ -128,9 +128,9 @@ class Phpbb extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$rows['convertBanfilters2'] = array(
@@ -149,13 +149,13 @@ class Phpbb 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 )
{
@@ -172,20 +172,18 @@ class Phpbb extends Software
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
return $count;
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -193,9 +191,9 @@ class Phpbb extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_phpbb_preconvert';
}
@@ -203,9 +201,9 @@ class Phpbb 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(
'convertEmoticons',
@@ -218,10 +216,10 @@ class Phpbb 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
{
switch( $method )
{
@@ -349,9 +347,9 @@ class Phpbb 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -384,7 +382,7 @@ class Phpbb extends Software
* @note PHPBB does bbcode like '[b:lsu27ljs]Bold text here[/b:lsu27ljs]' so we need to strip these uids to parse properly
* @return string
*/
public static function stripUid( $post, $uid )
public static function stripUid( string $post, string $uid ) : string
{
return str_replace( ":" . $uid . "]", "]", $post );
}
@@ -392,9 +390,9 @@ class Phpbb extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -463,7 +461,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -493,7 +491,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -537,11 +535,6 @@ class Phpbb extends Software
$default = json_encode( $options );
break;
case 'googleplus':
case 'string':
$type = 'Text';
break;
case 'int':
$type = 'Number';
break;
@@ -553,7 +546,9 @@ class Phpbb extends Software
case 'url':
$type = 'Url';
break;
case 'googleplus':
case 'string':
default:
$type = 'Text';
break;
@@ -586,7 +581,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -634,14 +629,14 @@ class Phpbb extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'user_id' );
try
{
/* Try to auto detect the salt */
/* Try to auto-detect the salt */
$avatarSalt = $this->db->select( 'config_value', 'config', array( 'config_name=?', 'avatar_salt' ) )->first();
if( empty( $avatarSalt ) )
@@ -735,7 +730,7 @@ class Phpbb extends Software
'last_activity' => $row['user_lastmark'],
'mgroup_others' => $groups,
'timezone' => $timezone,
'allow_admin_mails' => ( $row['user_allow_massemail'] ) ? TRUE : FALSE,
'allow_admin_mails' => (bool)$row['user_allow_massemail'],
'members_disable_pm' => ( $row['user_allow_pm'] ) ? 0 : 1,
'member_posts' => $row['user_posts'],
'member_last_post' => $row['user_lastpost_time'],
@@ -864,7 +859,7 @@ class Phpbb extends Software
'wl_moderator' => $log['user_id'],
'wl_date' => $warn['warning_time'],
'wl_points' => 1,
'wl_note_member' => isset( $data[0] ) ? $data[0] : NULL,
'wl_note_member' => $data[0] ?? NULL,
) );
/* Add a member history record for this member */
@@ -888,7 +883,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -914,7 +909,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertProfanityFilters()
public function convertProfanityFilters() : void
{
$libraryClass = $this->getLibrary();
@@ -938,7 +933,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertBanfilters()
public function convertBanfilters() : void
{
$libraryClass = $this->getLibrary();
@@ -980,7 +975,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertBanfilters2()
public function convertBanfilters2() : void
{
$libraryClass = $this->getLibrary();
@@ -1004,7 +999,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -1064,7 +1059,7 @@ class Phpbb extends Software
'map_user_id' => $to['user_id'],
'map_is_starter' => 0,
'map_last_topic_reply' => $row['message_time'],
'map_folder_id' => ( $to['folder_id'] > 0 ) ? $this->_getPmFolder( $to['user_id'], $to['folder_id'] ) : FALSE
'map_folder_id' => $to['folder_id'] > 0 and $this->_getPmFolder( $to['user_id'], $to['folder_id'] )
);
}
@@ -1079,7 +1074,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -1103,9 +1098,9 @@ class Phpbb extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -1134,12 +1129,12 @@ class Phpbb extends Software
/**
* @brief Lookup cache
*/
protected static $pmFolders = array();
protected static array $pmFolders = array();
/**
* @brief PhpBB Source Folders
*/
protected static $phpBbFolders = NULL;
protected static ?array $phpBbFolders = NULL;
/**
* Get array key for the folder
@@ -1148,7 +1143,7 @@ class Phpbb extends Software
* @param string $folderId Folder Name
* @return boolean
*/
protected function _getPmFolder( $user, $folderId )
protected function _getPmFolder( int $user, string $folderId ) : bool
{
/* Check for cached folder info */
if( isset( static::$pmFolders[ $user ][ $folderId ] ) )
@@ -1170,7 +1165,7 @@ class Phpbb extends Software
throw new OutOfRangeException;
}
$member = Member::load( $this->app->getLink( (int) $user, 'core_members' ) );
$member = Member::load( $this->app->getLink( $user, 'core_members' ) );
$filters = json_decode( $member->pconversation_filters, TRUE );
/* No PM Folders or it's a guest */
@@ -1195,7 +1190,7 @@ class Phpbb extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$password = html_entity_decode( $password );
$success = FALSE;
@@ -1206,7 +1201,7 @@ class Phpbb extends Software
{
require_once \IPS\ROOT_PATH . "/applications/convert/sources/Login/PasswordHash.php";
$ph = new PasswordHash( 8, TRUE );
$success = $ph->CheckPassword( $password, $member->conv_password ) ? TRUE : FALSE;
$success = $ph->CheckPassword( $password, $member->conv_password );
}
$hashLibrary = new HashCryptPrivate;
@@ -1218,18 +1213,18 @@ class Phpbb extends Software
if ( strlen( $hash ) == 34 )
{
$success = ( Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $password, $hash, $itoa64 ) ) ) ? TRUE : FALSE;
$success = Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $password, $hash, $itoa64 ) );
}
else
{
$success = ( Login::compareHashes( $hash, $single_md5_pass ) ) ? TRUE : FALSE;
$success = Login::compareHashes( $hash, $single_md5_pass );
}
}
/* phpBB2 */
if ( !$success )
{
$success = ( Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $single_md5_pass, $hash, $itoa64 ) ) ) ? TRUE : FALSE ;
$success = Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $single_md5_pass, $hash, $itoa64 ) );
}
/* Fallback to password_verify(), this applies to PhpBB 3.3+ where Argon may be used */
@@ -36,9 +36,9 @@ class Phpmyforum extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "PhpMyForum";
@@ -47,9 +47,9 @@ class Phpmyforum extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "phpmyforum";
@@ -58,9 +58,9 @@ class Phpmyforum extends Software
/**
* Content we can convert from this software.
*
* @return NULL
* @return array|NULL
*/
public static function canConvert()
public static function canConvert(): ?array
{
return NULL;
}
@@ -68,9 +68,9 @@ class Phpmyforum extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -44,9 +44,9 @@ class Punbb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "PunBB (1.x)";
@@ -55,9 +55,9 @@ class Punbb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "punbb";
@@ -66,9 +66,9 @@ class Punbb 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(
'convertGroups' => array(
@@ -93,9 +93,9 @@ class Punbb extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -103,9 +103,9 @@ class Punbb 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(
'convertGroups',
@@ -116,10 +116,10 @@ class Punbb 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();
@@ -179,9 +179,9 @@ class Punbb 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -206,9 +206,9 @@ class Punbb extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -224,7 +224,7 @@ class Punbb extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -254,7 +254,7 @@ class Punbb extends Software
$libraryClass->convertGroup( $info );
$libraryClass->setLastKeyValue( $row['g_id'], $merge );
$libraryClass->setLastKeyValue( $row['g_id'] );
}
/* Now check for group promotions */
@@ -272,7 +272,7 @@ class Punbb extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -343,7 +343,7 @@ class Punbb extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -394,7 +394,7 @@ class Punbb extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -419,9 +419,9 @@ class Punbb extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -454,7 +454,7 @@ class Punbb extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$success = FALSE;
@@ -49,9 +49,9 @@ class Smf extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Simple Machines Forum (2.0.x)";
@@ -60,9 +60,9 @@ class Smf extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "smf";
@@ -71,9 +71,9 @@ class Smf 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(
'convertBanfilters' => array(
@@ -114,9 +114,9 @@ class Smf extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -124,9 +124,9 @@ class Smf 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(
'convertEmoticons',
@@ -139,13 +139,13 @@ class Smf 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 )
{
@@ -162,21 +162,19 @@ class Smf extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* 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 )
@@ -306,9 +304,9 @@ class Smf 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -337,9 +335,9 @@ class Smf extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -364,7 +362,7 @@ class Smf extends Software
*
* @return void
*/
public function convertBanfilters()
public function convertBanfilters() : void
{
$libraryClass = $this->getLibrary();
@@ -406,7 +404,7 @@ class Smf extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -435,7 +433,7 @@ class Smf extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -493,7 +491,7 @@ class Smf extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -518,7 +516,7 @@ class Smf extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -580,7 +578,7 @@ class Smf extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -627,7 +625,7 @@ class Smf extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -866,7 +864,7 @@ class Smf extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -900,10 +898,10 @@ class Smf extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
* @note Current profile URL format: /index.php?action=profile;u=123
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -954,7 +952,7 @@ class Smf extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
if ( Login::compareHashes( $member->conv_password, sha1( mb_strtolower( $member->name ) . html_entity_decode( $password ) ) ) )
{
@@ -17,6 +17,7 @@ use Exception;
use IPS\Application\Module;
use IPS\Content\Search\Index;
use IPS\convert\Software;
use IPS\convert\Software\Exception as SoftwareException;
use IPS\core\Ignore;
use IPS\Data\Cache;
use IPS\Data\Store;
@@ -48,25 +49,25 @@ class UBBthreads extends Software
* @brief Emoticons WHERE statement
* @see convertEmoticons()
*/
protected static $emoticonsWhere = 'GRAEMLIN_IS_ACTIVE=1';
protected static string $emoticonsWhere = 'GRAEMLIN_IS_ACTIVE=1';
/**
* @brief Groups WHERE statement
* @see convertGroups()
*/
protected static $groupsWhere = 'GROUP_IS_DISABLED=0';
protected static string $groupsWhere = 'GROUP_IS_DISABLED=0';
/**
* @brief Ignored users WHERE statement
* @see convertIgnoredUsers()
*/
protected static $ignoredUsersWhere = "USER_IGNORE_LIST IS NOT NULL AND USER_IGNORE_LIST NOT IN ( '', '-' )";
protected static string $ignoredUsersWhere = "USER_IGNORE_LIST IS NOT NULL AND USER_IGNORE_LIST NOT IN ( '', '-' )";
/**
* @brief Members WHERE statement
* @see convertMembers()
*/
protected static $membersWhere = array( 'u.USER_LOGIN_NAME<>?', '**DONOTDELETE**' );
protected static array $membersWhere = array( 'u.USER_LOGIN_NAME<>?', '**DONOTDELETE**' );
/**
* This is.. kind of hacky, but it's used so we can try and support non-exact profanity matches without converting
@@ -75,7 +76,7 @@ class UBBthreads extends Software
* @brief Profanity filters WHERE statement
* @see convertProfanityFilters()
*/
protected static $profanityFiltersWhere = '(
protected static string $profanityFiltersWhere = '(
CENSOR_WORD NOT LIKE "%(.*)%" AND (
CENSOR_WORD NOT LIKE "%(.*?)%" OR (
CENSOR_WORD LIKE "%(.*?)" AND CENSOR_WORD NOT LIKE "%(.*?)%(.*?)"
@@ -86,9 +87,9 @@ class UBBthreads extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "UBBthreads";
@@ -97,9 +98,9 @@ class UBBthreads extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "ubbthreads";
@@ -108,9 +109,9 @@ class UBBthreads 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(
'convertEmoticons' => array(
@@ -156,9 +157,9 @@ class UBBthreads extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$count = $this->countRows( static::canConvert()['convertMembersFollowers']['table'], static::canConvert()['convertMembersFollowers']['where'] );
@@ -182,9 +183,9 @@ class UBBthreads extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -192,13 +193,13 @@ class UBBthreads 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 )
{
@@ -214,9 +215,9 @@ class UBBthreads 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(
'convertEmoticons',
@@ -231,7 +232,7 @@ class UBBthreads extends Software
* @param string $date Date to try to convert
* @return DateTime|null
*/
protected function stringToDateTime( $date )
protected function stringToDateTime( string $date ) : ?DateTime
{
try
{
@@ -246,10 +247,10 @@ class UBBthreads 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 )
@@ -347,9 +348,9 @@ class UBBthreads 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -379,9 +380,9 @@ class UBBthreads extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -398,7 +399,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertBanfilters()
public function convertBanfilters() : void
{
$libraryClass = $this->getLibrary();
@@ -432,7 +433,7 @@ class UBBthreads extends Software
) );
}
throw new \IPS\convert\Software\Exception;
throw new SoftwareException;
}
/**
@@ -440,7 +441,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -474,7 +475,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'GROUP_ID' );
@@ -508,7 +509,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'USER_ID' );
@@ -547,7 +548,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'u.USER_ID' );
@@ -635,7 +636,7 @@ class UBBthreads extends Software
}
$fieldColumn = 'USER_' . strtoupper( $pseudo );
$pfields[ $pseudo ] = isset( $row[ $fieldColumn ] ) ? $row[ $fieldColumn ] : NULL;
$pfields[ $pseudo ] = $row[$fieldColumn] ?? NULL;
}
/* Profile photo */
@@ -670,7 +671,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertMembersFollowers()
public function convertMembersFollowers() : void
{
$libraryClass = $this->getLibrary();
@@ -692,7 +693,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'TOPIC_ID' );
@@ -735,7 +736,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -761,7 +762,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertProfanityFilters()
public function convertProfanityFilters() : void
{
$libraryClass = $this->getLibrary();
@@ -783,15 +784,15 @@ class UBBthreads extends Software
) );
}
throw new \IPS\convert\Software\Exception;
throw new SoftwareException;
}
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -829,7 +830,7 @@ class UBBthreads extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$hash = $member->members_pass_hash;
$salt = $member->members_pass_salt;
@@ -14,10 +14,7 @@ namespace IPS\convert\Software\Core;
use DateTimeZone;
use erusev\Parsedown;
use Exception;
use InvalidArgumentException;
use IPS\Content\Search\Index;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\Data\Cache;
use IPS\Data\Store;
@@ -51,9 +48,9 @@ class Vanilla extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Vanilla (3.x)";
@@ -62,9 +59,9 @@ class Vanilla extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vanilla";
@@ -73,9 +70,9 @@ class Vanilla extends Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return TRUE;
}
@@ -83,9 +80,9 @@ class Vanilla extends Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
$settings = array(
'fluid' => array( 'title' => Member::loggedIn()->language()->addToStack( 'use_fluid_view_convert' ), 'value' => true, 'our_key' => 'use_fluid_view_convert', 'our_title' => Member::loggedIn()->language()->addToStack( 'use_fluid_view_convert' ) )
@@ -100,9 +97,9 @@ class Vanilla extends Software
* @param array $settings Settings to convert
* @return void
*/
public function convertSettings( $settings=array() )
public function convertSettings( array $settings=array() ) : void
{
if ( !isset( $settings['use_fluid_view_convert'] ) OR $settings['use_fluid_view_convert'] == FALSE )
if ( !isset( $settings['use_fluid_view_convert'] ) OR !$settings['use_fluid_view_convert'] )
{
return;
}
@@ -116,9 +113,9 @@ class Vanilla extends Software
*
* @param string $location File location retrieved from the database
* @param string $uploadsPath Configured uploads path
* @return Url|string|void
* @return Url|string|null
*/
public static function parseMediaLocation( $location, $uploadsPath )
public static function parseMediaLocation( string $location, string $uploadsPath ) : Url|string|null
{
$uploadsPath = str_replace( '\\', '/', $uploadsPath );
@@ -148,7 +145,7 @@ class Vanilla extends Software
{
if ( !isset( $parts['path'], $parts['host'] ) )
{
return;
return null;
}
// This is a url in the format type:://domain/path.
@@ -173,7 +170,7 @@ class Vanilla extends Software
* @param string $date Date(Time) string
* @return DateTime Timestamp on successful conversion, otherwise NULL
*/
public static function mysqlToDateTime( $date )
public static function mysqlToDateTime( string $date ) : DateTime
{
return DateTime::ts( strtotime( $date ) ?: time() );
}
@@ -181,9 +178,9 @@ class Vanilla 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(
'convertGroups' => array(
@@ -208,9 +205,9 @@ class Vanilla extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -218,9 +215,9 @@ class Vanilla extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_vanilla_preconvert';
}
@@ -228,9 +225,9 @@ class Vanilla 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(
'convertGroups',
@@ -241,10 +238,10 @@ class Vanilla 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
{
switch( $method )
{
@@ -294,9 +291,9 @@ class Vanilla 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -325,14 +322,14 @@ class Vanilla extends Software
/**
* @brief Store parsedown object
*/
protected static $_parseDown = NULL;
protected static ?Parsedown $_parseDown = NULL;
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -419,7 +416,7 @@ class Vanilla extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'r.RoleID' );
@@ -454,7 +451,7 @@ class Vanilla extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'u.UserID' );
@@ -542,7 +539,7 @@ class Vanilla extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'ConversationID' );
@@ -569,14 +566,14 @@ class Vanilla extends Software
$maps = array();
$rows = iterator_to_array( $this->db->select( '*', 'UserConversation', array( 'ConversationID=?', $row['ConversationID'] ) ) );
$this->app->preCacheLinks( $rows, [ 'core_members' => 'UserID' ] );
foreach ( $rows as $row )
foreach ( $rows as $r )
{
$maps[ $row['UserID'] ] = array(
'map_user_id' => $row['UserID'],
'map_read_time' => static::mysqlToDateTime( $row['DateLastViewed'] ),
$maps[ $r['UserID'] ] = array(
'map_user_id' => $r['UserID'],
'map_read_time' => static::mysqlToDateTime( $r['DateLastViewed'] ),
//'map_folder_id' => TODO: Create a Bookmarks folder for "Bookmarked" conversations?
'map_user_active' => $row['Deleted'] == 0 ? 1 : 0,
'map_last_topic_reply' => static::mysqlToDateTime( $row['DateConversationUpdated'] )
'map_user_active' => $r['Deleted'] == 0 ? 1 : 0,
'map_last_topic_reply' => static::mysqlToDateTime( $r['DateConversationUpdated'] )
);
}
@@ -590,7 +587,7 @@ class Vanilla extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'MessageID' );
@@ -626,14 +623,14 @@ class Vanilla extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
/* Vanilla 2.2 */
if( preg_match( '/^\$2[ay]\$(0[4-9]|[1-2][0-9]|3[0-1])\$[a-zA-Z0-9.\/]{53}/', $member->conv_password ) OR mb_substr( $member->conv_password, 0, 3 ) == '$P$' )
{
require_once \IPS\ROOT_PATH . "/applications/convert/sources/Login/PasswordHash.php";
$ph = new PasswordHash( 8, TRUE );
return $ph->CheckPassword( $password, $member->conv_password ) ? TRUE : FALSE;
return $ph->CheckPassword( $password, $member->conv_password );
}
if ( Login::compareHashes( $member->conv_password, md5( md5( str_replace( '&#39;', "'", html_entity_decode( $password ) ) ) . $member->misc ) ) )
@@ -62,17 +62,17 @@ class Vbulletin extends Software
/**
* @brief vBulletin 4 Stores all attachments under one table - this will store the content type for the forums app.
*/
protected static $postContentType = NULL;
protected static ?string $postContentType = NULL;
/**
* @brief The schematic for vB3 and vB4 is similar enough that we can make specific concessions in a single converter for either version.
*/
protected static $isLegacy = NULL;
protected static ?bool $isLegacy = NULL;
/**
* @brief Flag to indicate the post data has been fixed during conversion, and we only need to use Legacy Parser
*/
public static $contentFixed = TRUE;
public static bool $contentFixed = TRUE;
/**
* Constructor
@@ -82,9 +82,9 @@ class Vbulletin 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 )
{
@@ -113,16 +113,14 @@ class Vbulletin 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 "vBulletin (3.8.x/4.x)";
@@ -131,9 +129,9 @@ class Vbulletin extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin";
@@ -142,9 +140,9 @@ class Vbulletin 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(
'convertEmoticons' => array(
@@ -210,9 +208,9 @@ class Vbulletin extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$count = $this->countRows( static::canConvert()['convertMembersFollowers']['table'], static::canConvert()['convertMembersFollowers']['where'] );
@@ -236,13 +234,13 @@ class Vbulletin 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 )
{
@@ -255,7 +253,6 @@ class Vbulletin extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
case 'pm':
try
@@ -276,20 +273,18 @@ class Vbulletin extends Software
}
return parent::countRows( $table, $where, $recache );
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -297,9 +292,9 @@ class Vbulletin extends Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return TRUE;
}
@@ -307,9 +302,9 @@ class Vbulletin extends Software
/**
* Settings Map
*
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array(
'bbtitle' => 'board_name',
@@ -319,9 +314,9 @@ class Vbulletin extends Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
$settings = array();
foreach( $this->settingsMap() AS $theirs => $ours )
@@ -353,9 +348,9 @@ class Vbulletin extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_vb4_preconvert';
}
@@ -363,9 +358,9 @@ class Vbulletin 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(
'convertEmoticons',
@@ -380,10 +375,10 @@ class Vbulletin 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();
@@ -587,9 +582,9 @@ class Vbulletin 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -623,9 +618,9 @@ class Vbulletin extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -695,7 +690,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -758,7 +753,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertProfileFieldGroups()
public function convertProfileFieldGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -792,7 +787,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -887,7 +882,7 @@ class Vbulletin extends Software
* @param string $type The vB Field Type
* @return string The IPS Field Type
*/
protected static function _pfieldMap( $type )
protected static function _pfieldMap( string $type ) : string
{
switch( mb_strtolower( $type ) )
{
@@ -895,20 +890,16 @@ class Vbulletin extends Software
case 'radio':
case 'checkbox':
return ucwords( $type );
break;
case 'textarea':
return 'TextArea';
break;
case 'select_multiple':
return 'Select';
break;
/* Just do Text as default */
default:
return 'Text';
break;
}
}
@@ -917,7 +908,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -929,7 +920,7 @@ class Vbulletin extends Software
$self = $this;
$checkpermission = function ( $name, $perm ) use ( $group, $self )
{
if ( $group[$name] & $self::$bitOptions[$name][$perm] )
if ( $group[$name] & self::$bitOptions[$name][$perm] )
{
return TRUE;
}
@@ -1054,14 +1045,14 @@ class Vbulletin extends Software
/**
* @brief Member history type map
*/
protected static $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'group', 'membergroupids' => 'group' );
protected static array $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'group', 'membergroupids' => 'group' );
/**
* Convert member history
*
* @return void
*/
public function convertMemberHistory()
public function convertMemberHistory() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'changeid' );
@@ -1092,14 +1083,14 @@ class Vbulletin extends Software
/**
* @brief default pseudo fields to convert
*/
protected static $pseudoFields = [ 'homepage', 'icq', 'aim', 'yahoo', 'msn', 'skype', 'user_title' ];
protected static array $pseudoFields = [ 'homepage', 'icq', 'aim', 'yahoo', 'msn', 'skype', 'user_title' ];
/**
* Convert members
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'user.userid' );
@@ -1131,7 +1122,7 @@ class Vbulletin extends Software
$key = $name;
}
if ( $user[$key] & $self::$bitOptions[$name][$perm] )
if ( $user[$key] & self::$bitOptions[$name][$perm] )
{
return TRUE;
}
@@ -1462,8 +1453,8 @@ class Vbulletin extends Software
'vid' => md5( $activation['activationid'] . $activation['useractivationid'] ),
'member_id' => $memberId,
'entry_date' => $activation['dateline'],
'new_reg' => ( $activation['emailchange'] == 0 ? TRUE : FALSE ),
'email_chg' => ( $activation['emailchange'] == 1 ? TRUE : FALSE ),
'new_reg' => $activation['emailchange'] == 0,
'email_chg' => $activation['emailchange'] == 1,
'user_verified' => FALSE,
'ip_address' => $user['ipaddress'],
'email_sent' => $activation['dateline']
@@ -1513,7 +1504,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertMembersFollowers()
public function convertMembersFollowers() : void
{
$libraryClass = $this->getLibrary();
@@ -1536,11 +1527,11 @@ class Vbulletin extends Software
* @param array $settings Settings to convert
* @return void
*/
public function convertSettings( $settings=array() )
public function convertSettings( array $settings=array() ) : void
{
foreach( $this->settingsMap() AS $theirs => $ours )
{
if ( !isset( $values[$ours] ) OR $values[$ours] == FALSE )
if ( !isset( $settings[$ours] ) OR !$settings[$ours] )
{
continue;
}
@@ -1563,7 +1554,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -1589,7 +1580,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCustomBbcode()
public function convertCustomBbcode() : void
{
$libraryClass = $this->getLibrary();
@@ -1615,7 +1606,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertAnnouncements()
public function convertAnnouncements() : void
{
$libraryClass = $this->getLibrary();
@@ -1643,7 +1634,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -1669,7 +1660,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -1706,7 +1697,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertClubs()
public function convertClubs() : void
{
$libraryClass = $this->getLibrary();
@@ -1773,7 +1764,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertClubMembers()
public function convertClubMembers() : void
{
$libraryClass = $this->getLibrary();
foreach( $this->fetch( 'socialgroupmember', 'groupid' ) AS $member )
@@ -1996,7 +1987,7 @@ class Vbulletin extends Software
/**
* @brief Fetched Settings Cache
*/
protected $settingsCache = array();
protected array $settingsCache = array();
/**
* Get Setting Value - useful for global settings that need to be translated to group or member settings
@@ -2004,7 +1995,7 @@ class Vbulletin extends Software
* @param string $key The setting key
* @return mixed
*/
protected function _setting( $key )
protected function _setting( string $key ) : mixed
{
if ( isset( $this->settingsCache[$key] ) )
{
@@ -2036,9 +2027,9 @@ class Vbulletin extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -2148,7 +2139,7 @@ class Vbulletin extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
if ( Login::compareHashes( $member->conv_password, md5( md5( str_replace( '&#39;', "'", html_entity_decode( $password ) ) ) . $member->conv_password_extra ) ) )
{
@@ -2167,7 +2158,7 @@ class Vbulletin extends Software
* @param $pm array
* @return mixed
*/
protected function _convertPm( Library $libraryClass, array $pm )
protected function _convertPm( Library $libraryClass, array $pm ) : mixed
{
try
{
@@ -2242,7 +2233,7 @@ class Vbulletin extends Software
return $libraryClass->convertPrivateMessage( $topic, $maps );
}
protected $_avatars = array();
protected array $_avatars = array();
/**
* Fetch Avatar from Avatar Gallery
@@ -2250,7 +2241,7 @@ class Vbulletin extends Software
* @param int $id Avatar ID
* @return array|bool Array of data/name or FALSE
*/
protected function _getFromAvatarGallery( int $id )
protected function _getFromAvatarGallery( int $id ) : array|bool
{
if( isset( $this->_avatars[ $id ] ) )
{
@@ -20,6 +20,7 @@ use IPS\Application\Module;
use IPS\Content\Search\Index;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\convert\Software\Exception as SoftwareException;
use IPS\core\Ignore;
use IPS\Data\Cache;
use IPS\Data\Store;
@@ -55,7 +56,7 @@ class Vbulletin5 extends Software
/**
* @brief is vB 5.5.3 or newer
*/
protected static $skipCustomProfilePic = NULL;
protected static ?bool $skipCustomProfilePic = NULL;
/**
* Constructor
@@ -65,9 +66,9 @@ class Vbulletin5 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 )
{
@@ -82,16 +83,14 @@ class Vbulletin5 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 "vBulletin (5.x)";
@@ -100,9 +99,9 @@ class Vbulletin5 extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin5";
@@ -111,9 +110,9 @@ class Vbulletin5 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(
'convertEmoticons' => array(
@@ -166,9 +165,9 @@ class Vbulletin5 extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -176,13 +175,13 @@ class Vbulletin5 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 )
{
@@ -201,7 +200,6 @@ class Vbulletin5 extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
case 'node':
if ( $where === 'clubs' )
@@ -212,7 +210,6 @@ class Vbulletin5 extends Software
{
return parent::countRows( $table, $where, $recache );
}
break;
case 'groupintopic':
$clubs = array();
@@ -223,7 +220,6 @@ class Vbulletin5 extends Software
$where = array( $this->db->in( 'nodeid', $clubs ) );
return parent::countRows( $table, $where, $recache );
break;
case 'userchangelog':
try
@@ -234,20 +230,18 @@ class Vbulletin5 extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return TRUE;
}
@@ -255,9 +249,9 @@ class Vbulletin5 extends Software
/**
* Settings Map
*
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array(
'bbtitle' => 'board_name',
@@ -267,9 +261,9 @@ class Vbulletin5 extends Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
$settings = array();
foreach( $this->settingsMap() AS $theirs => $ours )
@@ -301,9 +295,9 @@ class Vbulletin5 extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_vb5_preconvert';
}
@@ -311,9 +305,9 @@ class Vbulletin5 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(
'convertEmoticons',
@@ -328,10 +322,10 @@ class Vbulletin5 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();
@@ -525,9 +519,9 @@ class Vbulletin5 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -559,9 +553,9 @@ class Vbulletin5 extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -651,7 +645,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -698,7 +692,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertProfileFieldGroups()
public function convertProfileFieldGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -732,7 +726,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -806,7 +800,7 @@ class Vbulletin5 extends Software
* @param string $type The vB Field Type
* @return string The IPS Field Type
*/
protected static function _pfieldMap( $type )
protected static function _pfieldMap( string $type ) : string
{
switch( mb_strtolower( $type ) )
{
@@ -814,20 +808,16 @@ class Vbulletin5 extends Software
case 'radio':
case 'checkbox':
return ucwords( $type );
break;
case 'textarea':
return 'TextArea';
break;
case 'select_multiple':
return 'Select';
break;
/* Just do Text as default */
default:
return 'Text';
break;
}
}
@@ -836,7 +826,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -848,7 +838,7 @@ class Vbulletin5 extends Software
$self = $this;
$checkpermission = function ( $name, $perm ) use ( $group, $self )
{
if ( $group[$name] & $self::$bitOptions[$name][$perm] )
if ( $group[$name] & self::$bitOptions[$name][$perm] )
{
return TRUE;
}
@@ -973,14 +963,14 @@ class Vbulletin5 extends Software
/**
* @brief Member history type map
*/
protected static $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'group', 'membergroupids' => 'group' );
protected static array $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'group', 'membergroupids' => 'group' );
/**
* Convert member history
*
* @return void
*/
public function convertMemberHistory()
public function convertMemberHistory() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'changeid' );
@@ -1014,7 +1004,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -1038,7 +1028,7 @@ class Vbulletin5 extends Software
$key = $name;
}
if ( $user[$key] & $self::$bitOptions[$name][$perm] )
if ( $user[$key] & self::$bitOptions[$name][$perm] )
{
return TRUE;
}
@@ -1353,8 +1343,8 @@ class Vbulletin5 extends Software
'vid' => md5( $activation['activationid'] . $activation['useractivationid'] ),
'member_id' => $memberId,
'entry_date' => $activation['dateline'],
'new_reg' => ( $activation['emailchange'] == 0 ? TRUE : FALSE ),
'email_chg' => ( $activation['emailchange'] == 1 ? TRUE : FALSE ),
'new_reg' => $activation['emailchange'] == 0,
'email_chg' => $activation['emailchange'] == 1,
'user_verified' => FALSE,
'ip_address' => $user['ipaddress'],
'email_sent' => $activation['dateline']
@@ -1417,11 +1407,11 @@ class Vbulletin5 extends Software
* @param array $settings Settings to convert
* @return void
*/
public function convertSettings( $settings=array() )
public function convertSettings( array $settings=array() ) : void
{
foreach( $this->settingsMap() AS $theirs => $ours )
{
if ( !isset( $values[$ours] ) OR $values[$ours] == FALSE )
if ( !isset( $settings[$ours] ) OR !$settings[$ours] )
{
continue;
}
@@ -1444,7 +1434,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -1470,7 +1460,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$node = $this->db->select( 'nodeid', 'channel', array( "guid=?", 'vbulletin-4ecbdf567f3da8.31769341' ) )->first();
@@ -1549,7 +1539,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$node = $this->db->select( 'nodeid', 'channel', array( "guid=?", 'vbulletin-4ecbdf567f3da8.31769341' ) )->first();
@@ -1586,7 +1576,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertClubs()
public function convertClubs() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'nodeid' );
@@ -1598,7 +1588,7 @@ class Vbulletin5 extends Software
catch( UnderflowException $e )
{
/* shrug */
throw new \IPS\convert\Software\Exception;
throw new SoftwareException;
}
$categories = array();
@@ -1682,7 +1672,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertClubMembers()
public function convertClubMembers() : void
{
$libraryClass = $this->getLibrary();
$clubs = array();
@@ -1885,7 +1875,7 @@ class Vbulletin5 extends Software
/**
* @brief Fetched Settings Cache
*/
protected $settingsCache = array();
protected array $settingsCache = array();
/**
* Get Setting Value - useful for global settings that need to be translated to group or member settings
@@ -1893,7 +1883,7 @@ class Vbulletin5 extends Software
* @param string $key The setting key
* @return mixed
*/
protected function _setting( $key )
protected function _setting( string $key ) : mixed
{
if ( isset( $this->settingsCache[$key] ) )
{
@@ -1925,9 +1915,9 @@ class Vbulletin5 extends Software
/**
* Helper method to retrieve forums from nodes
*
* @return void
* @return array
*/
protected function fetchForums()
protected function fetchForums() : array
{
$forums = array();
@@ -1943,7 +1933,7 @@ class Vbulletin5 extends Software
* @brief Channel GUID Mappins.
* @note As far as I can tell, these are static and not unique per installation. Only the ones that are used are present.
*/
public static $guids = array(
public static array $guids = array(
'clubs' => 'vbulletin-4ecbdf567f3a38.99555306',
'private_messages' => 'vbulletin-4ecbdf567f3da8.31769341'
);
@@ -1953,7 +1943,7 @@ class Vbulletin5 extends Software
*
* @return array
*/
protected function fetchClubs()
protected function fetchClubs() : array
{
$clubs = array();
@@ -1982,7 +1972,7 @@ class Vbulletin5 extends Software
/**
* @brief Types Cache
*/
protected $typesCache = array();
protected array $typesCache = array();
/**
* Helper method to retrieve content type ids
@@ -1990,7 +1980,7 @@ class Vbulletin5 extends Software
* @param string $type Content type
* @return string
*/
protected function fetchType( $type )
protected function fetchType( string $type ) : string
{
if ( !empty( $this->typesCache ) )
{
@@ -2010,9 +2000,9 @@ class Vbulletin5 extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -2045,7 +2035,7 @@ class Vbulletin5 extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
/* If no algorithm is defined, use the legacy handler */
if ( strpos( $member->misc, 'blowfish' ) === FALSE and strpos( $member->misc, 'legacy' ) === FALSE )
@@ -2064,7 +2054,6 @@ class Vbulletin5 extends Software
require_once \IPS\ROOT_PATH . "/applications/convert/sources/Login/PasswordHash.php";
$ph = new PasswordHash( $algo[ 1 ], FALSE );
return $ph->CheckPassword( $md5_once_password, $member->conv_password );
break;
case 'legacy':
/* Legacy Passwords are stored in a format of HASH SALT so we need to explode on the space. */
@@ -2072,7 +2061,7 @@ class Vbulletin5 extends Software
$member->conv_password = $token[0];
$member->conv_password_extra = $token[1];
return Vbulletin::login( $member, $password );
break;
/** vBulletin 5.6.2 was able to also use the Argon2id password hashing scheme. */
case 'argon2id':
if( defined('PASSWORD_ARGON2ID') ) {
@@ -2082,8 +2071,8 @@ class Vbulletin5 extends Software
{
return FALSE;
}
break;
}
return false;
}
}
@@ -46,14 +46,14 @@ class Woltlab extends Software
/**
* @brief The WCF table prefix can change depending on the number of installs
*/
public static $installId = 1;
public static int $installId = 1;
/**
* Software Name
*
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "WoltLab Suite (3.1)";
@@ -64,7 +64,7 @@ class Woltlab extends Software
*
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "woltlab";
@@ -73,9 +73,9 @@ class Woltlab 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(
'convertProfileFieldGroups' => array(
@@ -116,13 +116,13 @@ class Woltlab 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 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 )
{
@@ -136,20 +136,18 @@ class Woltlab extends Software
{
throw new Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -157,9 +155,9 @@ class Woltlab 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(
'convertProfileFieldGroups',
@@ -173,10 +171,10 @@ class Woltlab 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 )
@@ -329,9 +327,9 @@ class Woltlab 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -362,9 +360,9 @@ class Woltlab extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -377,7 +375,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertProfileFieldGroups()
public function convertProfileFieldGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'categoryID' );
@@ -403,7 +401,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'optionID' );
@@ -476,7 +474,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'smileyID' );
@@ -515,7 +513,7 @@ class Woltlab extends Software
'emo_position' => $row['showOrder'],
);
$libraryClass->convertEmoticon( $info, $set, $this->app->_session['more_info']['convertEmoticons']['keep_existing_emoticons'], $filepath, NULL, $filepathx2, NULL );
$libraryClass->convertEmoticon( $info, $set, $this->app->_session['more_info']['convertEmoticons']['keep_existing_emoticons'], $filepath, NULL, $filepathx2 );
$libraryClass->setLastKeyValue( $row['smileyID'] );
}
}
@@ -525,7 +523,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'groupID' );
@@ -534,8 +532,8 @@ class Woltlab extends Software
{
/* Username Styles */
$style = explode( '%s', $row['userOnlineMarking'] );
$prefix = isset( $style[0] ) ? $style[0] : '';
$suffix = isset( $style[1] ) ? $style[1] : '';
$prefix = $style[0] ?? '';
$suffix = $style[1] ?? '';
$info = array(
'g_id' => $row['groupID'],
@@ -565,7 +563,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'userID' );
@@ -717,7 +715,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'ignoreID' );
@@ -742,7 +740,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'conversationID' );
@@ -789,7 +787,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'messageID' );
@@ -812,13 +810,13 @@ class Woltlab extends Software
/**
* @brief Cache default language
*/
static $_defaultLanguage = NULL;
static ?int $_defaultLanguage = NULL;
/**
* Helper to fetch a WCF lang string
*
* @param string $itemName WCF Language Name
* @param string $itemPrefix WCF Prefix for end-user input
* @param string|null $itemPrefix WCF Prefix for end-user input
* @return string Translated string, or original if no customisation exists
* @throws UnderflowException
*/
@@ -852,7 +850,7 @@ class Woltlab extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
/* If it's not blowfish, then we don't have a salt for it. fail. */
if( preg_match( '/^\$2[ay]\$(0[4-9]|[1-2][0-9]|3[0-1])\$[a-zA-Z0-9.\/]{53}/', $member->conv_password ) )
@@ -41,9 +41,9 @@ class Wordpress extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "WordPress (5.x/6.x)";
@@ -52,9 +52,9 @@ class Wordpress extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "wordpress";
@@ -63,9 +63,9 @@ class Wordpress 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(
'convertMembers' => array(
@@ -78,9 +78,9 @@ class Wordpress extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -88,9 +88,9 @@ class Wordpress extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_wordpress_preconvert';
}
@@ -98,9 +98,9 @@ class Wordpress 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(
'convertMembers',
@@ -110,9 +110,9 @@ class Wordpress extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -123,10 +123,10 @@ class Wordpress 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();
@@ -171,7 +171,7 @@ class Wordpress extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -243,9 +243,9 @@ class Wordpress 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -255,7 +255,7 @@ class Wordpress extends Software
Cache::i()->clearAll();
/* Attachments */
\IPS\Task::queue( 'core', 'RebuildAttachmentThumbnails', array( 'app' => $this->app->app_id ), 1, array( 'app' ) );
Task::queue( 'core', 'RebuildAttachmentThumbnails', array( 'app' => $this->app->app_id ), 1, array( 'app' ) );
/* Content Counts */
Task::queue( 'core', 'RecountMemberContent', array( 'app' => $this->app->app_id ), 4, array( 'app' ) );
@@ -270,14 +270,14 @@ class Wordpress extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$success = FALSE;
// If the hash is still md5...
if ( strlen( $member->conv_password ) <= 32 )
{
$success = ( Login::compareHashes( $member->conv_password, md5( $password ) ) ) ? TRUE : FALSE;
$success = Login::compareHashes( $member->conv_password, md5( $password ) );
}
// New pass hash check
else
@@ -287,7 +287,7 @@ class Wordpress extends Software
$ph = new PasswordHash( 8, TRUE );
// Check it
$success = $ph->CheckPassword( $password, $member->conv_password ) ? TRUE : FALSE;
$success = $ph->CheckPassword( $password, $member->conv_password );
}
return $success;
@@ -29,6 +29,7 @@ use IPS\Request;
use IPS\Task;
use OutOfRangeException;
use UnderflowException;
use ValueError;
use function count;
use function defined;
use function in_array;
@@ -52,9 +53,9 @@ class Wpforo extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "wpForo (2.1.x)";
@@ -63,9 +64,9 @@ class Wpforo extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "wpforo";
@@ -74,9 +75,9 @@ class Wpforo extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return [
'convertGroups' => [
@@ -105,9 +106,9 @@ class Wpforo extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -115,9 +116,9 @@ class Wpforo extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_wpforo_preconvert';
}
@@ -125,9 +126,9 @@ class Wpforo extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return [
'convertMembers',
@@ -138,9 +139,9 @@ class Wpforo extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -172,10 +173,10 @@ class Wpforo 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 = [];
@@ -246,14 +247,14 @@ class Wpforo extends Software
/**
* @brief temporarily store post content
*/
protected $_postContent = [];
protected array $_postContent = [];
/**
* Convert attachments
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'pmid' );
@@ -316,8 +317,7 @@ class Wpforo extends Software
$this->_postContent[ $messagePostId ] = str_replace( $matches[0][ $key ], '[attachment=' . $attachId . ':name]', $this->_postContent[ $messagePostId ] );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
}
}
@@ -358,8 +358,7 @@ class Wpforo extends Software
$this->_postContent[ $messagePostId ] = str_replace( $matches[0][ $key ], '[attachment=' . $attachId . ':name]', $this->_postContent[ $messagePostId ] );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
}
}
@@ -378,7 +377,7 @@ class Wpforo extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'groupid' );
@@ -420,14 +419,14 @@ class Wpforo extends Software
/**
* @brief Hardcoded wpForo profile fields
*/
protected $_profileFields = [ 'site', 'icq', 'aim', 'yahoo', 'msn', 'facebook', 'twitter', 'gtalk', 'skype', 'about', 'occupation', 'location' ];
protected array $_profileFields = [ 'site', 'icq', 'aim', 'yahoo', 'msn', 'facebook', 'twitter', 'gtalk', 'skype', 'about', 'occupation', 'location' ];
/**
* Convert members
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'users.ID' );
@@ -438,7 +437,7 @@ class Wpforo extends Software
{
$joined = ( new DateTime( $user['user_registered'] ) )->getTimestamp();
}
catch( \ValueError $e )
catch( ValueError $e )
{
$joined = time();
}
@@ -523,7 +522,7 @@ class Wpforo extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'folderid' );
@@ -593,7 +592,7 @@ class Wpforo extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'pmid' );
@@ -615,9 +614,9 @@ class Wpforo 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
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -652,7 +651,7 @@ class Wpforo extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
return Wordpress::login( $member, $password );
}
@@ -660,9 +659,9 @@ class Wpforo extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
$wpForoSlug = defined('WPFORO_SLUG') ? WPFOROSLUG : 'community';
@@ -21,7 +21,7 @@ use IPS\Application\Module;
use IPS\Content\Search\Index;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\convert\Tools\Xenforo;
use IPS\convert\Tools\Xenforo as XenforoTrait;
use IPS\Data\Cache;
use IPS\Data\Store;
use IPS\Db;
@@ -58,22 +58,22 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class Xenforo extends Software
{
use Xenforo;
use XenforoTrait;
/**
* @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.1 changed serialized data to json decoded
*/
public static $useJson = FALSE;
public static bool $useJson = FALSE;
/**
* @brief XF1&2 have different pseudo fields
*/
public static $pseudoFields = array(
public static array $pseudoFields = array(
1 => array( 'homepage', 'location', 'occupation', 'about', 'custom_title' ),
2 => array( 'website', 'location', 'about', 'custom_title' )
);
@@ -86,9 +86,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 )
{
@@ -117,16 +117,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
{
return "XenForo (1.5.x/2.0.x/2.1.x/2.2.x)";
}
@@ -134,9 +132,9 @@ class Xenforo extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
return 'xenforo';
}
@@ -144,9 +142,9 @@ class Xenforo extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_xf_preconvert';
}
@@ -154,9 +152,9 @@ class Xenforo extends Software
/**
* Uses Prefix
*
* @return bool
* @return bool
*/
public static function usesPrefix()
public static function usesPrefix(): bool
{
return FALSE;
}
@@ -164,9 +162,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(
'convertEmoticons' => array(
@@ -226,13 +224,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 )
{
@@ -246,7 +244,7 @@ class Xenforo extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
/* XF2 */
case 'xf_change_log':
try
@@ -257,20 +255,18 @@ class Xenforo extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -278,9 +274,9 @@ class Xenforo extends Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return TRUE;
}
@@ -288,9 +284,9 @@ class Xenforo extends Software
/**
* List of Conversion Methods that require more information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
$return = array(
'convertAttachments',
@@ -312,10 +308,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();
@@ -487,9 +483,9 @@ class Xenforo extends Software
/**
* Settings Map
*
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array(
'boardTitle' => 'board_name',
@@ -499,9 +495,9 @@ class Xenforo extends Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
$settings = array();
foreach( $this->settingsMap() AS $theirs => $ours )
@@ -532,9 +528,9 @@ class Xenforo extends Software
/**
* Finish
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -567,9 +563,9 @@ class Xenforo extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -664,7 +660,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
@@ -731,8 +727,7 @@ class Xenforo extends Software
Db::i()->update( 'core_message_posts', array( 'msg_post' => $post ), array( "msg_id=?", $messagePostId ) );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
$libraryClass->setLastKeyValue( $row['attachment_id'] );
}
@@ -743,7 +738,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -790,7 +785,7 @@ class Xenforo extends Software
$fileurl = explode( '/', $row['image_url'] );
$filename = array_pop( $fileurl );
if( static::$isLegacy == FALSE AND !empty( $row['image_url_2x'] ) )
if( !static::$isLegacy AND !empty( $row['image_url_2x'] ) )
{
$filedata = file_get_contents( $row['image_url_2x'] );
$fileurlx2 = explode( '/', $row['image_url_2x'] );
@@ -803,7 +798,7 @@ class Xenforo extends Software
$filename = array_pop( $fileurl );
$filepath = rtrim( $this->app->_session['more_info']['convertEmoticons']['emoticon_path'], '/' ) . '/' . implode( '/', $fileurl );
if( static::$isLegacy == FALSE AND !empty( $row['image_url_2x'] ) )
if( !static::$isLegacy AND !empty( $row['image_url_2x'] ) )
{
$fileurlx2 = explode( '/', $row['image_url_2x'] );
$filenamex2 = array_pop( $fileurlx2 );
@@ -861,7 +856,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -895,7 +890,7 @@ class Xenforo extends Software
* @param string $type XF Field Type
* @return string IPS Field Type
*/
protected function _fieldMap( $type )
protected function _fieldMap( string $type ) : string
{
switch( $type )
{
@@ -903,19 +898,15 @@ class Xenforo extends Software
case 'radio':
case 'checkbox':
return ucwords( $type );
break;
case 'textarea':
return 'TextArea';
break;
case 'multiselect':
return 'Select';
break;
default:
return 'Text';
break;
}
}
@@ -924,7 +915,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -958,10 +949,6 @@ class Xenforo extends Software
$info['g_view_board'] = ($perm['permission_value'] == 'allow') ? 1 : 0;
break;
case 'deleteOwnPost' :
$info['g_delete_own_posts'] = ($perm['permission_value'] == 'allow') ? 1 : 0;
break;
case 'editOwnPost':
$info['g_edit_posts'] = ($perm['permission_value'] == 'allow') ? 1 : 0;
break;
@@ -975,6 +962,7 @@ class Xenforo extends Software
break;
case 'deleteOwnThread':
case 'deleteOwnPost' :
$info['g_delete_own_posts'] = ($perm['permission_value'] == 'allow') ? 1 : 0;
break;
@@ -1010,7 +998,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertWarnReasons()
public function convertWarnReasons() : void
{
$libraryClass = $this->getLibrary();
@@ -1053,14 +1041,14 @@ class Xenforo extends Software
/**
* @brief Member history type map
*/
protected static $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'user_group_id' => 'group', 'secondary_group_ids' => 'group' );
protected static array $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'user_group_id' => 'group', 'secondary_group_ids' => 'group' );
/**
* Convert member history
*
* @return void
*/
public function convertMemberHistory()
public function convertMemberHistory() : void
{
$libraryClass = $this->getLibrary();
@@ -1108,7 +1096,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -1381,11 +1369,11 @@ class Xenforo extends Software
* @param array $settings Settings to convert
* @return void
*/
public function convertSettings( $settings=array() )
public function convertSettings( array $settings=array() ) : void
{
foreach( $this->settingsMap() AS $theirs => $ours )
{
if ( !isset( $values[ $ours ] ) OR $values[ $ours ] == FALSE )
if ( !isset( $settings[ $ours ] ) OR !$settings[$ours] )
{
continue;
}
@@ -1408,7 +1396,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -1427,7 +1415,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertReactions()
public function convertReactions() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'reaction_id' );
@@ -1510,7 +1498,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -1566,7 +1554,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -1602,10 +1590,10 @@ class Xenforo extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
* @todo The proxy.php redirection is not validating the hash that XenForo set previously, derived from the globalSalt and the option imageLinkProxyKey. We need to either validate the hash (there is an open proxy concern), or we need to convert all calls to proxy.php in posted content to prevent broken images in posts.
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -1646,7 +1634,7 @@ class Xenforo extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$password = html_entity_decode( $password );
@@ -45,12 +45,12 @@ class Invisioncommunity extends Software
/**
* @brief Whether the versions of IPS4 match
*/
public static $versionMatch = FALSE;
public static bool $versionMatch = FALSE;
/**
* @brief Whether the database has been required
*/
public static $dbNeeded = FALSE;
public static bool $dbNeeded = FALSE;
/**
* Constructor
@@ -60,12 +60,12 @@ class Invisioncommunity extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB = TRUE )
public function __construct( App $app, bool $needDB = TRUE )
{
/* Set filename obscuring flag */
Library::$obscureFilenames = FALSE;
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if ( $needDB )
{
@@ -86,8 +86,6 @@ class Invisioncommunity extends Software
/* Get parent sauce */
$this->parent = $this->app->_parent->getSource();
}
return $return;
}
/**
@@ -95,7 +93,7 @@ class Invisioncommunity extends Software
*
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return 'Invision Community (' . Application::load( 'core' )->version . ')';
@@ -106,7 +104,7 @@ class Invisioncommunity extends Software
*
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "invisioncommunity";
@@ -115,9 +113,9 @@ class Invisioncommunity extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
if ( !static::$versionMatch and static::$dbNeeded )
{
@@ -157,7 +155,7 @@ class Invisioncommunity extends Software
*
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -165,9 +163,9 @@ class Invisioncommunity extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'invisioncommunity' ) );
}
@@ -177,7 +175,7 @@ class Invisioncommunity extends Software
*
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertAttachments',
@@ -188,9 +186,9 @@ class Invisioncommunity extends Software
/**
* Finish
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\downloads\File', 'count' => 0 ), 4, array( 'class' ) );
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\downloads\Category', 'count' => 0 ), 5, array( 'class' ) );
@@ -206,7 +204,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'attach_id' );
@@ -247,9 +245,9 @@ class Invisioncommunity extends Software
* Get More Information
*
* @param string $method Method name
* @return array
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -262,7 +260,7 @@ class Invisioncommunity extends Software
$return[ $method ] = array(
'upload_path' => array(
'field_class' => 'IPS\\Helpers\\Form\\Text',
'field_default' => isset( $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ) ? $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] : NULL,
'field_default' => $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ?? NULL,
'field_required' => TRUE,
'field_extra' => array(),
'field_hint' => Member::loggedIn()->language()->addToStack( 'convert_invision_upload_path' ),
@@ -285,7 +283,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertDownloadsCategories()
public function convertDownloadsCategories() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'cid' );
@@ -325,7 +323,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertDownloadsCfields()
public function convertDownloadsCfields() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'cf_id' );
@@ -349,7 +347,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertDownloadsComments()
public function convertDownloadsComments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'comment_id' );
@@ -382,7 +380,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertDownloadsFiles()
public function convertDownloadsFiles() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'file_id' );
@@ -445,7 +443,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertDownloadsReviews()
public function convertDownloadsReviews() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'comment_id' );
@@ -476,9 +474,9 @@ class Invisioncommunity extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -19,7 +19,7 @@ use InvalidArgumentException;
use IPS\Content;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\convert\Tools\Xenforo;
use IPS\convert\Tools\Xenforo as XenforoTrait;
use IPS\Db;
use IPS\Http\Url;
use IPS\Member;
@@ -44,22 +44,22 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class Xenforo extends Software
{
use Xenforo;
use XenforoTrait;
/**
* @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 = '';
public static string $tablePrefix = '';
/**
* @brief XF2.1 changed serialized data to json decoded
*/
public static $useJson = FALSE;
public static bool $useJson = FALSE;
/**
* Constructor
@@ -69,9 +69,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 )
{
@@ -101,16 +101,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 Resource Manager (1.5.x/2.0.x/2.1.x/2.2.x)";
@@ -119,9 +117,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";
@@ -130,9 +128,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(
'convertDownloadsCfields' => array(
@@ -157,13 +155,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 )
{
@@ -177,21 +175,21 @@ class Xenforo extends Software
{
return $this->db->select( 'COUNT(*)', 'xf_rm_resource_field' )->first();
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
return 0;
}
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -199,9 +197,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' ) );
}
@@ -209,9 +207,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(
'convertDownloadsFiles',
@@ -222,9 +220,9 @@ class Xenforo extends Software
/**
* Finish
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\downloads\File', 'count' => 0 ), 4, array( 'class' ) );
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\downloads\Category', 'count' => 0 ), 5, array( 'class' ) );
@@ -237,10 +235,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 )
@@ -276,7 +274,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
{
@@ -294,7 +292,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertDownloadsCfields()
public function convertDownloadsCfields() : void
{
$libraryClass = $this->getLibrary();
@@ -303,7 +301,7 @@ class Xenforo extends Software
$inputFormat = '';
if( $row['match_type'] == 'regex' AND static::$isLegacy === FALSE )
{
$inputFormat = ( $row['match_type'] == 'regex' ) ? '/' . $row['match_regex'] .'/i' : '';
$inputFormat = '/' . $row['match_regex'] .'/i';
}
elseif( $row['match_type'] == 'regex' )
{
@@ -331,9 +329,9 @@ class Xenforo extends Software
*
* @param string $type Custom field type
* @param string $match Match type
* @return void
* @return string
*/
protected function _mapFieldType( $type, $match )
protected function _mapFieldType( string $type, string $match ) : string
{
switch( $type )
{
@@ -343,39 +341,32 @@ class Xenforo extends Software
{
case 'email':
return 'Email';
break;
case 'url':
return 'Url';
break;
case 'number':
return 'Number';
break;
default:
return 'Text';
break;
}
break;
case 'textarea':
return 'TextArea';
break;
case 'bbcode':
return 'Editor';
break;
case 'multiselect':
case 'select':
return 'Select';
break;
case 'checkbox':
return 'CheckboxSet';
break;
}
return '';
}
/**
@@ -383,7 +374,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertDownloadsCategories()
public function convertDownloadsCategories() : void
{
$libraryClass = $this->getLibrary();
@@ -413,8 +404,8 @@ class Xenforo extends Software
$info = array(
'cid' => $row['resource_category_id'],
'cparent' => $row['parent_category_id'],
'cname' => isset( $row['category_title'] ) ? $row['category_title'] : $row['title'],
'cdesc' => isset( $row['category_description'] ) ? $row['category_description'] : $row['description'],
'cname' => $row['category_title'] ?? $row['title'],
'cdesc' => $row['category_description'] ?? $row['description'],
'copen' => ( $row['allow_local'] OR $row['allow_external'] ) ? 1 : 0,
'cposition' => $row['display_order'],
'ccfields' => $ccfields,
@@ -452,7 +443,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertDownloadsFiles()
public function convertDownloadsFiles() : void
{
$libraryClass = $this->getLibrary();
@@ -614,7 +605,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertDownloadsReviews()
public function convertDownloadsReviews() : void
{
$libraryClass = $this->getLibrary();
@@ -673,9 +664,9 @@ class Xenforo extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -33,9 +33,9 @@ class Bbpress extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "bbPress (for WordPress)";
@@ -44,9 +44,9 @@ class Bbpress extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "bbpress";
@@ -55,9 +55,9 @@ class Bbpress 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(
'convertForumsForums' => array(
@@ -78,9 +78,9 @@ class Bbpress extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -88,9 +88,9 @@ class Bbpress extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'wordpress' ) );
}
@@ -98,9 +98,9 @@ class Bbpress 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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -44,9 +44,9 @@ class Expressionengine extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "ExpressionEngine";
@@ -55,9 +55,9 @@ class Expressionengine extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "expressionengine";
@@ -66,9 +66,9 @@ class Expressionengine 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(
'convertForumsForums' => array(
@@ -98,9 +98,9 @@ class Expressionengine extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$rows['convertOtherPosts'] = array(
@@ -120,9 +120,9 @@ class Expressionengine extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -130,9 +130,9 @@ class Expressionengine extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'expressionengine' ) );
}
@@ -140,9 +140,9 @@ class Expressionengine 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(
'convertAttachments'
@@ -152,10 +152,10 @@ class Expressionengine 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 )
@@ -180,9 +180,9 @@ class Expressionengine 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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -473,9 +473,9 @@ class Expressionengine extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -94,9 +94,9 @@ class Invisioncommunity extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return 'Invision Community (' . Application::load( 'core' )->version . ')';
@@ -105,9 +105,9 @@ class Invisioncommunity extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "invisioncommunity";
@@ -116,9 +116,9 @@ class Invisioncommunity extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
if( !static::$versionMatch AND static::$dbNeeded )
{
@@ -168,13 +168,13 @@ class Invisioncommunity 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 )
{
@@ -198,9 +198,9 @@ class Invisioncommunity extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -208,9 +208,9 @@ class Invisioncommunity 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(
'convertAttachments'
@@ -220,10 +220,10 @@ class Invisioncommunity extends Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -251,9 +251,9 @@ class Invisioncommunity extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'invisioncommunity' ) );
}
@@ -261,9 +261,9 @@ class Invisioncommunity 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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -569,9 +569,9 @@ class Invisioncommunity extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -44,9 +44,9 @@ class Mybb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "MyBB 1.8.x";
@@ -55,9 +55,9 @@ class Mybb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "mybb";
@@ -66,9 +66,9 @@ class Mybb 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(
'convertForumsForums' => array(
@@ -93,9 +93,9 @@ class Mybb extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -103,9 +103,9 @@ class Mybb extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'mybb' ) );
}
@@ -113,9 +113,9 @@ class Mybb 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(
'convertAttachments',
@@ -126,10 +126,10 @@ class Mybb 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();
@@ -185,9 +185,9 @@ class Mybb 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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -639,9 +639,9 @@ class Mybb extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -44,9 +44,9 @@ class Phpbb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "phpBB (3.1.x/3.2.x/3.3.x)";
@@ -55,9 +55,9 @@ class Phpbb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "phpbb";
@@ -66,9 +66,9 @@ class Phpbb 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(
'convertForumsForums' => array(
@@ -93,9 +93,9 @@ class Phpbb 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(
'convertForumsForums',
@@ -106,10 +106,10 @@ class Phpbb 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();
@@ -155,9 +155,9 @@ class Phpbb extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -165,9 +165,9 @@ class Phpbb extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'phpbb' ) );
}
@@ -175,9 +175,9 @@ class Phpbb 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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -576,9 +576,9 @@ class Phpbb extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -37,9 +37,9 @@ class Phpmyforum extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "PhpMyForum";
@@ -48,9 +48,9 @@ class Phpmyforum extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "phpmyforum";
@@ -59,9 +59,9 @@ class Phpmyforum extends Software
/**
* Content we can convert from this software.
*
* @return NULL
* @return array|NULL
*/
public static function canConvert()
public static function canConvert(): ?array
{
return NULL;
}
@@ -69,9 +69,9 @@ class Phpmyforum extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -40,9 +40,9 @@ class Punbb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "PunBB (1.x)";
@@ -51,9 +51,9 @@ class Punbb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "punbb";
@@ -62,9 +62,9 @@ class Punbb 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(
'convertForumsForums' => array(
@@ -85,9 +85,9 @@ class Punbb extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -95,9 +95,9 @@ class Punbb extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'punbb' ) );
}
@@ -105,9 +105,9 @@ class Punbb 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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -310,9 +310,9 @@ class Punbb extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -47,9 +47,9 @@ class Smf extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Simple Machines Forum (2.0.x)";
@@ -58,9 +58,9 @@ class Smf extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "smf";
@@ -69,9 +69,9 @@ class Smf 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(
'convertForumsBoards' => array(
@@ -101,9 +101,9 @@ class Smf extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$rows['convertForumsBoards'] = array(
@@ -122,13 +122,13 @@ class Smf 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 )
{
@@ -152,9 +152,9 @@ class Smf extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -162,9 +162,9 @@ class Smf extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'smf' ) );
}
@@ -172,9 +172,9 @@ class Smf 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(
'convertAttachments'
@@ -184,10 +184,10 @@ class Smf 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();
@@ -213,9 +213,9 @@ class Smf 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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -607,9 +607,9 @@ class Smf extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* Support SMF friendly URLs ( index.php/topic,1000.0.html ) */
$url = Request::i()->url();
@@ -44,9 +44,9 @@ class UBBthreads extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "UBBthreads";
@@ -55,9 +55,9 @@ class UBBthreads extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "ubbthreads";
@@ -66,9 +66,9 @@ class UBBthreads 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(
'convertForumsForums' => array(
@@ -107,9 +107,9 @@ class UBBthreads extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$count = $this->countRows( static::canConvert()['convertForumsTopicsRatings']['table'], static::canConvert()['convertForumsTopicsRatings']['where'] );
@@ -148,13 +148,13 @@ class UBBthreads 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 )
{
@@ -168,9 +168,9 @@ class UBBthreads extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -178,9 +178,9 @@ class UBBthreads extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'ubbthreads' ) );
}
@@ -188,9 +188,9 @@ class UBBthreads 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(
'convertAttachments'
@@ -200,10 +200,10 @@ class UBBthreads 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();
@@ -228,9 +228,9 @@ class UBBthreads 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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -541,9 +541,9 @@ class UBBthreads extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -68,9 +68,9 @@ class Vanilla extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Vanilla (3.x)";
@@ -79,9 +79,9 @@ class Vanilla extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vanilla";
@@ -90,9 +90,9 @@ class Vanilla extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -100,9 +100,9 @@ class Vanilla extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'vanilla' ) );
}
@@ -110,9 +110,9 @@ class Vanilla 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(
'convertForumsForums' => array(
@@ -142,9 +142,9 @@ class Vanilla extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$rows['convertForumsPosts2'] = array(
@@ -164,13 +164,13 @@ class Vanilla 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 )
{
@@ -197,9 +197,9 @@ class Vanilla extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -207,9 +207,9 @@ class Vanilla 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(
'convertForumsForums',
@@ -221,10 +221,10 @@ class Vanilla 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();
@@ -293,9 +293,9 @@ class Vanilla 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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -699,10 +699,10 @@ class Vanilla extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
* @note Forums and profiles don't use an ID in the URL. While we may be able to somehow cross reference this with our SEO slug, it wouldn't be reliable.
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -59,7 +59,7 @@ class Vbulletin extends Software
/**
* @brief Flag to indicate the post data has been fixed during conversion, and we only need to use Legacy Parser
*/
public static $contentFixed = TRUE;
public static bool $contentFixed = TRUE;
/**
* Constructor
@@ -108,9 +108,9 @@ class Vbulletin extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "vBulletin Forums (3.8.x/4.x)";
@@ -119,9 +119,9 @@ class Vbulletin extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin";
@@ -130,9 +130,9 @@ class Vbulletin 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(
'convertForumsForums' => array(
@@ -174,9 +174,9 @@ class Vbulletin extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$rows['convertForumsTopicsFollowers'] = array(
@@ -196,9 +196,9 @@ class Vbulletin extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -206,9 +206,9 @@ class Vbulletin extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'vbulletin' ) );
}
@@ -216,9 +216,9 @@ class Vbulletin 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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -253,9 +253,9 @@ class Vbulletin 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(
'convertAttachments',
@@ -266,10 +266,10 @@ class Vbulletin 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 )
@@ -1084,9 +1084,9 @@ class Vbulletin extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -48,9 +48,9 @@ class Vbulletin5 extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "vBulletin Forums (5.x)";
@@ -59,9 +59,9 @@ class Vbulletin5 extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin5";
@@ -70,9 +70,9 @@ class Vbulletin5 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(
'convertForumsForums' => array(
@@ -102,9 +102,9 @@ class Vbulletin5 extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$rows['convertAttachments2'] = array(
@@ -123,13 +123,13 @@ class Vbulletin5 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 )
{
@@ -172,9 +172,9 @@ class Vbulletin5 extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -182,9 +182,9 @@ class Vbulletin5 extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'vbulletin5' ) );
}
@@ -192,9 +192,9 @@ class Vbulletin5 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( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\forums\Topic' ), 2, array( 'class' ) );
@@ -226,9 +226,9 @@ class Vbulletin5 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(
'convertAttachments',
@@ -239,10 +239,10 @@ class Vbulletin5 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 )
@@ -1094,10 +1094,10 @@ LINK;
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
* @note Forum URLs do not have IDs in them, so we cannot redirect them reliably
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -51,7 +51,7 @@ class Woltlab extends Software
*
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "WoltLab Suite Forum";
@@ -62,7 +62,7 @@ class Woltlab extends Software
*
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "woltlab";
@@ -71,9 +71,9 @@ class Woltlab 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(
'convertForumsForums' => array(
@@ -98,9 +98,9 @@ class Woltlab extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -108,9 +108,9 @@ class Woltlab extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'woltlab' ) );
}
@@ -118,9 +118,9 @@ class Woltlab 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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -142,13 +142,13 @@ class Woltlab 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 )
{
@@ -190,9 +190,9 @@ class Woltlab 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(
'convertAttachments',
@@ -203,10 +203,10 @@ class Woltlab 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 )
@@ -499,9 +499,9 @@ class Woltlab extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -47,7 +47,7 @@ class Wpforo extends Software
*
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "wpForo (2.1.x)";
@@ -58,7 +58,7 @@ class Wpforo extends Software
*
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "wpforo";
@@ -67,9 +67,9 @@ class Wpforo extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return [
'convertForumsForums' => [
@@ -96,7 +96,7 @@ class Wpforo extends Software
*
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -104,9 +104,9 @@ class Wpforo extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'wpforo' ) );
}
@@ -116,7 +116,7 @@ class Wpforo extends Software
*
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Content Rebuilds */
Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -151,9 +151,9 @@ class Wpforo 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(
'convertForumsPosts'
@@ -163,10 +163,10 @@ class Wpforo 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 = [];
switch( $method )
@@ -491,9 +491,9 @@ class Wpforo extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
$wpForoSlug = defined('WPFORO_SLUG') ? WPFOROSLUG : 'community';
@@ -56,7 +56,7 @@ class Xenforo extends Software
/**
* @brief Flag to indicate the post data has been fixed during conversion, and we only need to use Legacy Parser
*/
public static $contentFixed = TRUE;
public static bool $contentFixed = TRUE;
/**
* @brief XF2.1 changed serialized data to json decoded
@@ -111,9 +111,9 @@ class Xenforo extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "XenForo (1.5.x/2.0.x/2.1.x/2.2.x)";
@@ -122,9 +122,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";
@@ -133,9 +133,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(
'convertForumsForums' => array(
@@ -160,9 +160,9 @@ class Xenforo extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -170,9 +170,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' ) );
}
@@ -180,9 +180,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(
'convertAttachments'
@@ -199,10 +199,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 )
@@ -255,9 +255,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( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
@@ -796,9 +796,9 @@ class Xenforo extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -37,9 +37,9 @@ class Coppermine extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Coppermine (phpBB 3.1.x/3.2.x)";
@@ -48,9 +48,9 @@ class Coppermine extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "coppermine";
@@ -59,9 +59,9 @@ class Coppermine 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(
@@ -86,9 +86,9 @@ class Coppermine extends Software
/**
* Possible Parent Conversions
*
* @return NULL|array
* @return array|NULL
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'phpbb' ) );
}
@@ -96,9 +96,9 @@ class Coppermine 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',
@@ -109,10 +109,10 @@ class Coppermine extends Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -152,9 +152,9 @@ class Coppermine 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' ) );
@@ -174,7 +174,7 @@ class Coppermine extends Software
*
* @return void
*/
public function convertGalleryCategories()
public function convertGalleryCategories() : void
{
$libraryClass = $this->getLibrary();
@@ -199,7 +199,7 @@ class Coppermine extends Software
*
* @return void
*/
public function convertGalleryAlbums()
public function convertGalleryAlbums() : void
{
$libraryClass = $this->getLibrary();
@@ -209,7 +209,7 @@ class Coppermine extends Software
{
$info = array(
'album_id' => $row['aid'],
'album_owner_id' => isset( $row['owner'] ) ? $row['owner'] : NULL,
'album_owner_id' => $row['owner'] ?? NULL,
'album_category_id' => $row['category'],
'album_description' => $row['description'],
'album_position' => $row['pos'],
@@ -243,7 +243,7 @@ class Coppermine extends Software
*
* @return void
*/
public function convertGalleryImages()
public function convertGalleryImages() : void
{
$libraryClass = $this->getLibrary();
@@ -303,7 +303,7 @@ class Coppermine extends Software
*
* @return void
*/
public function convertGalleryComments()
public function convertGalleryComments() : void
{
$libraryClass = $this->getLibrary();
@@ -45,12 +45,12 @@ class Invisioncommunity extends Software
/**
* @brief Whether the versions of IPS4 match
*/
public static $versionMatch = FALSE;
public static bool $versionMatch = FALSE;
/**
* @brief Whether the database has been required
*/
public static $dbNeeded = FALSE;
public static bool $dbNeeded = FALSE;
/**
* Constructor
@@ -60,12 +60,12 @@ class Invisioncommunity extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB = TRUE )
public function __construct( App $app, bool $needDB = TRUE )
{
/* Set filename obscuring flag */
Library::$obscureFilenames = FALSE;
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if ( $needDB )
{
@@ -86,8 +86,6 @@ class Invisioncommunity extends Software
/* Get parent sauce */
$this->parent = $this->app->_parent->getSource();
}
return $return;
}
/**
@@ -95,7 +93,7 @@ class Invisioncommunity extends Software
*
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return 'Invision Community (' . Application::load( 'core' )->version . ')';
@@ -106,7 +104,7 @@ class Invisioncommunity extends Software
*
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "invisioncommunity";
@@ -115,9 +113,9 @@ class Invisioncommunity extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
if( !static::$versionMatch AND static::$dbNeeded )
{
@@ -163,9 +161,9 @@ class Invisioncommunity extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -173,9 +171,9 @@ class Invisioncommunity extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'invisioncommunity' ) );
}
@@ -183,9 +181,9 @@ class Invisioncommunity 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(
'convertAttachments',
@@ -196,10 +194,10 @@ class Invisioncommunity extends Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -212,7 +210,7 @@ class Invisioncommunity extends Software
$return[ $method ] = array(
'upload_path' => array(
'field_class' => 'IPS\\Helpers\\Form\\Text',
'field_default' => isset( $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ) ? $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] : NULL,
'field_default' => $this->parent->app->_session['more_info']['convertEmoticons']['upload_path'] ?? NULL,
'field_required' => TRUE,
'field_extra' => array(),
'field_hint' => Member::loggedIn()->language()->addToStack('convert_invision_upload_path'),
@@ -228,9 +226,9 @@ class Invisioncommunity 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' ) );
@@ -251,7 +249,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'attach_id' );
@@ -293,7 +291,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertGalleryAlbums()
public function convertGalleryAlbums() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'album_id' );
@@ -338,7 +336,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertGalleryAlbumComments()
public function convertGalleryAlbumComments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'comment_id' );
@@ -371,7 +369,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertGalleryAlbumReviews()
public function convertGalleryAlbumReviews() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'review_id' );
@@ -404,7 +402,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertGalleryCategories()
public function convertGalleryCategories() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'category_id' );
@@ -444,7 +442,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertGalleryComments()
public function convertGalleryComments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'comment_id' );
@@ -477,7 +475,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertGalleryImages()
public function convertGalleryImages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'image_id' );
@@ -527,9 +525,9 @@ class Invisioncommunity extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -38,9 +38,9 @@ class Photoplog extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "PhotoPlog (vBulletin 3.x/4.x)";
@@ -49,9 +49,9 @@ class Photoplog extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "photoplog";
@@ -60,9 +60,9 @@ class Photoplog 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(
@@ -87,9 +87,9 @@ class Photoplog extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -97,9 +97,9 @@ class Photoplog extends Software
/**
* Possible Parent Conversions
*
* @return NULL|array
* @return array|NULL
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'vbulletin' ) );
}
@@ -107,9 +107,9 @@ class Photoplog 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',
@@ -120,9 +120,9 @@ class Photoplog 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' ) );
@@ -137,10 +137,10 @@ class Photoplog extends Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -182,7 +182,7 @@ class Photoplog extends Software
*
* @return void
*/
public function convertGalleryAlbums()
public function convertGalleryAlbums() : void
{
$libraryClass = $this->getLibrary();
@@ -215,7 +215,7 @@ class Photoplog extends Software
*
* @return void
*/
public function convertGalleryCategories()
public function convertGalleryCategories() : void
{
$libraryClass = $this->getLibrary();
@@ -240,7 +240,7 @@ class Photoplog extends Software
*
* @return void
*/
public function convertGalleryImages()
public function convertGalleryImages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'fileid' );
@@ -297,7 +297,7 @@ class Photoplog extends Software
*
* @return void
*/
public function convertGalleryComments()
public function convertGalleryComments() : void
{
$libraryClass = $this->getLibrary();
@@ -41,9 +41,9 @@ class Photopost extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Photopost (8.x)";
@@ -52,9 +52,9 @@ class Photopost extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "photopost";
@@ -63,9 +63,9 @@ class Photopost extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -73,9 +73,9 @@ class Photopost extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'photopost' ) );
}
@@ -83,9 +83,9 @@ class Photopost 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(
@@ -110,9 +110,9 @@ class Photopost 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',
@@ -123,10 +123,10 @@ class Photopost 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 )
@@ -167,9 +167,9 @@ class Photopost 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' ) );
@@ -186,7 +186,7 @@ class Photopost extends Software
*
* @return void
*/
public function convertGalleryCategories()
public function convertGalleryCategories() : void
{
$libraryClass = $this->getLibrary();
@@ -212,7 +212,7 @@ class Photopost extends Software
*
* @return void
*/
public function convertGalleryAlbums()
public function convertGalleryAlbums() : void
{
$libraryClass = $this->getLibrary();
@@ -246,13 +246,13 @@ class Photopost extends Software
*
* @return void
*/
public function convertGalleryImages()
public function convertGalleryImages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
foreach( $this->fetch( 'photos', 'id' ) AS $row )
foreach( $this->fetch( 'photos' ) AS $row )
{
$info = array(
'image_id' => $row['id'],
@@ -286,13 +286,13 @@ class Photopost extends Software
*
* @return void
*/
public function convertGalleryComments()
public function convertGalleryComments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
foreach( $this->fetch( 'comments', 'id' ) AS $row )
foreach( $this->fetch( 'comments' ) AS $row )
{
$libraryClass->convertGalleryComment( array(
'comment_id' => $row['id'],
@@ -312,9 +312,9 @@ class Photopost extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -323,7 +323,7 @@ class Photopost extends Software
if( !$id = Request::i()->cat )
{
preg_match( '#cat/([0-9]+)#', $url->data[ Url::COMPONENT_PATH ], $matches );
$id = isset( $matches[1] ) ? $matches[1] : NULL;
$id = $matches[1] ?? NULL;
}
try
@@ -347,7 +347,7 @@ class Photopost extends Software
if( !$id = Request::i()->photo )
{
preg_match( '#photo/([0-9]+)#', $url->data[ Url::COMPONENT_PATH ], $matches );
$id = isset( $matches[1] ) ? $matches[1] : NULL;
$id = $matches[1] ?? NULL;
}
try
@@ -17,7 +17,7 @@ use Exception;
use InvalidArgumentException;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\convert\Software\Core\Vbulletin;
use IPS\convert\Software\Core\Vbulletin as VBulletinSoftware;
use IPS\File;
use IPS\gallery\Album;
use IPS\gallery\Image;
@@ -44,12 +44,12 @@ class Vbulletin extends Software
/**
* @brief vBulletin 4 Stores all attachments under one table - this will store the content type for the forums app.
*/
protected static $imageContentType = NULL;
protected static mixed $imageContentType = NULL;
/**
* @brief The schematic for vB3 and vB4 is similar enough that we can make specific concessions in a sinle converter for either version.
*/
protected static $isLegacy = NULL;
protected static ?bool $isLegacy = NULL;
/**
* Constructor
@@ -59,9 +59,9 @@ class Vbulletin 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 );
/* Is this vB3 or vB4? */
if ( $needDB )
@@ -91,16 +91,14 @@ class Vbulletin extends Software
}
catch( Exception $e ) {}
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "vBulletin Gallery (3.8.x/4.x)";
@@ -109,9 +107,9 @@ class Vbulletin extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin";
@@ -120,14 +118,14 @@ class Vbulletin extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
$imageWhere = NULL;
$imageTable = 'picture';
if ( static::$isLegacy == FALSE )
if ( !static::$isLegacy )
{
$imageWhere = array( "contenttypeid=?", static::$imageContentType );
$imageTable = 'attachment';
@@ -152,9 +150,9 @@ class Vbulletin extends Software
/**
* Requires Parent
*
* @return boolean
* @return boolean
*/
public static function requiresParent()
public static function requiresParent(): bool
{
return TRUE;
}
@@ -162,9 +160,9 @@ class Vbulletin extends Software
/**
* Possible Parent Conversions
*
* @return array
* @return array|null
*/
public static function parents()
public static function parents(): ?array
{
return array( 'core' => array( 'vbulletin' ) );
}
@@ -172,9 +170,9 @@ class Vbulletin 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' ) );
@@ -194,23 +192,23 @@ class Vbulletin extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
{
return Vbulletin::fixPostData( $post, $className, $contentId );
return VBulletinSoftware::fixPostData( $post, $className, $contentId );
}
/**
* 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 )
@@ -241,9 +239,9 @@ class Vbulletin 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( 'convertGalleryImages' );
}
@@ -253,7 +251,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertGalleryAlbums()
public function convertGalleryAlbums() : void
{
$libraryClass = $this->getLibrary();
@@ -296,7 +294,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertGalleryImages()
public function convertGalleryImages() : void
{
$libraryClass = $this->getLibrary();
@@ -396,7 +394,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertGalleryComments()
public function convertGalleryComments() : void
{
$libraryClass = $this->getLibrary();
@@ -460,9 +458,9 @@ class Vbulletin extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -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();