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
@@ -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();
|
||||
|
||||
|
||||
Reference in new issue
Block a user