Search
in package
implements
ActionInterface
Uses
BackwardCompatibility
The admin screen to change the search settings.
Table of Contents
Interfaces
- ActionInterface
- Interface for all action classes.
Properties
- $subaction : string
- $subactions : array<string|int, mixed>
- $obj : object
- $backcompat : array<string|int, mixed>
Methods
- call() : void
- Convenience method to load() and execute() an instance of this class.
- createMessageIndex() : void
- Backward compatibility wrapper for the createmsgindex sub-action.
- createmsgindex() : mixed
- Create a custom search index for the messages table.
- detectFulltextIndex() : mixed
- Checks if the message table already has a fulltext index created and returns the key name Determines if a db is capable of creating a fulltext index
- editSearchMethod() : void
- Backward compatibility wrapper for the method sub-action.
- editSearchSettings() : void|array<string|int, mixed>
- Backward compatibility wrapper for the _____ sub-action.
- editWeights() : void
- Backward compatibility wrapper for the weights sub-action.
- execute() : void
- Dispatcher to whichever sub-action method is necessary.
- exportStatic() : void
- Provides a way to export a class's public static properties and methods to global namespace.
- getConfigVars() : array<string|int, mixed>
- Gets the configuration variables for this admin area.
- load() : object
- Static wrapper for constructor.
- method() : mixed
- Edit the search method and search index used.
- settings() : void
- Edit some general settings related to the search function.
- weights() : mixed
- Edit the relative weight of the search factors.
- __construct() : mixed
- Constructor. Protected to force instantiation via self::load().
Properties
$subaction
public
string
$subaction
= 'weights'
The requested sub-action. This should be set by the constructor.
$subactions
public
static array<string|int, mixed>
$subactions
= ['settings' => 'settings', 'weights' => 'weights', 'method' => 'method', 'createfulltext' => 'method', 'removecustom' => 'method', 'removefulltext' => 'method', 'createmsgindex' => 'createmsgindex']
Available sub-actions.
$obj
protected
static object
$obj
An instance of this class. This is used by the load() method to prevent mulitple instantiations.
$backcompat
private
static array<string|int, mixed>
$backcompat
= ['func_names' => ['call' => 'ManageSearch', 'editWeights' => 'EditWeights', 'editSearchMethod' => 'EditSearchMethod', 'createMessageIndex' => 'CreateMessageIndex']]
BackwardCompatibility settings for this class.
Methods
call()
Convenience method to load() and execute() an instance of this class.
public
static call() : void
createMessageIndex()
Backward compatibility wrapper for the createmsgindex sub-action.
public
static createMessageIndex() : void
createmsgindex()
Create a custom search index for the messages table.
public
createmsgindex() : mixed
Called by ?action=admin;area=managesearch;sa=createmsgindex. Linked from the method screen. Requires the admin_forum permission. Depending on the size of the message table, the process is divided in steps.
detectFulltextIndex()
Checks if the message table already has a fulltext index created and returns the key name Determines if a db is capable of creating a fulltext index
public
detectFulltextIndex() : mixed
editSearchMethod()
Backward compatibility wrapper for the method sub-action.
public
static editSearchMethod() : void
editSearchSettings()
Backward compatibility wrapper for the _____ sub-action.
public
editSearchSettings([bool $return_config = false ]) : void|array<string|int, mixed>
Parameters
- $return_config : bool = false
-
Whether or not to return the config_vars array (used for admin search)
Return values
void|array<string|int, mixed> —Returns nothing or returns the $config_vars array if $return_config is true
editWeights()
Backward compatibility wrapper for the weights sub-action.
public
static editWeights() : void
execute()
Dispatcher to whichever sub-action method is necessary.
public
execute() : void
exportStatic()
Provides a way to export a class's public static properties and methods to global namespace.
public
static exportStatic() : void
To do so:
- Use this trait in the class.
- At the END of the class's file, call its exportStatic() method.
Although it might not seem that way at first glance, this approach conforms to section 2.3 of PSR 1, since executing this method is simply a dynamic means of declaring functions when the file is included; it has no other side effects.
Regarding the $backcompat items:
A class's static properties are not exported to global variables unless explicitly included in $backcompat['prop_names']. Likewise, a class's static methods are not exported as global functions unless explicitly included in $backcompat['func_names'].
$backcompat['prop_names'] is a simple array where the keys are the names of one or more of a class's static properties, and the values are the names of global variables. In each case, the global variable will be set to a reference to the static property. Static properties that are not named in this array will not be exported.
$backcompat['func_names'] is a simple array where the keys are the names of one or more of a class's static methods, and the values are the names that should be used for global functions that will encapsulate those methods. Methods that are not named in this array will not be exported.
Adding non-static properties or methods to the $backcompat arrays will produce runtime errors. It is the responsibility of the developer to make sure not to do this.
getConfigVars()
Gets the configuration variables for this admin area.
public
static getConfigVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —$config_vars for the search area.
load()
Static wrapper for constructor.
public
static load() : object
Return values
object —An instance of this class.
method()
Edit the search method and search index used.
public
method() : mixed
Calculates the size of the current search indexes in use. Allows to create and delete a fulltext index on the messages table. Allows to delete a custom index (that createmsgindex() created). Called by ?action=admin;area=managesearch;sa=method. Requires the admin_forum permission.
settings()
Edit some general settings related to the search function.
public
settings() : void
Called by ?action=admin;area=managesearch;sa=settings. Requires the admin_forum permission.
weights()
Edit the relative weight of the search factors.
public
weights() : mixed
Called by ?action=admin;area=managesearch;sa=weights. Requires the admin_forum permission.
__construct()
Constructor. Protected to force instantiation via self::load().
protected
__construct() : mixed