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
@@ -18,10 +18,12 @@ use InvalidArgumentException;
|
||||
use IPS\Application;
|
||||
use IPS\convert\App;
|
||||
use IPS\Data\Store;
|
||||
use IPS\Extensions\QueueAbstract;
|
||||
use IPS\IPS;
|
||||
use IPS\Log;
|
||||
use IPS\Member;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Task\Queue\OutOfRangeException as QueueOutOfRangeException;
|
||||
use IPS\Text\LegacyParser;
|
||||
use OutOfRangeException;
|
||||
use function defined;
|
||||
@@ -38,12 +40,12 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* Background Task
|
||||
*/
|
||||
class RebuildContent
|
||||
class RebuildContent extends QueueAbstract
|
||||
{
|
||||
/**
|
||||
* @brief Number of content items to rebuild per cycle
|
||||
*/
|
||||
public $rebuild = REBUILD_SLOW;
|
||||
public int $rebuild = REBUILD_SLOW;
|
||||
|
||||
/**
|
||||
* Parse data before queuing
|
||||
@@ -87,8 +89,8 @@ class RebuildContent
|
||||
*
|
||||
* @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
|
||||
{
|
||||
@@ -96,13 +98,13 @@ class RebuildContent
|
||||
$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 */
|
||||
@@ -112,7 +114,7 @@ class RebuildContent
|
||||
}
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
throw new \IPS\Task\Queue\OutOfRangeException;
|
||||
throw new QueueOutOfRangeException;
|
||||
}
|
||||
|
||||
$softwareClass = $app->getSource( FALSE, FALSE );
|
||||
@@ -213,7 +215,7 @@ class RebuildContent
|
||||
}
|
||||
|
||||
/* Then pass off to legacy parser to bring up to 4.x */
|
||||
$item->$contentColumn = LegacyParser::parseStatic( $item->$contentColumn, $member, false, $classname::$application . '_' . IPS::mb_ucfirst( $module ), $id1, $id2, NULL, isset( $classname::$itemClass ) ? $classname::$itemClass : get_class( $item ) );
|
||||
$item->$contentColumn = LegacyParser::parseStatic( $item->$contentColumn, $member, false, $classname::$application . '_' . IPS::mb_ucfirst( $module ), $id1, $id2, NULL, $classname::$itemClass ?? get_class( $item ) );
|
||||
}
|
||||
catch( InvalidArgumentException $e )
|
||||
{
|
||||
@@ -242,7 +244,7 @@ class RebuildContent
|
||||
|
||||
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 */
|
||||
|
||||
Reference in new issue
Block a user