ePages 6.12.0 - DE_EPAGES/Database/API/Config.pm

Package DE_EPAGES::Database::API::Config

This module contains access function to read Database.d/$Store.conf.

@EXPORT_OK
StoreConnections
StoreType
StoreTypes
DatabaseConfig
DatabaseConfigFileName
DatabaseConnectionData
DatabaseBackupData
DatabaseRedirect

Functions

DatabaseBackupData
DatabaseConfig
DatabaseConfigFileName
DatabaseConnectionData
DatabaseRedirect
StoreConnections
StoreType
StoreTypes

DatabaseBackupData

Gets database backup info from Database.d/$BackupStore.conf. Passwords are decrypted transparently.

Syntax
$hSection = DatabaseBackupData($Store, $BackupStore);
Example
$hSection = DatabaseBackupData('Store', 'Backup');
Input
$Store (string)
logical database name
$BackupStore (string)
database backup connection (optional)
Return
$hSection (ref.hash.string)
connection info keys, e.g.:
  • datasource - dbd connection string - string
  • login - database login name - string
  • passwd - database password (not encrypted)- string

DatabaseConfig

get ini object of the Database.d/$Store.conf

Syntax
$IniConfig = DatabaseConfig($Store);
Input
$Store (string)
logical database name
Return
$IniConfig (object)
config object

DatabaseConfigFileName

get full file name of the Database.d/$Store.conf

Syntax
$ConfigFileName= DatabaseConfigFileName($Store);
Input
$Store (string)
logical database name
Return
$ConfigFileName (string)
file name

DatabaseConnectionData

Gets database info from Database.d/$Store.conf. Throws an error if the section does not exists. Passwords are decrypted transparently.

Syntax
$hSection = DatabaseConnectionData($Store);
Example
$hSection = DatabaseConnectionData('Store');
Input
$Store (string)
logical database name
Return
$hSection (ref.hash.string)
connection info keys, e.g.:
  • datasource - dbd connection string - string
  • login - database login name - string
  • passwd - database password (not encrypted)- string

DatabaseRedirect

Get database redirect file from Database.d/$Store.conf, section $Store, key "redirect", except if $RemoteAddr matches the list of exceptions specified by key "AllowFrom". If $FileName is defined, the content of the file "$ENV{'EPAGES_WEBROOT'}/$FileName" shall be returned the client and no database connection shall be opened.

Syntax
$FileName = DatabaseRedirect($Store);
$FileName = DatabaseRedirect($Store, $ConnectionName, $RemoteAddr);
Input
$Store (string)
logical database name
$ConnectionName (string)
unused | string
§RemoteAddr $RemoteAddr | (optional) comma-separated list of IP addresses for which
access is granted anyway
Return
$FileName (string)
file name (relative to $EPAGES_WEBROOT), undef if
no redirect is required

StoreConnections

get all connections that have config file Database.d/$Store.conf

Syntax
$aStoreConnections = StoreConnections();
Return
$aStoreConnections (ref.array)
list of basenames from Database.d

StoreType

Returns the store type of a store

Syntax
$StoreType = StoreType( $Store );
Input
$Store (string)
logical database name
Return
$StoreType (ref.array)
list of basenames from Database.d

StoreTypes

Returns a list of all store types

Syntax
$aStoreTypes = StoreTypes();
Return
$aStoreConnections (ref.array)
list of basenames from Database.d