Documentation

Ingo_Storage_Sql extends Ingo_Storage
in package

Ingo_Storage API implementation to save Ingo data via Horde's Horde_Db database abstraction layer.

Tags
author

Jan Schneider jan@horde.org

author

Mike Cochrane mike@graftonhall.co.nz

author

Michael Slusarz slusarz@horde.org

category

Horde

copyright

2012-2017 Horde LLC

license

http://www.horde.org/licenses/apache ASL

Table of Contents

MAX_NONE  = 1
MAX_OK  = 0
MAX_OVER  = 2
STORE_ADD  = 1
STORE_DELETE  = 2
STORE_SORT  = 4
STORE_UPDATE  = 3
$max_rules  : mixed
$_actions  : array<string|int, mixed>
Mapping of 'rule_action' column in ingo_rules table to rule class names.
$_params  : array<string|int, mixed>
Configuration parameters.
$_rules  : array<string|int, mixed>
Rules list.
__construct()  : mixed
Constructor.
__get()  : mixed
addRule()  : mixed
Adds a rule to the filters list.
clearCache()  : mixed
Clears the internal rule cache.
copyRule()  : bool
Creates a copy of an existing rule.
count()  : mixed
deleteRule()  : bool
Deletes an existing rule.
getIterator()  : mixed
getRuleByUid()  : Ingo_Rule
Returns a rule given a UID.
getSystemRule()  : Ingo_Rule
Retrieves the specified system rule.
maxRules()  : int
Has the maximum number of rules been reached?
removeUserData()  : mixed
Removes the user data from the storage backend.
sort()  : mixed
Sorts the list of rules in the given order.
updateRule()  : mixed
Updates an existing rule.
_getRule()  : int
Retrieves a rule.
_load()  : mixed
Load the rules.
_loadFromBackend()  : mixed
Load the rules from the storage backend.
_removeUserData()  : mixed
Removes the user data from the storage backend.
_ruleToBackend()  : array<string|int, mixed>
Converts a user rule to the database format.
_store()  : mixed
Store a rule.
_storeBackend()  : mixed
Store a rule in the backend.

Constants

STORE_ADD

public mixed STORE_ADD = 1

STORE_DELETE

public mixed STORE_DELETE = 2

STORE_SORT

public mixed STORE_SORT = 4

STORE_UPDATE

public mixed STORE_UPDATE = 3

Properties

$max_rules read-only

public mixed $max_rules

The value of the max_rules permission.

$_actions

Mapping of 'rule_action' column in ingo_rules table to rule class names.

protected array<string|int, mixed> $_actions = array(1 => 'Ingo_Rule_User_Keep', 2 => 'Ingo_Rule_User_Move', 3 => 'Ingo_Rule_User_Discard', 4 => 'Ingo_Rule_User_Redirect', 5 => 'Ingo_Rule_User_RedirectKeep', 6 => 'Ingo_Rule_User_Reject', 7 => 'Ingo_Rule_System_Blacklist', 8 => 'Ingo_Rule_System_Vacation', 9 => 'Ingo_Rule_System_Whitelist', 10 => 'Ingo_Rule_System_Forward', 11 => 'Ingo_Rule_User_MoveKeep', 12 => 'Ingo_Rule_User_FlagOnly', 13 => 'Ingo_Rule_User_Notify', 14 => 'Ingo_Rule_System_Spam')

$_params

Configuration parameters.

protected array<string|int, mixed> $_params = array()

$_rules

Rules list.

protected array<string|int, mixed> $_rules = array()

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
$params : array<string|int, mixed> = array()
Tags
params

array $params Configuration parameters.

Return values
mixed

__get()

public __get(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

addRule()

Adds a rule to the filters list.

public addRule(Ingo_Rule $rule) : mixed
Parameters
$rule : Ingo_Rule

A rule object.

Return values
mixed

clearCache()

Clears the internal rule cache.

public clearCache() : mixed
Tags
since

Ingo 3.2.12

Return values
mixed

copyRule()

Creates a copy of an existing rule.

public copyRule(Ingo_Rule $rule) : bool

The created copy is added to the filters list after the original rule.

Parameters
$rule : Ingo_Rule

The rule object to copy.

Return values
bool

True if the rule has been found and copied.

count()

public count() : mixed
Return values
mixed

deleteRule()

Deletes an existing rule.

public deleteRule(Ingo_Rule $rule) : bool
Parameters
$rule : Ingo_Rule

A rule object.

Return values
bool

True if the rule has been found and deleted.

getIterator()

public getIterator() : mixed
Return values
mixed

getRuleByUid()

Returns a rule given a UID.

public getRuleByUid(string $uid) : Ingo_Rule
Parameters
$uid : string

Rule UID.

Return values
Ingo_Rule

The rule object (null if not found).

getSystemRule()

Retrieves the specified system rule.

public getSystemRule(string $rule) : Ingo_Rule
Parameters
$rule : string

The rule name.

Tags
throws
Ingo_Exception
Return values
Ingo_Rule

A rule object.

maxRules()

Has the maximum number of rules been reached?

public maxRules() : int
Return values
int

A MAX_* constant. Non-zero indicates rule cannot be added.

removeUserData()

Removes the user data from the storage backend.

public removeUserData(string $user) : mixed
Parameters
$user : string

The user name to delete filters for.

Tags
throws
Ingo_Exception
Return values
mixed

sort()

Sorts the list of rules in the given order.

public sort(array<string|int, mixed> $rules) : mixed
Parameters
$rules : array<string|int, mixed>

Sorted list of rule UIDs.

Return values
mixed

updateRule()

Updates an existing rule.

public updateRule(Ingo_Rule $rule) : mixed
Parameters
$rule : Ingo_Rule

A rule object.

Return values
mixed

_getRule()

Retrieves a rule.

protected _getRule(Ingo_Rule $rule) : int
Parameters
$rule : Ingo_Rule

The rule object.

Return values
int

The key of the rule in the rules list.

_load()

Load the rules.

protected _load() : mixed
Return values
mixed

_loadFromBackend()

Load the rules from the storage backend.

protected _loadFromBackend() : mixed
Return values
mixed

_removeUserData()

Removes the user data from the storage backend.

protected _removeUserData(mixed $user) : mixed
Parameters
$user : mixed

The user name to delete filters for.

Return values
mixed

_ruleToBackend()

Converts a user rule to the database format.

protected _ruleToBackend(Ingo_Rule $rule) : array<string|int, mixed>
Parameters
$rule : Ingo_Rule

Rule object.

Return values
array<string|int, mixed>

Rule hash in DB's format.

_store()

Store a rule.

protected _store(int $action[, Ingo_Rule $rule = null ]) : mixed
Parameters
$action : int

Storage action.

$rule : Ingo_Rule = null

Rule the action affects.

Return values
mixed

_storeBackend()

Store a rule in the backend.

protected _storeBackend(mixed $action, mixed $rule) : mixed
Parameters
$action : mixed
$rule : mixed
Return values
mixed

Search results