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