Ingo_Script_Customsql
extends Ingo_Script_Base
in package
The Ingo_Script_Customsql class generates SQL scripts out of custom SQL queries.
Tags
Table of Contents
- $_actions : array<string|int, mixed>
- The list of actions allowed (implemented) for this driver.
- $_categories : array<string|int, mixed>
- The categories of filtering allowed.
- $_categoryFeatures : array<string|int, mixed>
- Which form fields are supported in each category by this driver?
- $_features : array<string|int, mixed>
- A list of driver features.
- $_generated : bool
- Have the recipes been generated yet?
- $_params : array<string|int, mixed>
- The script class' additional parameters.
- $_recipes : array<string|int, mixed>
- The recipes that make up the code.
- $_special_types : array<string|int, mixed>
- A list of any special types that this driver supports.
- $_tests : array<string|int, mixed>
- The list of tests allowed (implemented) for this driver.
- $_types : array<string|int, mixed>
- The types of tests allowed (implemented) for this driver.
- __construct() : mixed
- Constructor.
- activate() : mixed
- Connects to the backend, uploads the scripts and sets them active.
- availableActions() : array<string|int, mixed>
- Returns the available actions for this driver.
- availableCategories() : array<string|int, mixed>
- Returns the available categories for this driver.
- availableCategoryFeatures() : array<string|int, mixed>
- Returns the supported form fields for this driver.
- availableTests() : array<string|int, mixed>
- Returns the available tests for this driver.
- availableTypes() : array<string|int, mixed>
- Returns the available test types for this driver.
- canPerform() : bool
- Is the perform() function available right now?
- excludeRegexp() : string
- Returns a regular expression that should catch mails coming from most daemons, mailing list, newsletters, and other bulk.
- generate() : array<string|int, mixed>
- Generates the scripts to do the filtering specified in the rules.
- hasFeature() : bool
- Returns whether the script driver supports a certain feature.
- perform() : mixed
- Performs the filtering specified in the rules.
- setParams() : Ingo_Script
- Updates the parameters.
- specialTypes() : array<string|int, mixed>
- Returns any test types that are special for this driver.
- _addItem() : mixed
- Adds an item to the recipe list.
- _generate() : mixed
- Generates the scripts to do the filtering specified in the rules.
- _insertItem() : mixed
- Inserts an item into the recipe list.
- _perform() : mixed
- _placeHolders() : string
- Replaces place holders in a query.
- _validRule() : bool
- Is this a valid rule?
Properties
$_actions
The list of actions allowed (implemented) for this driver.
protected
array<string|int, mixed>
$_actions
= array()
This SHOULD be defined in each subclass.
$_categories
The categories of filtering allowed.
protected
array<string|int, mixed>
$_categories
= array('Ingo_Rule_System_Vacation')
$_categoryFeatures
Which form fields are supported in each category by this driver?
protected
array<string|int, mixed>
$_categoryFeatures
= array('Ingo_Rule_System_Vacation' => array('subject', 'reason'))
This is an associative array with the keys taken from $_categories, each value is a list of strings with the supported feature names. An absent key is interpreted as "all features supported".
$_features
A list of driver features.
protected
array<string|int, mixed>
$_features
= array(
/* Can tests be case sensitive? */
'case_sensitive' => \false,
/* Does the driver support setting IMAP flags? */
'imap_flags' => \false,
/* Can this driver perform on demand filtering? */
'on_demand' => \false,
/* Does the driver require a script file to be generated? */
'script_file' => \true,
/* Does the driver support the stop-script option? */
'stop_script' => \false,
/* Does the driver support vacation start and end on time level? */
'vacation_time' => \false,
)
$_generated
Have the recipes been generated yet?
protected
bool
$_generated
= \false
$_params
The script class' additional parameters.
protected
array<string|int, mixed>
$_params
= array()
$_recipes
The recipes that make up the code.
protected
array<string|int, mixed>
$_recipes
= array()
$_special_types
A list of any special types that this driver supports.
protected
array<string|int, mixed>
$_special_types
= array()
$_tests
The list of tests allowed (implemented) for this driver.
protected
array<string|int, mixed>
$_tests
= array()
This SHOULD be defined in each subclass.
$_types
The types of tests allowed (implemented) for this driver.
protected
array<string|int, mixed>
$_types
= array()
This SHOULD be defined in each subclass.
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $params : array<string|int, mixed> = array()
-
A hash containing parameters needed.
Return values
mixed —activate()
Connects to the backend, uploads the scripts and sets them active.
public
activate([bool $activate = true ][, bool $auto_update = true ]) : mixed
Parameters
- $activate : bool = true
-
Activate the script?
- $auto_update : bool = true
-
Only update if auto_update is active?
Tags
Return values
mixed —availableActions()
Returns the available actions for this driver.
public
availableActions() : array<string|int, mixed>
Return values
array<string|int, mixed> —The list of available actions.
availableCategories()
Returns the available categories for this driver.
public
availableCategories() : array<string|int, mixed>
Return values
array<string|int, mixed> —The list of categories.
availableCategoryFeatures()
Returns the supported form fields for this driver.
public
availableCategoryFeatures(mixed $category) : array<string|int, mixed>
Parameters
- $category : mixed
Return values
array<string|int, mixed> —An array with the supported field names of the requested category.
availableTests()
Returns the available tests for this driver.
public
availableTests() : array<string|int, mixed>
Return values
array<string|int, mixed> —The list of tests actions.
availableTypes()
Returns the available test types for this driver.
public
availableTypes() : array<string|int, mixed>
Return values
array<string|int, mixed> —The list of test types.
canPerform()
Is the perform() function available right now?
public
canPerform() : bool
This is not a duplication of hasFeature() because drivers might override this to do real-time checks if on-demand filtering is not only available theoretically but practically in this very moment.
Return values
bool —True if perform() is available, false if not.
excludeRegexp()
Returns a regular expression that should catch mails coming from most daemons, mailing list, newsletters, and other bulk.
public
excludeRegexp() : string
This is the expression used for procmail's FROM_DAEMON, including all mailinglist headers.
Return values
string —A regular expression.
generate()
Generates the scripts to do the filtering specified in the rules.
public
generate() : array<string|int, mixed>
Return values
array<string|int, mixed> —The scripts.
hasFeature()
Returns whether the script driver supports a certain feature.
public
hasFeature(string $feature) : bool
Parameters
- $feature : string
-
A feature name.
Tags
Return values
bool —True if this feature is supported.
perform()
Performs the filtering specified in the rules.
public
perform([int $change = null ]) : mixed
Parameters
- $change : int = null
-
The timestamp of the latest rule change during the current session (uses session value if null).
Return values
mixed —setParams()
Updates the parameters.
public
setParams([array<string|int, mixed> $params = array() ]) : Ingo_Script
Parameters
- $params : array<string|int, mixed> = array()
-
A hash containing parameters.
Return values
Ingo_Script —This object, for chaining.
specialTypes()
Returns any test types that are special for this driver.
public
specialTypes() : array<string|int, mixed>
Return values
array<string|int, mixed> —The list of special types
_addItem()
Adds an item to the recipe list.
protected
_addItem(int $rule, Ingo_Script_Item $item[, string $name = null ]) : mixed
Parameters
- $rule : int
-
One of the Ingo::RULE_* constants.
- $item : Ingo_Script_Item
-
An item to add to the recipe list.
- $name : string = null
-
A script name.
Return values
mixed —_generate()
Generates the scripts to do the filtering specified in the rules.
protected
_generate() : mixed
Return values
mixed —_insertItem()
Inserts an item into the recipe list.
protected
_insertItem(int $rule, Ingo_Script_Item $item[, string $name = null ], mixed $position) : mixed
Parameters
- $rule : int
-
One of the Ingo::RULE_* constants.
- $item : Ingo_Script_Item
-
An item to add to the recipe list.
- $name : string = null
-
A script name.
- $position : mixed
Tags
Return values
mixed —_perform()
protected
_perform(mixed $change) : mixed
Parameters
- $change : mixed
Tags
Return values
mixed —_placeHolders()
Replaces place holders in a query.
protected
_placeHolders(string $query, int $rule) : string
Parameters
- $query : string
-
A SQL query with place holders.
- $rule : int
-
A Ingo::RULE_* constant.
Return values
string —A valid query.
_validRule()
Is this a valid rule?
protected
_validRule(Ingo_Rule $rule) : bool
Parameters
- $rule : Ingo_Rule
-
The rule object.
Return values
bool —Whether the rule is valid for this driver.