Documentation

TopicMerge
in package
implements ActionInterface, Routable uses ActionTrait, BackwardCompatibility

Handles merging of topics.

Table of Contents

Interfaces

ActionInterface
Interface for all action classes.
Routable
Classes implementing this interface can build routes from URL query parameters and parse routes back into URL query parameters.

Properties

$subaction  : string
$subactions  : array<string|int, mixed>
$topics  : array<string|int, mixed>
$approved  : int
$boards  : array<string|int, mixed>
$boardTotals  : array<string|int, mixed>
$can_approve_boards  : array<string|int, mixed>
$firstTopic  : int
$is_sticky  : int
$lowestTopicBoard  : int
$lowestTopicId  : int
$merge_boards  : array<string|int, mixed>
$num_views  : int
$obj  : static
$polls  : array<string|int, mixed>
$topic_data  : array<string|int, mixed>

Methods

buildRoute()  : array<string|int, mixed>
Builds a routing path based on URL query parameters.
call()  : void
Convenience method to load() and execute() an instance of this class.
canBeLogged()  : bool
Determines whether this action can be logged in the online log.
canShowDebuggingInfo()  : bool
Determines whether debugging info should be shown.
canShowInMaintenanceMode()  : bool
Determines whether this action allows access in maintenance mode.
done()  : void
Shows a 'merge completed' screen.
execute()  : void
Merges two or more topics into one topic.
getOutputType()  : OutputTypeInterface
Gets the output type for this action.
index()  : void
Screen shown before the actual merge.
initiate()  : void
Initiates a merge of the specified topics.
isAgreementAction()  : bool
Determines whether this action can be accessed without accepting the registration agreement and privacy policy.
isRestrictedGuestAccessAllowed()  : bool
Determines whether this action allows access if guest access is restricted.
isSimpleAction()  : bool
Determines whether this is a simple action.
load()  : static
Static wrapper for constructor.
merge()  : void
Performs the merge
options()  : void
The merge options screen.
parseRoute()  : array<string|int, mixed>
Parses a route to get URL query parameters.
subActionProvider()  : null|array<string|int, mixed>
Called by Subs-Compat.php BackwardCompatibility wrapper functions to provide subaction execution for existing mods
__construct()  : mixed
Constructor. Protected to force instantiation via self::load().
getMergeBoards()  : void
Gets the boards in which the user is allowed to merge topics.
getTopicData()  : void
Gets info about the topics and polls that will be merged.
getTopics()  : void
Sets the value of $this->topics.
initOptionsAndMerge()  : void
Sets up some stuff needed for both $this->options() and $this->merge().

Properties

$subaction

public string $subaction = 'index'

The requested sub-action. This should be set by the constructor.

$subactions

public static array<string|int, mixed> $subactions = ['index' => 'index', 'done' => 'done', 'merge' => 'merge', 'options' => 'options']

Available sub-actions.

$topics

public array<string|int, mixed> $topics = []

IDs of the topics to merge.

$boards

protected array<string|int, mixed> $boards = []

$boardTotals

protected array<string|int, mixed> $boardTotals = []

$can_approve_boards

protected array<string|int, mixed> $can_approve_boards = []

$lowestTopicBoard

protected int $lowestTopicBoard = 0

$lowestTopicId

protected int $lowestTopicId = 0

$merge_boards

protected array<string|int, mixed> $merge_boards = []

$obj

protected static static $obj

An instance of this class. This is used by the load() method to prevent multiple instantiations.

$polls

protected array<string|int, mixed> $polls = []

$topic_data

protected array<string|int, mixed> $topic_data = []

Methods

buildRoute()

Builds a routing path based on URL query parameters.

