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
@@ -17,11 +17,13 @@ use DOMElement;
|
||||
use Exception;
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\Extensions\QueueAbstract;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Log;
|
||||
use IPS\Member;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Settings;
|
||||
use IPS\Task\Queue\OutOfRangeException as QueueOutOfRangeException;
|
||||
use IPS\Text\DOMParser;
|
||||
use IPS\Xml\DOMDocument;
|
||||
use OutOfRangeException;
|
||||
@@ -39,12 +41,17 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class InvisionCommunityRebuildContent
|
||||
class InvisionCommunityRebuildContent extends QueueAbstract
|
||||
{
|
||||
/**
|
||||
* @brief Number of content items to rebuild per cycle
|
||||
*/
|
||||
public $rebuild = REBUILD_SLOW;
|
||||
public int $rebuild = REBUILD_SLOW;
|
||||
|
||||
/**
|
||||
* @var App|null
|
||||
*/
|
||||
protected ?App $app = null;
|
||||
|
||||
/**
|
||||
* Parse data before queuing
|
||||
@@ -88,8 +95,8 @@ class InvisionCommunityRebuildContent
|
||||
*
|
||||
* @param mixed $data Data as it was passed to \IPS\Task::queue()
|
||||
* @param int $offset Offset
|
||||
* @return int|null New offset or NULL if complete
|
||||
* @throws \IPS\Task\Queue\OutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
* @return int New offset or NULL if complete
|
||||
* @throws QueueOutOfRangeException Indicates offset doesn't exist and thus task is complete
|
||||
*/
|
||||
public function run( mixed &$data, int $offset ): int
|
||||
{
|
||||
@@ -97,13 +104,13 @@ class InvisionCommunityRebuildContent
|
||||
$exploded = explode( '\\', $classname );
|
||||
if ( !class_exists( $classname ) or !Application::appIsEnabled( $exploded[1] ) )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new QueueOutOfRangeException;
|
||||
}
|
||||
|
||||
/* Make sure there's even content to parse */
|
||||
if( !isset( $classname::$databaseColumnMap['content'] ) )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new QueueOutOfRangeException;
|
||||
}
|
||||
|
||||
/* Intentionally no try/catch as it means app doesn't exist */
|
||||
@@ -114,12 +121,12 @@ class InvisionCommunityRebuildContent
|
||||
/* This extension is ONLY for InvisionCommunity conversions */
|
||||
if( $this->app->app_key != 'invisioncommunity' )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new QueueOutOfRangeException;
|
||||
}
|
||||
}
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new QueueOutOfRangeException;
|
||||
}
|
||||
|
||||
$softwareClass = $this->app->getSource( FALSE, FALSE );
|
||||
@@ -218,7 +225,7 @@ class InvisionCommunityRebuildContent
|
||||
|
||||
if( $last === NULL )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new QueueOutOfRangeException;
|
||||
}
|
||||
|
||||
/* Return the number rebuilt so far, so that the rebuild progress bar text makes sense */
|
||||
@@ -251,7 +258,7 @@ class InvisionCommunityRebuildContent
|
||||
* @param DOMElement $element DOM element
|
||||
* @return void
|
||||
*/
|
||||
public function updateMention( DOMElement $element )
|
||||
public function updateMention( DOMElement $element ) : void
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -272,7 +279,7 @@ class InvisionCommunityRebuildContent
|
||||
/**
|
||||
* @brief Mapping of content types to converter lookups - Add more for other apps when we support them
|
||||
*/
|
||||
protected $embedLocations = array( 'forums' => array( 'content' => 'forums_topics', 'comment' => 'forums_posts' ) );
|
||||
protected array $embedLocations = array( 'forums' => array( 'content' => 'forums_topics', 'comment' => 'forums_posts' ) );
|
||||
|
||||
/**
|
||||
* Update local embeds for new names, IDs
|
||||
@@ -280,7 +287,7 @@ class InvisionCommunityRebuildContent
|
||||
* @param DOMElement $element DOM element
|
||||
* @return void
|
||||
*/
|
||||
public function updateEmbed( DOMElement $element )
|
||||
public function updateEmbed( DOMElement $element ) : void
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -328,7 +335,7 @@ class InvisionCommunityRebuildContent
|
||||
* @param DOMElement $element DOM element
|
||||
* @return void
|
||||
*/
|
||||
public function updateQuote( DOMElement $element )
|
||||
public function updateQuote( DOMElement $element ) : void
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user