ePages 6.13.2 - 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
StoreTypesWithCartridge
BUStoreTypes
ShopStoreTypes
SiteStoreTypes
BusinessUnits
DatabaseConfig
DatabaseConfigFileName
DatabaseConnectionData
DatabaseBackupData
DatabaseRedirect

Functions

BUStoreTypes
BusinessUnits
DatabaseBackupData
DatabaseConfig
DatabaseConfigFileName
DatabaseConnectionData
DatabaseRedirect
ShopStoreTypes
SiteStoreTypes
StoreConnections
StoreType
StoreTypes
StoreTypesWithCartridge

BUStoreTypes

Returns a list of all store types that have a business unit

Syntax
$aStoreTypes = BUStoreTypes();
Return
$aStoreTypes (ref.array)
list of list store types

BusinessUnits

Gets a hash of store information from Database.d/*.conf for all stores with parameters StoreType, Database, datasource and datasource =~ /mysql/ and Database !~ /mysql/

Syntax
$StoreConf = BusinessUnits();
Return
$StoreConf (ref.hash)
hash of store information

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, $hFlags);
Example
$hSection = DatabaseConnectionData('Store');
Input
$Store (string)
logical database name
$hFlags (ref.hash)
flags that change the behavior of DatabaseConnectionData:
  • incomplete - if true, do not throw error if $Store.conf is incomplete
Return
$hSection (ref.hash.string)
connection info keys, e.g.:
  • datasource - complete DBI 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

ShopStoreTypes

Returns a list of store types that have cartridge "DE_EPAGES::Shop".

Syntax
$aStoreTypeList = ShopStoreTypes();
Return
$aStoreTypeList (ref.array)
list of store types

SiteStoreTypes

Returns a list of site store (currently only a dummy)

Syntax
$aStoreTypeList = SiteStoreTypes();
Return
$aStoreTypeList (ref.array)
list of store types

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 (string)
store type of $Store

StoreTypes

Returns a list of all store types that have at least 1 store

Syntax
$aStoreTypes = StoreTypes();
Return
$aStoreTypes (ref.array)
list of list store types

StoreTypesWithCartridge

Returns a list of store types that have cartridge $CartridgeName and at least 1 store using the store type or config file in StoreTypes.d/.

Syntax
$aStoreTypeList = StoreTypesWithCartridge($CartridgeName);
Example
$aStoreTypeList = StoreTypesWithCartridge('DE_EPAGES::Shop');
Input
$CartridgeName (string)
name of a cartridge
Return
$aStoreTypeList (ref.array)
list of store types