openmediavault  4.0 (Arrakis)
The open network attached storage solution
Public Member Functions | Static Public Member Functions | List of all members
OMV\Config\Database Class Reference

Public Member Functions

 getBackend ()
 
 get ($id, $uuid=NULL)
 
 getAssoc ($id, $uuid=NULL)
 
 getByFilter ($id, $filter, $maxResult=NULL)
 
 getByFilterAssoc ($id, $filter, $maxResult=NULL)
 
 set (ConfigObject &$object, $quiet=FALSE)
 
 delete (ConfigObject $object, $quiet=FALSE)
 
 deleteByFilter ($id, $filter, $quiet=FALSE)
 
 isReferenced (ConfigObject $object)
 
 assertIsReferenced (ConfigObject $object)
 
 assertIsNotReferenced (ConfigObject $object)
 
 exists ($id, $filter=NULL)
 
 isUnique (ConfigObject $object, $property)
 
 isUniqueByFilter (ConfigObject $object, $filter)
 
 assertIsUnique (ConfigObject $object, $property)
 
 assertIsUniqueByFilter (ConfigObject $object, $filter)
 
 unlinkRevisions ()
 
 revert ($filename)
 

Static Public Member Functions

static & getInstance ()
 

Member Function Documentation

◆ assertIsNotReferenced()

OMV\Config\Database::assertIsNotReferenced ( ConfigObject  $object)

Assert that the specified configuration object is not referenced.

Parameters
objectThe configuration object to use.
Returns
None.
Exceptions

◆ assertIsReferenced()

OMV\Config\Database::assertIsReferenced ( ConfigObject  $object)

Assert that the specified configuration object is referenced.

Parameters
objectThe configuration object to use.
Returns
None.
Exceptions

◆ assertIsUnique()

OMV\Config\Database::assertIsUnique ( ConfigObject  $object,
  $property 
)

Assert that a configuration object with the value of the specified property is unique.

Parameters
objectThe configuration object to use.
propertyThe name of the data model property.
Returns
None.
Exceptions

◆ assertIsUniqueByFilter()

OMV\Config\Database::assertIsUniqueByFilter ( ConfigObject  $object,
  $filter 
)

Assert that a configuration object with the specified constraints is unique.

Parameters
objectThe configuration object to use.
filterA filter specifying constraints on the objects to check.
Returns
None.
Exceptions

◆ delete()

OMV\Config\Database::delete ( ConfigObject  $object,
  $quiet = FALSE 
)

Delete the specified configuration object.

Parameters
objectThe configuration object to use.
quietIf set to TRUE, then no notification message is send. Defaults to FALSE.
Returns
None.
Exceptions

◆ deleteByFilter()

OMV\Config\Database::deleteByFilter (   $id,
  $filter,
  $quiet = FALSE 
)

Delete a configuration object with the specified constraints.

Parameters
idThe data model identifier.
filterA filter specifying constraints on the objects to retrieve.
Example 1:
[
"operator" => "not",
"arg0" => [
"operator" => "or",
"arg0" => [
"operator" => "contains",
"arg0" => "opts",
"arg1" => "bind"
],
"arg1" => [
"operator" => "contains",
"arg0" => "opts",
"arg1" => "loop"
]
]
]
Example 2:
[
"operator" => "or",
"arg0" => [
"operator" => "stringEquals",
"arg0" => "devicefile",
"arg1" => "/dev/sda"
],
"arg1" => [
"operator" => "stringEquals",
"arg0" => "devicefile",
"arg1" => "/dev/disk/by-id/ata-ST1000DM003-1CH132_S2DF80PC"
]
]
quietIf set to TRUE, then no notification message is send. Defaults to FALSE.
Returns
None.
Exceptions

◆ exists()

OMV\Config\Database::exists (   $id,
  $filter = NULL 
)

Check if on or more configuration object of the specified data model exists.

Parameters
idThe data model identifier.
filterA filter specifying constraints on the objects to retrieve. Defaults to NULL.
Example:
[
"operator": "not",
"arg0": [
"operator" => "stringEquals",
"arg0" => "type",
"arg1" => "vlan"
]
]
Returns
TRUE if at least one configuration object exists, otherwise FALSE.

◆ get()

OMV\Config\Database::get (   $id,
  $uuid = NULL 
)

Get the specified configuration object.

Parameters
idThe data model identifier, e.g. 'conf.service.ftp'.
uuidThe UUID of an configuration object. Defaults to NULL.
Returns
Depending on the configuration object and whether uuid is set, an array of configuration objects or a single object is returned.
Exceptions

◆ getBackend()

OMV\Config\Database::getBackend ( )

Get the object that implements the database backend.

Returns
The singleton object.

◆ getByFilter()

OMV\Config\Database::getByFilter (   $id,
  $filter,
  $maxResult = NULL 
)

Get the iterable configuration objects that are matching the specified constraints.

Parameters
idThe data model identifier.
filterA filter specifying constraints on the objects to retrieve.
Example 1:
[
"operator" => "stringEquals",
"arg0" => "fsname",
"arg1" => $params['id']
]
Example 2:
[
"operator": "and",
"arg0": [
"operator" => "stringEquals",
"arg0" => "type",
"arg1" => "bond"
],
"arg1": [
"operator" => "stringEquals",
"arg0" => "devicename",
"arg1" => "bond0"
]
]
maxResultThe maximum number of objects that are returned. Defaults to NULL.
Returns
An array containing the requested configuration objects. If maxResult is set to 1, then the first found object is returned. In this case the method does not return an array of configuration objects.
Exceptions

◆ getInstance()

static& OMV\Config\Database::getInstance ( )
static

Returns the configuration database singleton.

Returns
The singleton object.

◆ isReferenced()

OMV\Config\Database::isReferenced ( ConfigObject  $object)

Check if the specified object is referenced.

Parameters
objectThe configuration object to use.
Returns
TRUE if the object is referenced, otherwise FALSE.

◆ isUnique()

OMV\Config\Database::isUnique ( ConfigObject  $object,
  $property 
)

Check if a configuration object with the value of the specified property is unique.

Parameters
objectThe configuration object to use.
propertyThe name of the data model property.
Returns
TRUE if no configuration object with the same property value exists, otherwise FALSE.

◆ isUniqueByFilter()

OMV\Config\Database::isUniqueByFilter ( ConfigObject  $object,
  $filter 
)

Check if a configuration object with the specified constraints is unique.

Parameters
objectThe configuration object to use.
filterA filter specifying constraints on the objects to retrieve.
Example:
[
"operator" => "stringEquals",
"arg0" => "sharename",
"arg1" => "Movies"
]
Returns
TRUE if no configuration object with the same property values (specified by the filter) exists, otherwise FALSE.

◆ revert()

OMV\Config\Database::revert (   $filename)

Revert changes. All existing revision files will be deleted.

Parameters
filenameThe revision file. Defaults to NONE.
Returns
None.

◆ set()

OMV\Config\Database::set ( ConfigObject $object,
  $quiet = FALSE 
)

Set the configuration object at the specified XPath expression. If the configuration object is iterable and identified as new, then the identifier property (in most cases 'uuid') will be generated and set automatically.

Parameters
objectThe configuration object to use.
quietIf set to TRUE, then no notification message is send. Defaults to FALSE.
Returns
None.
Exceptions

◆ unlinkRevisions()

OMV\Config\Database::unlinkRevisions ( )

Unlink all revision files.

Returns
TRUE if successful, otherwise FALSE.

The documentation for this class was generated from the following file: