Settings extends AppModel
System setting management
Table of Contents
Methods
| getDbVersion() | Returns the database version of Blesta. A shortcut for Settings::getSetting("database_version"). |
| getSetting() | Fetch a single setting by key name |
| getSettings() | Fetches all system settings |
| getVersion() | Returns the source version of Blesta |
| setSetting() | Sets the setting with the given key, overwriting any existing value with that key |
| setSettings() | Sets a group of settings with key/value pairs |
| unsetSetting() | Unsets a setting from the system settings. CAUTION: This method will physically remove the setting from the system, and could have dire consequences. |
| upgradable() | Returns whether or not there are upgrade tasks to run |
Methods
getDbVersion()
Returns the database version of Blesta. A shortcut for Settings::getSetting("database_version").
public
getDbVersion() : string
Often this will not be exactly the same as the source version because database changes are not made in every sourve version update.
Tags
Return values
string —The source version of Blesta
getSetting()
Fetch a single setting by key name
public
getSetting(string $key) : mixed
Parameters
- $key : string
-
The key name of the setting to fetch
Return values
mixed —An stdObject containg the key and value, false if no such key exists
getSettings()
Fetches all system settings
public
getSettings() : mixed
Return values
mixed —An array of objects with key/value pairs of settings, false if no results found
getVersion()
Returns the source version of Blesta
public
getVersion() : string
Tags
Return values
string —The source version of Blesta
setSetting()
Sets the setting with the given key, overwriting any existing value with that key
public
setSetting(string $key, string $value[, mixed $encrypted = null ][, int $inherit = null ]) : mixed
Parameters
- $key : string
-
The setting identifier
- $value : string
-
The value to set for this setting
- $encrypted : mixed = null
-
True to encrypt $value, false to store unencrypted, null to encrypt if currently set to encrypt
- $inherit : int = null
-
Whether or not the setting should be inheritable
setSettings()
Sets a group of settings with key/value pairs
public
setSettings(array<string|int, mixed> $settings[, array<string|int, mixed> $value_keys = null ]) : mixed
Parameters
- $settings : array<string|int, mixed>
-
Settings to set as key/value pairs
- $value_keys : array<string|int, mixed> = null
-
An array of key values to accept as valid fields
Tags
unsetSetting()
Unsets a setting from the system settings. CAUTION: This method will physically remove the setting from the system, and could have dire consequences.
public
unsetSetting(string $key) : mixed
You should never use this method, except when attempting to remove a setting created by Settings::setSettings() or Settings::setSetting() that did not previously exist for this installation.
Parameters
- $key : string
-
The setting to unset
upgradable()
Returns whether or not there are upgrade tasks to run
public
upgradable() : bool
Return values
bool —True if there are upgrade tasks to run, false otherwise