Nextcloud PHP API (master)

IConfig

Access to all the configuration options Nextcloud offers.

Tags
since
6.0.0

Table of Contents

Constants

SENSITIVE_VALUE  = '***REMOVED SENSITIVE VALUE***'

Methods

deleteAllUserValues()  : mixed
Delete all user values
deleteAppFromAllUsers()  : mixed
Delete all user related values of one app
deleteAppValue()  : mixed
Delete an app wide defined value
deleteAppValues()  : mixed
Removes all keys in appconfig belonging to the app
deleteSystemValue()  : mixed
Delete a system wide defined value
deleteUserValue()  : mixed
Delete a user value
getAllUserValues()  : array<string|int, array<string|int, mixed>>
Get all user configs sorted by app of one user
getAppKeys()  : array<string|int, string>
Get all keys stored for an app
getAppValue()  : string
Looks up an app wide defined value
getFilteredSystemValue()  : mixed
Looks up a system wide defined value and filters out sensitive data
getSystemValue()  : mixed
Looks up a system wide defined value
getSystemValueBool()  : bool
Looks up a boolean system wide defined value
getSystemValueInt()  : int
Looks up an integer system wide defined value
getSystemValueString()  : string
Looks up a string system wide defined value
getUserKeys()  : array<string|int, string>
Get the keys of all stored by an app for the user
getUsersForUserValue()  : array<int, string>
Determines the users that have the given value set for a specific app-key-pair
getUserValue()  : string
Shortcut for getting a user defined value
getUserValueForUsers()  : array<string|int, mixed>
Fetches a mapped list of userId -> value, for a specified app and key and a list of user IDs.
setAppValue()  : void
Writes a new app wide value
setSystemValue()  : mixed
Sets a new system wide value
setSystemValues()  : mixed
Sets and deletes system wide values
setUserValue()  : mixed
Set a user defined value

Constants

SENSITIVE_VALUE

public mixed SENSITIVE_VALUE = '***REMOVED SENSITIVE VALUE***'
Tags
since
8.2.0

Methods

deleteAllUserValues()

Delete all user values

public deleteAllUserValues(string $userId) : mixed
Parameters
$userId : string

the userId of the user that we want to remove all values from

Tags
since
8.0.0

deleteAppFromAllUsers()

Delete all user related values of one app

public deleteAppFromAllUsers(string $appName) : mixed
Parameters
$appName : string

the appName of the app that we want to remove all values from

Tags
since
8.0.0

deleteAppValue()

Delete an app wide defined value

public deleteAppValue(string $appName, string $key) : mixed
Parameters
$appName : string

the appName that we stored the value under

$key : string

the key of the value, under which it was saved

Tags
since
8.0.0

deleteAppValues()

Removes all keys in appconfig belonging to the app

public deleteAppValues(string $appName) : mixed
Parameters
$appName : string

the appName the configs are stored under

Tags
since
8.0.0

deleteSystemValue()

Delete a system wide defined value

public deleteSystemValue(string $key) : mixed
Parameters
$key : string

the key of the value, under which it was saved

Tags
since
8.0.0

deleteUserValue()

Delete a user value

public deleteUserValue(string $userId, string $appName, string $key) : mixed
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

Tags
since
8.0.0

getAllUserValues()

Get all user configs sorted by app of one user

public getAllUserValues(string $userId) : array<string|int, array<string|int, mixed>>
Parameters
$userId : string

the userId of the user that we want to get all values from

Tags
psalm-return

array<string, array<string, string>>

since
24.0.0
Return values
array<string|int, array<string|int, mixed>>
  • 2 dimensional array with the following structure: [ $appId => [ $key => $value ] ]

getAppKeys()

Get all keys stored for an app

public getAppKeys(string $appName) : array<string|int, string>
Parameters
$appName : string

the appName that we stored the value under

Tags
since
8.0.0
Return values
array<string|int, string>

the keys stored for the app

getAppValue()

Looks up an app wide defined value

public getAppValue(string $appName, string $key[, string $default = '' ]) : string
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

Tags
since
6.0.0
  • parameter $default was added in 7.0.0
Return values
string

the saved value

getFilteredSystemValue()

Looks up a system wide defined value and filters out sensitive data

public getFilteredSystemValue(string $key[, mixed $default = '' ]) : mixed
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

Tags
since
8.2.0
Return values
mixed

the value or $default

getSystemValue()

Looks up a system wide defined value

public getSystemValue(string $key[, mixed $default = '' ]) : mixed
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

Tags
since
6.0.0
  • parameter $default was added in 7.0.0
Return values
mixed

the value or $default

getSystemValueBool()

Looks up a boolean system wide defined value

public getSystemValueBool(string $key[, bool $default = false ]) : bool
Parameters
$key : string

the key of the value, under which it was saved

$default : bool = false

the default value to be returned if the value isn't set

Tags
since
16.0.0
Return values
bool

the value or $default

getSystemValueInt()

Looks up an integer system wide defined value

public getSystemValueInt(string $key[, int $default = 0 ]) : int
Parameters
$key : string

the key of the value, under which it was saved

$default : int = 0

the default value to be returned if the value isn't set

Tags
since
16.0.0
Return values
int

the value or $default

getSystemValueString()

Looks up a string system wide defined value

public getSystemValueString(string $key[, string $default = '' ]) : string
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

Tags
since
16.0.0
Return values
string

the value or $default

getUserKeys()

Get the keys of all stored by an app for the user

public getUserKeys(string $userId, string $appName) : array<string|int, string>
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

Tags
since
8.0.0
Return values
array<string|int, string>

getUsersForUserValue()

Determines the users that have the given value set for a specific app-key-pair

public getUsersForUserValue(string $appName, string $key, string $value) : array<int, string>
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

Tags
since
31.0.0

return type of list<string>

since
8.0.0
Return values
array<int, string>

of user IDs

getUserValue()

Shortcut for getting a user defined value

public getUserValue(string|null $userId, string $appName, string $key[, mixed $default = '' ]) : string
Parameters
$userId : string|null

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

Tags
since
6.0.0
  • parameter $default was added in 7.0.0
Return values
string

getUserValueForUsers()

Fetches a mapped list of userId -> value, for a specified app and key and a list of user IDs.

public getUserValueForUsers(string $appName, string $key, array<string|int, mixed> $userIds) : array<string|int, mixed>
Parameters
$appName : string

app to get the value for

$key : string

the key to get the value for

$userIds : array<string|int, mixed>

the user IDs to fetch the values for

Tags
since
8.0.0
Return values
array<string|int, mixed>

Mapped values: userId => value

setAppValue()

Writes a new app wide value

public setAppValue(string $appName, string|float|int $key, string $value) : void
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

Tags
since
6.0.0

setSystemValue()

Sets a new system wide value

public setSystemValue(string $key, mixed $value) : mixed
Parameters
$key : string

the key of the value, under which will be saved

$value : mixed

the value that should be stored

Tags
throws
HintException

if config file is read-only

since
8.0.0

setSystemValues()

Sets and deletes system wide values

public setSystemValues(array<string|int, mixed> $configs) : mixed
Parameters
$configs : array<string|int, mixed>

Associative array with key => value pairs If value is null, the config key will be deleted

Tags
throws
HintException

if config file is read-only

since
8.0.0

setUserValue()

Set a user defined value

public setUserValue(string $userId, string $appName, string $key, string $value[, string $preCondition = null ]) : mixed
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 = null

only update if the config value was previously the value passed as $preCondition

Tags
throws
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

        
On this page

Search results