Version 5.0.0 beta 7
This commit is contained in:
1 parent
fa2a720105
commit
54d5dcd0a0
156 files changed
+4337
-2995
No files matched your search
@@ -117,7 +117,7 @@ class Bbpress extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -141,14 +141,14 @@ class Bbpress extends Software
|
||||
/**
|
||||
* @brief User cache to minimise repeated DB lookups
|
||||
*/
|
||||
protected static $userCache = array();
|
||||
protected static array $userCache = array();
|
||||
|
||||
/**
|
||||
* Convert topics
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'ID' );
|
||||
@@ -190,7 +190,7 @@ class Bbpress extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'ID' );
|
||||
|
||||
@@ -17,7 +17,7 @@ use DomainException;
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Expressionengine;
|
||||
use IPS\convert\Software\Core\Expressionengine as ExpressionEngineCore;
|
||||
use IPS\Db;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
@@ -197,14 +197,14 @@ class Expressionengine 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 Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content 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 Expressionengine::fixPostData( $post, $className, $contentId );
|
||||
return ExpressionEngineCore::fixPostData( $post, $className, $contentId );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,7 +212,7 @@ class Expressionengine extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -248,7 +248,7 @@ class Expressionengine extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -352,7 +352,7 @@ class Expressionengine extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -394,7 +394,7 @@ class Expressionengine extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertOtherPosts()
|
||||
public function convertOtherPosts() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -436,7 +436,7 @@ class Expressionengine extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
public function convertAttachments() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ use IPS\convert\App;
|
||||
use IPS\convert\Library;
|
||||
use IPS\convert\Software;
|
||||
use IPS\Db;
|
||||
use IPS\Db\Exception as DbException;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Node\Model;
|
||||
@@ -46,12 +47,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
|
||||
@@ -61,12 +62,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 )
|
||||
{
|
||||
@@ -82,13 +83,11 @@ class Invisioncommunity extends Software
|
||||
static::$versionMatch = TRUE;
|
||||
}
|
||||
}
|
||||
catch( \IPS\Db\Exception $e ) {}
|
||||
catch( DbException $e ) {}
|
||||
|
||||
/* Get parent sauce */
|
||||
$this->parent = $this->app->_parent->getSource();
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,17 +180,15 @@ class Invisioncommunity extends Software
|
||||
case 'core_rss_imported':
|
||||
try
|
||||
{
|
||||
return $this->db->select( 'COUNT(*)', 'core_rss_imported', array( 'rss_imported_import_id IN(' . (string) $this->db->select( 'rss_import_id', 'core_rss_import', array( "rss_import_class='IPS\\forums\\Topic'" ) ) . ')' ) )->first();
|
||||
return $this->db->select( 'COUNT(*)', 'core_rss_imported', array( 'rss_imported_import_id IN(' . $this->db->select( 'rss_import_id', 'core_rss_import', array( "rss_import_class='IPS\\forums\\Topic'" ) ) . ')' ) )->first();
|
||||
}
|
||||
catch( Exception $e )
|
||||
{
|
||||
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return parent::countRows( $table, $where, $recache );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +232,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'),
|
||||
@@ -287,7 +284,7 @@ class Invisioncommunity extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsAnswerRatings()
|
||||
public function convertForumsAnswerRatings() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'id' );
|
||||
@@ -307,7 +304,7 @@ class Invisioncommunity extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'id' );
|
||||
@@ -348,7 +345,7 @@ class Invisioncommunity extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'tid' );
|
||||
@@ -402,7 +399,7 @@ class Invisioncommunity extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'pid' );
|
||||
@@ -445,7 +442,7 @@ class Invisioncommunity extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsQuestionRatings()
|
||||
public function convertForumsQuestionRatings() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'id' );
|
||||
@@ -465,7 +462,7 @@ class Invisioncommunity extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopicsMultimods()
|
||||
public function convertForumsTopicsMultimods() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'mm_id' );
|
||||
@@ -488,7 +485,7 @@ class Invisioncommunity extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsRssImports()
|
||||
public function convertForumsRssImports() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'rss_import_id' );
|
||||
@@ -511,11 +508,11 @@ class Invisioncommunity extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsRssImported()
|
||||
public function convertForumsRssImported() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
foreach( $this->fetch( 'core_rss_imported', 'rss_imported_content_id', array( 'rss_imported_id IN(' . (string) Db::i()->select( 'rss_import_id', 'core_rss_import', array( "rss_import_class='IPS\\forums\\Topic'" ) ) . ')' ) ) AS $row )
|
||||
foreach( $this->fetch( 'core_rss_imported', 'rss_imported_content_id', array( 'rss_imported_id IN(' . Db::i()->select( 'rss_import_id', 'core_rss_import', array( "rss_import_class='IPS\\forums\\Topic'" ) ) . ')' ) ) AS $row )
|
||||
{
|
||||
/* Remove non-standard columns */
|
||||
$this->parent->unsetNonStandardColumns( $row, 'core_rss_imported', 'core' );
|
||||
@@ -529,7 +526,7 @@ class Invisioncommunity extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
public function convertAttachments() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'attach_id' );
|
||||
|
||||
@@ -17,7 +17,7 @@ use DomainException;
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Mybb;
|
||||
use IPS\convert\Software\Core\Mybb as MybbCore;
|
||||
use IPS\Db;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
@@ -209,14 +209,14 @@ class Mybb 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 Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content 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 Mybb::fixPostData( $post, $className, $contentId );
|
||||
return MybbCore::fixPostData( $post, $className, $contentId );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,7 +224,7 @@ class Mybb extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -283,7 +283,7 @@ class Mybb extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -380,10 +380,7 @@ class Mybb extends Software
|
||||
$this->db->select( 'fid', 'threads', array( "tid=?", $moved[1] ) )->first()
|
||||
);
|
||||
}
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
$moved_to = NULL;
|
||||
}
|
||||
catch( UnderflowException $e ){}
|
||||
}
|
||||
|
||||
$info = array(
|
||||
@@ -473,7 +470,7 @@ class Mybb extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -512,7 +509,7 @@ class Mybb extends Software
|
||||
'author_name' => $row['username'],
|
||||
'ip_address' => $row['ipaddress'],
|
||||
'post_date' => $row['dateline'],
|
||||
'queued' => $queued,
|
||||
'queued' => $queued ?? 0,
|
||||
'post_edit_reason' => $row['editreason'],
|
||||
);
|
||||
|
||||
@@ -574,7 +571,7 @@ class Mybb extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
public function convertAttachments(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -629,9 +626,8 @@ class Mybb extends Software
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( UnderflowException $e ) {}
|
||||
catch( OutOfRangeException $e ) {}
|
||||
|
||||
catch( UnderflowException|OutOfRangeException $e ) {}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['aid'] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ use DomainException;
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Phpbb;
|
||||
use IPS\convert\Software\Core\Phpbb as PhpbbCore;
|
||||
use IPS\Db;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
@@ -192,14 +192,14 @@ class Phpbb 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 Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content 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 Phpbb::fixPostData( $post, $className, $contentId );
|
||||
return PhpbbCore::fixPostData( $post, $className, $contentId );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,7 +207,7 @@ class Phpbb extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -219,8 +219,8 @@ class Phpbb extends Software
|
||||
'id' => $row['forum_id'],
|
||||
'name' => $row['forum_name'],
|
||||
'description' => $row['forum_desc'],
|
||||
'topics' => isset( $row['forum_topics_approved'] ) ? $row['forum_topics_approved'] : $row['forum_topics'],
|
||||
'posts' => isset( $row['forum_posts_approved'] ) ? $row['forum_posts_approved'] : $row['forum_posts'],
|
||||
'topics' => $row['forum_topics_approved'] ?? $row['forum_topics'],
|
||||
'posts' => $row['forum_posts_approved'] ?? $row['forum_posts'],
|
||||
'last_post' => $row['forum_last_post_time'],
|
||||
'last_poster_id' => $row['forum_last_poster_id'],
|
||||
'last_poster_name' => $row['forum_last_poster_name'],
|
||||
@@ -229,9 +229,9 @@ class Phpbb extends Software
|
||||
'position' => $row['left_id'],
|
||||
'password' => ( isset( $this->app->_session['more_info']['convertForumsForums']["forum_password_{$row['forum_id']}"] ) ) ? $this->app->_session['more_info']['convertForumsForums']["forum_password_{$row['forum_id']}"] : NULL,
|
||||
'last_title' => $row['forum_last_post_subject'],
|
||||
'queued_topics' => isset( $row['forum_topics_unapproved'] ) ? $row['forum_topics_unapproved'] : 0,
|
||||
'queued_topics' => $row['forum_topics_unapproved'] ?? 0,
|
||||
'queued_posts' => isset( $row['forum_posts_unapproved'] ) ? $row['forum_topics_unapproved'] : 0,
|
||||
'sub_can_post' => ( $row['forum_type'] == 1 ) ? TRUE : FALSE
|
||||
'sub_can_post' => $row['forum_type'] == 1
|
||||
);
|
||||
|
||||
$libraryClass->convertForumsForum( $info );
|
||||
@@ -264,7 +264,7 @@ class Phpbb extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -327,15 +327,8 @@ class Phpbb extends Software
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $row['topic_visibility'] ) )
|
||||
{
|
||||
$visibility = $row['topic_visibility'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$visibility = $row['topic_approved'];
|
||||
}
|
||||
|
||||
$visibility = $row['topic_visibility'] ?? $row['topic_approved'];
|
||||
|
||||
/* Global Topics */
|
||||
if ( !$row['forum_id'] )
|
||||
@@ -361,7 +354,7 @@ class Phpbb extends Software
|
||||
'title' => $row['topic_title'],
|
||||
'forum_id' => $row['forum_id'],
|
||||
'state' => ( $row['topic_status'] == 0 ) ? 'open' : 'closed',
|
||||
'posts' => isset( $row['topic_posts_approved'] ) ? $row['topic_posts_approved'] : $row['topic_replies'],
|
||||
'posts' => $row['topic_posts_approved'] ?? $row['topic_replies'],
|
||||
'starter_id' => $row['topic_poster'],
|
||||
'start_date' => $row['topic_time'],
|
||||
'last_poster_id' => $row['topic_last_poster_id'],
|
||||
@@ -406,7 +399,7 @@ class Phpbb extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -414,14 +407,7 @@ class Phpbb extends Software
|
||||
|
||||
foreach( $this->fetch( 'posts', 'post_id' ) AS $row )
|
||||
{
|
||||
if ( isset( $row['post_visibility'] ) )
|
||||
{
|
||||
$visibility = $row['post_visibility'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$visibility = $row['post_approved'];
|
||||
}
|
||||
$visibility = $row['post_visibility'] ?? $row['post_approved'];
|
||||
|
||||
$editName = null;
|
||||
if( $row['post_edit_time'] AND $row['post_edit_user'] )
|
||||
@@ -436,7 +422,7 @@ class Phpbb extends Software
|
||||
$info = array(
|
||||
'pid' => $row['post_id'],
|
||||
'topic_id' => $row['topic_id'],
|
||||
'post' => Phpbb::stripUid( $row['post_text'], $row['bbcode_uid'] ),
|
||||
'post' => PhpbbCore::stripUid( $row['post_text'], $row['bbcode_uid'] ),
|
||||
'append_edit' => ( $row['post_edit_user'] ) ? 1 : 0,
|
||||
'edit_time' => $row['post_edit_time'],
|
||||
'edit_name' => $editName,
|
||||
@@ -445,7 +431,7 @@ class Phpbb extends Software
|
||||
'ip_address' => $row['poster_ip'],
|
||||
'post_date' => $row['post_time'],
|
||||
'queued' => ( $visibility == 1 ) ? 0 : -1,
|
||||
'pdelete_time' => isset( $row['post_delete_time'] ) ? $row['post_delete_time'] : NULL,
|
||||
'pdelete_time' => $row['post_delete_time'] ?? NULL,
|
||||
);
|
||||
|
||||
$libraryClass->convertForumsPost( $info );
|
||||
@@ -470,7 +456,7 @@ class Phpbb extends Software
|
||||
'wl_moderator' => $log['user_id'],
|
||||
'wl_date' => $warning['warning_time'],
|
||||
'wl_points' => 1,
|
||||
'wl_note_member' => isset( $data[0] ) ? $data[0] : NULL,
|
||||
'wl_note_member' => $data[0] ?? NULL,
|
||||
) );
|
||||
|
||||
/* Add a member history record for this member */
|
||||
@@ -492,14 +478,14 @@ class Phpbb extends Software
|
||||
/**
|
||||
* @brief temporarily store post content
|
||||
*/
|
||||
protected $_postContent = array();
|
||||
protected array $_postContent = array();
|
||||
|
||||
/**
|
||||
* Convert attachments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
public function convertAttachments(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -559,8 +545,7 @@ class Phpbb extends Software
|
||||
$this->_postContent[ $pid ] .= '<br>' . $replacement;
|
||||
}
|
||||
}
|
||||
catch( UnderflowException $e ) {}
|
||||
catch( OutOfRangeException $e ) {}
|
||||
catch( UnderflowException|OutOfRangeException $e ) {}
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['attach_id'] );
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace IPS\convert\Software\Forums;
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Punbb;
|
||||
use IPS\convert\Software\Core\Punbb as PunbbCore;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Node\Model;
|
||||
use IPS\Request;
|
||||
@@ -122,14 +122,14 @@ class Punbb 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 Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content 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 Punbb::fixPostData( $post, $className, $contentId );
|
||||
return PunbbCore::fixPostData( $post, $className, $contentId );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +137,7 @@ class Punbb extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -200,7 +200,7 @@ class Punbb extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -280,7 +280,7 @@ class Punbb extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ use DomainException;
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Smf;
|
||||
use IPS\convert\Software\Core\Smf as SmfCore;
|
||||
use IPS\Db;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
@@ -141,11 +141,9 @@ class Smf 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,14 +228,14 @@ class Smf 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 Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content 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 Smf::fixPostData( $post, $className, $contentId );
|
||||
return SmfCore::fixPostData( $post, $className, $contentId );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,7 +243,7 @@ class Smf extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -266,7 +264,7 @@ class Smf extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsBoards()
|
||||
public function convertForumsBoards(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -319,7 +317,7 @@ class Smf extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -437,7 +435,7 @@ class Smf extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -466,14 +464,14 @@ class Smf extends Software
|
||||
/**
|
||||
* @brief Cached attachment paths
|
||||
*/
|
||||
protected static $paths = NULL;
|
||||
protected static ?array $paths = NULL;
|
||||
|
||||
/**
|
||||
* Convert attachments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
public function convertAttachments(): void
|
||||
{
|
||||
if ( is_null( static::$paths ) )
|
||||
{
|
||||
|
||||
@@ -15,7 +15,8 @@ namespace IPS\convert\Software\Forums;
|
||||
|
||||
use Exception;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\UBBthreads;
|
||||
use IPS\convert\Software\Core\UBBthreads as UBBthreadsCore;
|
||||
use IPS\convert\Software\Exception as SoftwareException;
|
||||
use IPS\DateTime;
|
||||
use IPS\Db;
|
||||
use IPS\forums\Forum;
|
||||
@@ -245,14 +246,14 @@ class UBBthreads 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 Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content 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 UBBthreads::fixPostData( $post, $className, $contentId );
|
||||
return UBBthreadsCore::fixPostData( $post, $className, $contentId );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,7 +261,7 @@ class UBBthreads extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -299,7 +300,7 @@ class UBBthreads extends Software
|
||||
) );
|
||||
}
|
||||
|
||||
throw new \IPS\convert\Software\Exception;
|
||||
throw new SoftwareException;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -307,7 +308,7 @@ class UBBthreads extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForumsFollowers()
|
||||
public function convertForumsForumsFollowers(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -329,7 +330,7 @@ class UBBthreads extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'TOPIC_ID' );
|
||||
@@ -429,7 +430,7 @@ class UBBthreads extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopicsRatings()
|
||||
public function convertForumsTopicsRatings(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -450,7 +451,7 @@ class UBBthreads extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopicsFollowers()
|
||||
public function convertForumsTopicsFollowers(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -472,7 +473,7 @@ class UBBthreads extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'POST_ID' );
|
||||
@@ -503,7 +504,7 @@ class UBBthreads extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
public function convertAttachments(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'FILE_ID' );
|
||||
|
||||
@@ -43,7 +43,7 @@ class Vanilla extends Software
|
||||
/**
|
||||
* @brief Store the result of the check for reaction support
|
||||
*/
|
||||
protected static $_supportsReactions = FALSE;
|
||||
protected static bool $_supportsReactions = FALSE;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -53,17 +53,15 @@ class Vanilla 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 );
|
||||
|
||||
/* Check for reaction support - This is a Vanilla2 addon, so it may not be installed */
|
||||
if ( $needDB )
|
||||
{
|
||||
static::$_supportsReactions = $this->db->checkForTable( 'Action' );
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
/**
|
||||
* Software Name
|
||||
@@ -186,11 +184,9 @@ class Vanilla 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,9 +313,9 @@ class Vanilla 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 Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content ID passed by post-conversion rebuild
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
@@ -332,7 +328,7 @@ class Vanilla extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
public function convertAttachments(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -391,7 +387,7 @@ class Vanilla extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'c.CategoryID' );
|
||||
@@ -433,7 +429,7 @@ class Vanilla extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'd.DiscussionID' );
|
||||
@@ -469,12 +465,12 @@ class Vanilla extends Software
|
||||
continue;
|
||||
}
|
||||
|
||||
$row['DateLastComment'] = 0;
|
||||
$row['LastCommentUserID'] = 0;
|
||||
$row['LastCommentUserName'] = '';
|
||||
$row['DateLastComment'] = $row['DateLastComment'] ?? 0;
|
||||
$row['LastCommentUserID'] = $row['LastCommentUserID'] ?? 0;
|
||||
$row['LastCommentUserName'] = $row['LastCommentUserName'] ?? '';
|
||||
|
||||
/* If last post info is empty, fetch it */
|
||||
if( $row['DateLastComment'] === NULL )
|
||||
if( !$row['DateLastComment'] )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -542,7 +538,7 @@ class Vanilla extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'DiscussionID' );
|
||||
@@ -634,7 +630,7 @@ class Vanilla extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts2()
|
||||
public function convertForumsPosts2(): void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'CommentID' );
|
||||
|
||||
@@ -18,7 +18,7 @@ use Exception;
|
||||
use InvalidArgumentException;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Vbulletin;
|
||||
use IPS\convert\Software\Core\Vbulletin as VbulletinCore;
|
||||
use IPS\Db;
|
||||
use IPS\forums\Forum;
|
||||
use IPS\forums\Topic;
|
||||
@@ -49,12 +49,12 @@ 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 ?int $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
|
||||
@@ -69,9 +69,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 )
|
||||
{
|
||||
@@ -101,8 +101,6 @@ class Vbulletin extends Software
|
||||
}
|
||||
catch( Exception $e ) {}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,14 +238,14 @@ 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 Content 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 Vbulletin::fixPostData( $post, $className, $contentId );
|
||||
return VbulletinCore::fixPostData( $post, $className, $contentId );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -340,7 +338,7 @@ class Vbulletin extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -357,7 +355,7 @@ class Vbulletin extends Software
|
||||
$key = 'options';
|
||||
}
|
||||
|
||||
if ( $forum[$key] & $self::$bitOptions[$name][$perm] )
|
||||
if ( $forum[$key] & static::$bitOptions[$name][$perm] )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -432,7 +430,7 @@ class Vbulletin extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'threadid' );
|
||||
@@ -469,7 +467,7 @@ class Vbulletin extends Software
|
||||
$votes[$index] = $vote;
|
||||
$index++;
|
||||
|
||||
$numvotes += $vote;
|
||||
$numvotes += (int) $vote;
|
||||
}
|
||||
|
||||
$poll = array();
|
||||
@@ -552,7 +550,7 @@ class Vbulletin extends Software
|
||||
'poll_state' => $poll,
|
||||
'last_vote' => $lastVote,
|
||||
'views' => $topic['views'],
|
||||
'approved' => $approved,
|
||||
'approved' => $approved ?? 1,
|
||||
'pinned' => $topic['sticky'],
|
||||
'topic_hiddenposts' => $topic['hiddencount'] + $topic['deletedcount']
|
||||
);
|
||||
@@ -627,7 +625,7 @@ class Vbulletin extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopicsFollowers()
|
||||
public function convertForumsTopicsFollowers() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'subscribethreadid' );
|
||||
@@ -677,7 +675,7 @@ class Vbulletin extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'postid' );
|
||||
@@ -819,7 +817,7 @@ class Vbulletin extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
public function convertAttachments() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -918,8 +916,7 @@ class Vbulletin extends Software
|
||||
Db::i()->update( 'forums_posts', array( 'post' => $post ), array( "pid=?", $pid ) );
|
||||
}
|
||||
}
|
||||
catch( UnderflowException $e ) {}
|
||||
catch( OutOfRangeException $e ) {}
|
||||
catch( UnderflowException|OutOfRangeException $e ) {}
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $attachment['attachmentid'] );
|
||||
@@ -931,7 +928,7 @@ class Vbulletin extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubForums()
|
||||
public function convertClubForums() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'groupid' );
|
||||
@@ -954,7 +951,7 @@ class Vbulletin extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubTopics()
|
||||
public function convertClubTopics() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'discussionid' );
|
||||
@@ -996,7 +993,7 @@ class Vbulletin extends Software
|
||||
'last_post' => $row['lastpost'],
|
||||
'starter_name' => $firstpost['postusername'],
|
||||
'last_poster_name' => $row['lastposter'],
|
||||
'approved' => $approved,
|
||||
'approved' => $approved ?? 1,
|
||||
) );
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['discussionid'] );
|
||||
@@ -1008,7 +1005,7 @@ class Vbulletin extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubPosts()
|
||||
public function convertClubPosts() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'gmid' );
|
||||
@@ -1036,7 +1033,7 @@ class Vbulletin extends Software
|
||||
'author_id' => $row['postuserid'],
|
||||
'author_name' => $row['postusername'],
|
||||
'post_date' => $row['dateline'],
|
||||
'queued' => $queued,
|
||||
'queued' => $queued ?? 0,
|
||||
) );
|
||||
$libraryClass->setLastKeyValue( $row['gmid'] );
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ use DomainException;
|
||||
use Exception;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Vbulletin5;
|
||||
use IPS\convert\Software\Core\Vbulletin5 as Vbulletin5Core;
|
||||
use IPS\Db;
|
||||
use IPS\forums\Topic;
|
||||
use IPS\forums\Topic\Post;
|
||||
@@ -135,7 +135,6 @@ class Vbulletin5 extends Software
|
||||
{
|
||||
case 'forum':
|
||||
return count( $this->fetchForums() );
|
||||
break;
|
||||
|
||||
case 'thread':
|
||||
try
|
||||
@@ -146,7 +145,6 @@ class Vbulletin5 extends Software
|
||||
{
|
||||
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'post':
|
||||
try
|
||||
@@ -157,15 +155,12 @@ class Vbulletin5 extends Software
|
||||
{
|
||||
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'attachment':
|
||||
return parent::countRows( 'node', array( "contenttypeid IN (" . $this->fetchType( 'Attach' ) . ',' . $this->fetchType( 'Photo' ) . ")" ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
return parent::countRows( $table, $where, $recache );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,14 +208,14 @@ 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 Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content 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 Vbulletin5::fixPostData( $post, $className, $contentId );
|
||||
return Vbulletin5Core::fixPostData( $post, $className, $contentId );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -297,7 +292,7 @@ class Vbulletin5 extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -325,7 +320,7 @@ class Vbulletin5 extends Software
|
||||
$key = 'nodeoptions';
|
||||
}
|
||||
|
||||
if ( $forum[$key] & $self::$bitOptions[$name][$perm] )
|
||||
if ( $forum[$key] & static::$bitOptions[$name][$perm] )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -362,7 +357,7 @@ class Vbulletin5 extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -441,8 +436,7 @@ class Vbulletin5 extends Software
|
||||
);
|
||||
}
|
||||
}
|
||||
catch( UnderflowException $e ) {} # if the poll is missing, don't bother
|
||||
catch( UnexpectedValueException $e ) {} # if poll data is corrupt, then skip
|
||||
catch( UnderflowException|UnexpectedValueException $e ) {} # if the poll is missing, don't bother # if poll data is corrupt, then skip
|
||||
|
||||
$info = array(
|
||||
'tid' => $topic['nodeid'],
|
||||
@@ -517,7 +511,7 @@ class Vbulletin5 extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -741,7 +735,7 @@ LINK;
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
public function convertAttachments() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -891,7 +885,7 @@ LINK;
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments2()
|
||||
public function convertAttachments2() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -1020,7 +1014,7 @@ LINK;
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function fetchForums()
|
||||
protected function fetchForums() : array
|
||||
{
|
||||
$forums = array();
|
||||
$clubs = $this->fetchClubs();
|
||||
@@ -1037,7 +1031,7 @@ LINK;
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function fetchClubs()
|
||||
protected function fetchClubs() : array
|
||||
{
|
||||
$clubs = array();
|
||||
|
||||
@@ -1066,29 +1060,25 @@ LINK;
|
||||
/**
|
||||
* @brief Types Cache
|
||||
*/
|
||||
protected $typesCache = array();
|
||||
protected array $typesCache = array();
|
||||
|
||||
/**
|
||||
* Helper method to retrieve content type ids
|
||||
*
|
||||
* @param int|string $type The content type
|
||||
* @return void
|
||||
* @return array
|
||||
*/
|
||||
protected function fetchType( $type )
|
||||
protected function fetchType( int|string $type ) : array
|
||||
{
|
||||
if ( count( $this->typesCache ) )
|
||||
{
|
||||
return $this->typesCache[ $type ];
|
||||
}
|
||||
else
|
||||
if ( !count( $this->typesCache ) )
|
||||
{
|
||||
foreach( $this->db->select( '*', 'contenttype' ) AS $contenttype )
|
||||
{
|
||||
$this->typesCache[ $contenttype['class'] ] = $contenttype['contenttypeid'];
|
||||
}
|
||||
|
||||
return $this->typesCache[ $type ];
|
||||
}
|
||||
|
||||
return $this->typesCache[ $type ];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ use DomainException;
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Woltlab;
|
||||
use IPS\convert\Software\Core\Woltlab as WoltlabCore;
|
||||
use IPS\Db;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
@@ -44,7 +44,7 @@ class Woltlab extends Software
|
||||
/**
|
||||
* @brief The WBB table prefix can change depending on the number of installs
|
||||
*/
|
||||
public static $installId = 1;
|
||||
public static int $installId = 1;
|
||||
|
||||
/**
|
||||
* Software Name
|
||||
@@ -166,25 +166,23 @@ class Woltlab 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content 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 Woltlab::fixPostData( $post, $className, $contentId );
|
||||
return WoltlabCore::fixPostData( $post, $className, $contentId );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -263,7 +261,7 @@ class Woltlab extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'boardID' );
|
||||
@@ -316,7 +314,7 @@ class Woltlab extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'threadID' );
|
||||
@@ -388,7 +386,7 @@ class Woltlab extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'postID' );
|
||||
@@ -438,7 +436,7 @@ class Woltlab extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
public function convertAttachments() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'attachmentID' );
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace IPS\convert\Software\Forums;
|
||||
use Exception;
|
||||
use IPS\Content;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Wpforo;
|
||||
use IPS\convert\Software\Core\Wpforo as WpforoCore;
|
||||
use IPS\Db;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
@@ -138,14 +138,14 @@ class Wpforo 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 Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content 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 Wpforo::fixPostData( $post, $className, $contentId );
|
||||
return WpforoCore::fixPostData( $post, $className, $contentId );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,7 +202,7 @@ class Wpforo extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'forumid' );
|
||||
@@ -256,7 +256,7 @@ class Wpforo extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'topicid' );
|
||||
@@ -325,7 +325,7 @@ class Wpforo extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'postid' );
|
||||
@@ -366,14 +366,14 @@ class Wpforo extends Software
|
||||
/**
|
||||
* @brief temporarily store post content
|
||||
*/
|
||||
protected $_postContent = [];
|
||||
protected array $_postContent = [];
|
||||
|
||||
/**
|
||||
* Convert attachments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
public function convertAttachments() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'postid' );
|
||||
@@ -431,8 +431,7 @@ class Wpforo extends Software
|
||||
$this->_postContent[ $pid ] = str_replace( $matches[0][ $key ], '[attachment=' . $attachId . ':name]', $this->_postContent[ $pid ] );
|
||||
}
|
||||
}
|
||||
catch( UnderflowException $e ) {}
|
||||
catch( OutOfRangeException $e ) {}
|
||||
catch( UnderflowException|OutOfRangeException $e ) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,8 +472,7 @@ class Wpforo extends Software
|
||||
$this->_postContent[ $pid ] = str_replace( $matches[0][ $key ], '[attachment=' . $attachId . ':name]', $this->_postContent[ $pid ] );
|
||||
}
|
||||
}
|
||||
catch( UnderflowException $e ) {}
|
||||
catch( OutOfRangeException $e ) {}
|
||||
catch( UnderflowException|OutOfRangeException $e ) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,7 +494,7 @@ class Wpforo extends Software
|
||||
public function checkRedirects(): ?Url
|
||||
{
|
||||
$url = Request::i()->url();
|
||||
$wpForoSlug = defined('WPFORO_SLUG') ? WPFOROSLUG : 'community';
|
||||
$wpForoSlug = defined('WPFORO_SLUG') ? WPFORO_SLUG : 'community';
|
||||
|
||||
$matches = [];
|
||||
if( preg_match( '#/' . $wpForoSlug . '/([a-z0-9-]+)/([a-z0-9-]+)#i', $url->data[ Url::COMPONENT_PATH ], $matches ) )
|
||||
|
||||
@@ -19,7 +19,7 @@ use InvalidArgumentException;
|
||||
use IPS\Content;
|
||||
use IPS\convert\App;
|
||||
use IPS\convert\Software;
|
||||
use IPS\convert\Software\Core\Xenforo;
|
||||
use IPS\convert\Software\Core\Xenforo as XenforoCore;
|
||||
use IPS\Db;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
@@ -51,7 +51,7 @@ class Xenforo extends Software
|
||||
/**
|
||||
* @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 Flag to indicate the post data has been fixed during conversion, and we only need to use Legacy Parser
|
||||
@@ -61,7 +61,7 @@ class Xenforo extends Software
|
||||
/**
|
||||
* @brief XF2.1 changed serialized data to json decoded
|
||||
*/
|
||||
public static $useJson = FALSE;
|
||||
public static bool $useJson = FALSE;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -71,9 +71,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 )
|
||||
{
|
||||
@@ -104,8 +104,6 @@ class Xenforo extends Software
|
||||
}
|
||||
catch( Exception $e ) {} # If we can't query, we won't be able to do anything anyway
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,14 +273,14 @@ class Xenforo 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 Content Classname passed by post-conversion rebuild
|
||||
* @param int|null $contentId Content 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 Xenforo::fixPostData( $post, $className, $contentId );
|
||||
return XenforoCore::fixPostData( $post, $className, $contentId );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,7 +290,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
|
||||
{
|
||||
@@ -310,7 +308,7 @@ class Xenforo extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsForums()
|
||||
public function convertForumsForums() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -384,7 +382,7 @@ class Xenforo extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsTopics()
|
||||
public function convertForumsTopics() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'thread_id' );
|
||||
@@ -494,7 +492,7 @@ class Xenforo extends Software
|
||||
'last_poster_name' => $row['last_post_username'],
|
||||
'poll_state' => $poll,
|
||||
'views' => $row['view_count'],
|
||||
'approved' => $approved,
|
||||
'approved' => $approved ?? 0,
|
||||
'pinned' => $row['sticky'],
|
||||
'moved_to' => $moved_to,
|
||||
);
|
||||
@@ -571,7 +569,7 @@ class Xenforo extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertForumsPosts()
|
||||
public function convertForumsPosts() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
@@ -628,7 +626,7 @@ class Xenforo extends Software
|
||||
'author_name' => $row['username'],
|
||||
'ip_address' => $row['ip'] ?? '127.0.0.1',
|
||||
'post_date' => $row['post_date'],
|
||||
'queued' => $queued,
|
||||
'queued' => $queued ?? 0,
|
||||
);
|
||||
|
||||
$libraryClass->convertForumsPost( $info );
|
||||
@@ -726,7 +724,7 @@ class Xenforo extends Software
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertAttachments()
|
||||
public function convertAttachments() : void
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'xf_attachment.attachment_id' );
|
||||
@@ -786,9 +784,8 @@ class Xenforo extends Software
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( UnderflowException $e ) {}
|
||||
catch( OutOfRangeException $e ) {}
|
||||
|
||||
catch( UnderflowException|OutOfRangeException $e ) {}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['attachment_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user