public static buildRoute(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

URL query parameters.

Return values
array<string|int, mixed>

Contains two elements: ['route' => [], 'params' => []]. The 'route' element contains the routing path. The 'params' element contains any $params that weren't incorporated into the route.

call()

Convenience method to load() and execute() an instance of this class.

public static call() : void

canBeLogged()

Determines whether this action can be logged in the online log.

public canBeLogged() : bool
Return values
bool

canShowDebuggingInfo()

Determines whether debugging info should be shown.

public canShowDebuggingInfo() : bool
Return values
bool

canShowInMaintenanceMode()

Determines whether this action allows access in maintenance mode.

public canShowInMaintenanceMode() : bool
Return values
bool

True if access is allowed, false otherwise.

done()

Shows a 'merge completed' screen.

public done() : void
  • Accessed via ?action=mergetopics;sa=done.
  • Uses 'merge_done' sub template of the SplitTopics template.

execute()

Merges two or more topics into one topic.

public execute() : void
  • Delegates to the other functions (based on the URL parameter sa).
  • Loads the SplitTopics template.
  • Requires the merge_any permission.
  • Accessed via ?action=mergetopics.

index()

Screen shown before the actual merge.

public index() : void
  • Allows user to choose a topic to merge the current topic with.
  • Accessed via ?action=mergetopics;sa=index
  • Default sub action for ?action=mergetopics.
  • Uses 'merge' sub template of the MoveTopic template.
  • Allows setting a different target board.

initiate()

Initiates a merge of the specified topics.

public static initiate([array<string|int, mixed> $topics = [] ]) : void

Called from SMF\MessageIndex::QuickModeration().

Parameters
$topics : array<string|int, mixed> = []

The IDs of the topics to merge

isAgreementAction()

Determines whether this action can be accessed without accepting the registration agreement and privacy policy.

public isAgreementAction() : bool
Return values
bool

isRestrictedGuestAccessAllowed()

Determines whether this action allows access if guest access is restricted.

public isRestrictedGuestAccessAllowed() : bool
Return values
bool

True if access is allowed, false otherwise.

isSimpleAction()

Determines whether this is a simple action.

public isSimpleAction() : bool
Return values
bool

load()

Static wrapper for constructor.

public static load() : static
Return values
static

An instance of this class.

merge()

Performs the merge

public merge() : void
  • Accessed via ?action=mergetopics;sa=merge.
  • Updates the statistics to reflect the merge.
  • Logs the action in the moderation log.
  • Sends a notification to all users monitoring this topic.
  • Redirects to ?action=mergetopics;sa=done.

options()

The merge options screen.

public options() : void
  • Shows topics to be merged and allows to set some merge options.
  • Accessed via ?action=mergetopics;sa=options
  • Can also be called internally by SMF\MessageIndex::QuickModeration().
  • Uses 'merge_extra_options' sub template of the MoveTopic template.

parseRoute()

Parses a route to get URL query parameters.

public static parseRoute(array<string|int, mixed> $route[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$route : array<string|int, mixed>

Array of routing path components.

$params : array<string|int, mixed> = []

Any existing URL query parameters.

Return values
array<string|int, mixed>

URL query parameters

subActionProvider()

Called by Subs-Compat.php BackwardCompatibility wrapper functions to provide subaction execution for existing mods

public static subActionProvider([null|string $sa = null ][, bool $return_config = false ][, string|null $activity = null ]) : null|array<string|int, mixed>
Parameters
$sa : null|string = null
$return_config : bool = false
$activity : string|null = null
Return values
null|array<string|int, mixed>

__construct()

Constructor. Protected to force instantiation via self::load().

protected __construct() : mixed

getMergeBoards()

Gets the boards in which the user is allowed to merge topics.

protected getMergeBoards() : void

getTopicData()

Gets info about the topics and polls that will be merged.

protected getTopicData() : void

getTopics()

Sets the value of $this->topics.

protected getTopics() : void

initOptionsAndMerge()

Sets up some stuff needed for both $this->options() and $this->merge().

protected initOptionsAndMerge() : void

        
On this page

Search results