IConfig

interface OCP\IConfig
Access to all the configuration options ownCloud offers
Implemented by:OC\AllConfig
Source:lib/public/IConfig.php#43

Constants

SENSITIVE_VALUE = ***REMOVED SENSITIVE VALUE***
Source:lib/public/IConfig.php#47
Since:8.2.0

Methods

public OCP\IConfig::setSystemValues($configs)
Sets and deletes system wide values
Source:

lib/public/IConfig.php#56

Parameters:
  • $configs (array) Associative array with key => value pairs

If value is null, the config key will be deleted

Since:

8.0.0

public OCP\IConfig::setSystemValue($key, $value)
Sets a new system wide value
Source:

lib/public/IConfig.php#65

Parameters:
  • $key (string) the key of the value, under which will be saved
  • $value (mixed) the value that should be stored
Since:

8.0.0

public OCP\IConfig::getSystemValue($key, $default="")
Looks up a system wide defined value
Source:

lib/public/IConfig.php#75

Parameters:
  • $key (string) the key of the value, under which it was saved
  • $default (mixed) the default value to be returned if the value isn’t set
Returns:

mixed the value or $default

Since:

6.0.0 - parameter $default was added in 7.0.0

public OCP\IConfig::getSystemValueBool($key, $default=false)
Looks up a boolean system wide defined value
Source:

lib/public/IConfig.php#85

Parameters:
  • $key (string) the key of the value, under which it was saved
  • $default (bool) the default value to be returned if the value isn’t set
Returns:

bool the value or $default

Since:

16.0.0

public OCP\IConfig::getSystemValueInt($key, $default=0)
Looks up an integer system wide defined value
Source:

lib/public/IConfig.php#95

Parameters:
  • $key (string) the key of the value, under which it was saved
  • $default (int) the default value to be returned if the value isn’t set
Returns:

int the value or $default

Since:

16.0.0

public OCP\IConfig::getSystemValueString($key, $default="")
Looks up a string system wide defined value
Source:

lib/public/IConfig.php#105

Parameters:
  • $key (string) the key of the value, under which it was saved
  • $default (string) the default value to be returned if the value isn’t set
Returns:

string the value or $default

Since:

16.0.0

public OCP\IConfig::getFilteredSystemValue($key, $default="")
Looks up a system wide defined value and filters out sensitive data
Source:

lib/public/IConfig.php#115

Parameters:
  • $key (string) the key of the value, under which it was saved
  • $default (mixed) the default value to be returned if the value isn’t set
Returns:

mixed the value or $default

Since:

8.2.0

public OCP\IConfig::deleteSystemValue($key)
Delete a system wide defined value
Source:

lib/public/IConfig.php#123

Parameters:
  • $key (string) the key of the value, under which it was saved
Since:

8.0.0

public OCP\IConfig::getAppKeys($appName)
Get all keys stored for an app
Source:

lib/public/IConfig.php#132

Parameters:
  • $appName (string) the appName that we stored the value under
Returns:

string[] the keys stored for the app

Since:

8.0.0

public OCP\IConfig::setAppValue($appName, $key, $value)
Writes a new app wide value
Source:

lib/public/IConfig.php#143

Parameters:
  • $appName (string) the appName that we want to store the value under
  • $key (string | float | int) the key of the value, under which will be saved
  • $value (string) the value that should be stored
Returns:

void

Since:

6.0.0

public OCP\IConfig::getAppValue($appName, $key, $default="")
Looks up an app wide defined value
Source:

lib/public/IConfig.php#154

Parameters:
  • $appName (string) the appName that we stored the value under
  • $key (string) the key of the value, under which it was saved
  • $default (string) the default value to be returned if the value isn’t set
Returns:

string the saved value

Since:

6.0.0 - parameter $default was added in 7.0.0

public OCP\IConfig::deleteAppValue($appName, $key)
Delete an app wide defined value
Source:

lib/public/IConfig.php#163

Parameters:
  • $appName (string) the appName that we stored the value under
  • $key (string) the key of the value, under which it was saved
Since:

8.0.0

public OCP\IConfig::deleteAppValues($appName)
Removes all keys in appconfig belonging to the app
Source:

lib/public/IConfig.php#171

Parameters:
  • $appName (string) the appName the configs are stored under
Since:

8.0.0

public OCP\IConfig::setUserValue($userId, $appName, $key, $value, $preCondition=null)
Set a user defined value
Source:

lib/public/IConfig.php#186

Parameters:
  • $userId (string) the userId of the user that we want to store the value under
  • $appName (string) the appName that we want to store the value under
  • $key (string) the key under which the value is being stored
  • $value (string) the value that you want to store
  • $preCondition (string) only update if the config value was previously the value passed as $preCondition
Throws:

\OCP\PreConditionNotMetException if a precondition is specified and is not met

Throws:

\UnexpectedValueException when trying to store an unexpected value

Throws:

\OCP\PreConditionNotMetException if a precondition is specified and is not met

Throws:

\UnexpectedValueException when trying to store an unexpected value

Since:

6.0.0 - parameter $precondition was added in 8.0.0

public OCP\IConfig::getUserValue($userId, $appName, $key, $default="")
Shortcut for getting a user defined value
Source:

lib/public/IConfig.php#198

Parameters:
  • $userId (string) the userId of the user that we want to store the value under
  • $appName (string) the appName that we stored the value under
  • $key (string) the key under which the value is being stored
  • $default (mixed) the default value to be returned if the value isn’t set
Returns:

string

Since:

6.0.0 - parameter $default was added in 7.0.0

public OCP\IConfig::getUserValueForUsers($appName, $key, $userIds)
Fetches a mapped list of userId -> value, for a specified app and key and a list of user IDs.
Source:

lib/public/IConfig.php#209

Parameters:
  • $appName (string) app to get the value for
  • $key (string) the key to get the value for
  • $userIds (array) the user IDs to fetch the values for
Returns:

array Mapped values: userId => value

Since:

8.0.0

public OCP\IConfig::getUserKeys($userId, $appName)
Get the keys of all stored by an app for the user
Source:

lib/public/IConfig.php#219

Parameters:
  • $userId (string) the userId of the user that we want to store the value under
  • $appName (string) the appName that we stored the value under
Returns:

string[]

Since:

8.0.0

public OCP\IConfig::deleteUserValue($userId, $appName, $key)
Delete a user value
Source:

lib/public/IConfig.php#229

Parameters:
  • $userId (string) the userId of the user that we want to store the value under
  • $appName (string) the appName that we stored the value under
  • $key (string) the key under which the value is being stored
Since:

8.0.0

public OCP\IConfig::deleteAllUserValues($userId)
Delete all user values
Source:

lib/public/IConfig.php#237

Parameters:
  • $userId (string) the userId of the user that we want to remove all values from
Since:

8.0.0

public OCP\IConfig::deleteAppFromAllUsers($appName)
Delete all user related values of one app
Source:

lib/public/IConfig.php#245

Parameters:
  • $appName (string) the appName of the app that we want to remove all values from
Since:

8.0.0

public OCP\IConfig::getUsersForUserValue($appName, $key, $value)
Determines the users that have the given value set for a specific app-key-pair
Source:

lib/public/IConfig.php#256

Parameters:
  • $appName (string) the app to get the user for
  • $key (string) the key to get the user for
  • $value (string) the value to get the user for
Returns:

array of user IDs

Since:

8.0.0