Version 5.0.0 beta 4
This commit is contained in:
1 parent
e86153356a
commit
2f24f9de48
276 files changed
+8614
-6044
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user