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

@@ -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( ''', "'", 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 ] ) )
{