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