2018-03-24 19:39:13 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
|
|
* To change this template file, choose Tools | Templates
|
|
|
|
* and open the template in the editor.
|
|
|
|
*/
|
|
|
|
|
2019-02-10 19:52:21 +01:00
|
|
|
namespace Friendica\Core\Config\Adapter;
|
2018-03-24 19:39:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @author benlo
|
|
|
|
*/
|
|
|
|
interface IPConfigAdapter
|
|
|
|
{
|
|
|
|
/**
|
2019-02-11 23:45:08 +01:00
|
|
|
* Loads all configuration values of a user's config family and returns the loaded category as an array.
|
2018-03-24 19:39:13 +01:00
|
|
|
*
|
|
|
|
* @param string $uid The user_id
|
|
|
|
* @param string $cat The category of the configuration value
|
|
|
|
*
|
2019-02-10 19:52:21 +01:00
|
|
|
* @return array
|
2018-03-24 19:39:13 +01:00
|
|
|
*/
|
|
|
|
public function load($uid, $cat);
|
|
|
|
|
|
|
|
/**
|
2019-02-05 23:42:49 +01:00
|
|
|
* Get a particular user's config variable given the category name
|
2018-03-24 19:39:13 +01:00
|
|
|
* ($family) and a key.
|
|
|
|
*
|
|
|
|
* @param string $uid The user_id
|
|
|
|
* @param string $cat The category of the configuration value
|
2019-02-10 19:52:21 +01:00
|
|
|
* @param string $key The configuration key to query
|
2018-03-24 19:39:13 +01:00
|
|
|
*
|
2019-02-10 19:52:21 +01:00
|
|
|
* @return mixed Stored value or "!<unset>!" if it does not exist
|
2018-03-24 19:39:13 +01:00
|
|
|
*/
|
2019-02-10 19:52:21 +01:00
|
|
|
public function get($uid, $cat, $key);
|
2018-03-24 19:39:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Stores a config value ($value) in the category ($family) under the key ($key)
|
|
|
|
* for the user_id $uid.
|
|
|
|
*
|
|
|
|
* @note Please do not store booleans - convert to 0/1 integer values!
|
|
|
|
*
|
|
|
|
* @param string $uid The user_id
|
|
|
|
* @param string $cat The category of the configuration value
|
2019-02-10 19:52:21 +01:00
|
|
|
* @param string $key The configuration key to set
|
2018-03-24 19:39:13 +01:00
|
|
|
* @param string $value The value to store
|
|
|
|
*
|
2018-07-18 08:32:35 +02:00
|
|
|
* @return bool Operation success
|
2018-03-24 19:39:13 +01:00
|
|
|
*/
|
2019-02-10 19:52:21 +01:00
|
|
|
public function set($uid, $cat, $key, $value);
|
2018-03-24 19:39:13 +01:00
|
|
|
|
|
|
|
/**
|
2019-02-05 23:42:49 +01:00
|
|
|
* Removes the configured value from the stored cache
|
2018-03-24 19:39:13 +01:00
|
|
|
* and removes it from the database.
|
|
|
|
*
|
|
|
|
* @param string $uid The user_id
|
|
|
|
* @param string $cat The category of the configuration value
|
2019-02-10 19:52:21 +01:00
|
|
|
* @param string $key The configuration key to delete
|
2018-03-24 19:39:13 +01:00
|
|
|
*
|
2019-02-10 19:52:21 +01:00
|
|
|
* @return bool
|
2018-03-24 19:39:13 +01:00
|
|
|
*/
|
2019-02-10 19:52:21 +01:00
|
|
|
public function delete($uid, $cat, $key);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks, if the current adapter is connected to the backend
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function isConnected();
|
2019-02-11 21:36:26 +01:00
|
|
|
|
|
|
|
/**
|
2019-02-11 23:45:08 +01:00
|
|
|
* Checks, if a config key ($key) in the category ($cat) is already loaded for the user_id $uid.
|
2019-02-11 21:36:26 +01:00
|
|
|
*
|
|
|
|
* @param string $uid The user_id
|
|
|
|
* @param string $cat The configuration category
|
|
|
|
* @param string $key The configuration key
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function isLoaded($uid, $cat, $key);
|
2018-03-24 19:39:13 +01:00
|
|
|
}
|