ePages 7.3.0 - DE_EPAGES/WebInterfacePoolDB/API/Object/ASPoolDB.pm

Package DE_EPAGES::WebInterfacePoolDB::API::Object::ASPoolDB

Provides access to the application server pool database.

Example
my $ASPoolDB = DE_EPAGES::WebInterfacePoolDB::API::Object::ASPoolDB->new;
my $hSite = $ASPoolDB->getInfoSiteByURI( 'www.provider.com', '/epages/MyShop.sf' );
my $DatabaseName = $hSite->{'DatabaseName'};

Functions

_findPool
deletePool
deleteSite
deleteStore
disconnect
existsDomainName
existsPool
existsSite
existsStore
getDatabasesByPool
getInfoPool
getInfoSiteByObjectPath
getInfoSiteByURI
getInfoStore
getPoolByDatabase
getSiteByDomainName
insertPool
insertSite
insertStore
invalidateCache
needCacheReset
needsFullCacheReset
new
searchSiteByDomainName
setDatabasePool
setSiteRequest
setSiteRequests
updateSite
updateStore

_findPool

Returns the pool id if the Pool exists, otherwise undef.

Syntax
$PoolID = $ASPoolDB->_findPool($PoolName);
Example
if( $ASPoolDB->existsPool('DefaultPool') ) { ... }
Input
$PoolName (string)
pool name
Return
$PoolID (int)
Pool id if the Pool exists, otherwise undef

deletePool

Deletes the pool by name.

Syntax
$ASPoolDB->deletePool($PoolName);
Input
$PoolName (string)
pool name

deleteSite

Deletes the site.

Syntax
$ASPoolDB->deleteSite($GUID);
Input
$GUID (string)
guid of shop

deleteStore

Deletes a store and all dependent entries.

Syntax
$ASPoolDB->deleteStore($DatabaseName);
Example
$ASPoolDB->deleteStore('Store');
Input
$DatabaseName (string)
database alias, e.g. 'Store'

disconnect

Disconnects the database. It's recommended to use RunOnPoolDB instead of calling disconnect() directly.

Syntax
$ASPoolDB->disconnect;

existsDomainName

Returns true if domainname is used by a different shop.

Syntax
$exists = $ASPoolDB->existsDomainName( $DomainName, $ObjectPath );
Example
$exists = $ASPoolDB->existsDomainName( 'www.epages.de', '/Shops/MyShop' );
Input
$DomainName (string)
domain name
$ObjectPath (string)
path to shop
Return
$exists (boolean)
true if domainname exists in a different shop

existsPool

Returns true if the Pool exists.

Syntax
$Exists = $ASPoolDB->existsPool($PoolName);
Example
if( $ASPoolDB->existsPool('DefaultPool') ) { ... }
Input
$PoolName (string)
pool name
Return
$Exists (boolean)
true if the Pool exists

existsSite

Returns true if a site with the GUID exists.

Syntax
$Exists = $ASPoolDB->existsSite($GUID);
Input
$GUID (string)
guid of shop
Return
$Exists (boolean)
true if the site exists

existsStore

Returns true if the Store exists.

Syntax
$Exists = $ASPoolDB->existsStore($DatabaseName);
Example
if( $ASPoolDB->existsStore('Store') ) { ... }
Input
$DatabaseName (string)
database alias, e.g. 'Store'
Return
$Exists (boolean)
1/0 the Store exists (yes/no)

getDatabasesByPool

Returns the database name of a pool.

Syntax
$DatabaseNames = $ASPoolDB->getDatabasesByPool( $PoolName);
Example
$DatabaseNames = $ASPoolDB->getDatabasesByPool( 'StorePool');
Input
$PoolName (string)
pool name
Return
$DatabaseNames (ref.array.string)
list of databases

getInfoPool

Returns information about a pool.

Syntax
$hPool = $ASPoolDB->getInfoPool($PoolName);
Input
$PoolName (string)
pool name, e.g. 'DefaultPool'
Return
$hPool (reference to hash)
with following keys:
  • PoolID - pool id (primary key)- int
  • Name - pool name - string
  • MaxServersPerSite - maximum number of parallel processes for one site (optional)- int
  • MaxServersPerClient - maximum number of parallel processes for the same client IP (optional)- int
  • MaxMemoryPerServer - maximum memory for each application server (optional)- int

getInfoSiteByObjectPath

Returns the site information for the Store and Objectpath.

Syntax
$hSite = $ASPoolDB->getInfoSiteByObjectPath( $Store, $ObjectPath );
Example
$hSite = $ASPoolDB->getInfoSiteByObjectPath( 'Store', '/Shops/DemoShop' );
Input
$StoreName (string)
Store name
$ObjectPath (string)
object path
Return
$hSite (ref.hash)
  • GUID - site GUID - string
  • ObjectPath - path to site - string

getInfoSiteByURI

Returns the site information for the web server name and URI. Returns undef if the web server name / uri combination is not found.

Syntax
$hSite = $ASPoolDB->getInfoSiteByURI( $HttpHost, $URI );
Example
$hSite = $ASPoolDB->getInfoSiteByURI( 'www.provider.com', '/epages/MyShop.sf' );
$hSite = $ASPoolDB->getInfoSiteByURI( 'www.provider.com', '/epages/MyShop.' );
Input
$HttpHost (string)
Web server name
$URI (string)
request URI
Return
$hSite (ref.hash)
  • PoolName - pool name - string
  • StoreName - database alias - string
  • GUID - site GUID - string
  • ObjectPath - path to site - string

getInfoStore

Returns information about a store.

Syntax
$hStore = $ASPoolDB->getInfoStore($DatabaseName);
Example
$hStore = $ASPoolDB->getInfoStore('Store');
Input
$DatabaseName (string)
database alias, e.g. 'Store'
Return
$hStore (reference to hash)
with following keys:
  • StoreID - store database id (primary key)- int
  • PoolID - pool id - int
  • Name - store database alias - varchar(255)

getPoolByDatabase

Returns the pool name of a database. Returns 'DefaultPool' if the database is not explicitely assigned to a pool.

Syntax
$PoolName = $ASPoolDB->getPoolByDatabase( $DatabaseName);
Example
$PoolName = $ASPoolDB->getPoolByDatabase( 'Store');
Input
$DatabaseName (string)
name of database
Return
$PoolName (string)
pool name

getSiteByDomainName

Returns the site that is the owner of the given domain. Returns undef if the domain does not exist or if the owner is NULL.

Syntax
$hSite = $ASPoolDB->getSiteByDomainName( $DomainName );
Example
$hSite = $ASPoolDB->getSiteByDomainName( 'www.epages.de' );
Input
$DomainName (string)
domain name
Return
$hInfo (ref.hash.string)
site info
  • StoreAlias - database alias - string
  • ObjectPath - object path in this database - string

insertPool

Adds a new pool.

Syntax
$PoolID = $ASPoolDB->insertPool($PoolName);
Input
$PoolName (string)
pool name
Return
$PoolID (int)
Pool id of the new pool

insertSite

Inserts a site. Updates the GUID of the site if the $DatabaseName/$ObjectPath combination already exists.

Syntax
$ASPoolDB->insertSite($DatabaseName, $GUID, $ObjectPath);
Example
$ASPoolDB->insertSite('Store', 'E882746E-56EA-4EA7-B36E-B9299C648A34', '/Shops/DemoShop');
Input
$DatabaseName (string)
database alias, e.g. 'Store'
$GUID (string)
Shop GUID
$ObjectPath (string)
object path within the database $DatabaseName

insertStore

Inserts a store.

Syntax
$ASPoolDB->insertStore($DatabaseName, $GUID);
Example
$ASPoolDB->insertStore('Store', 'E882746E-56EA-4EA7-B36E-B9299C648A34');
Input
$DatabaseName (string)
database alias, e.g. 'Store'
$GUID (string)
system GUID

invalidateCache

Marks the site GUID as invalid in the ASPoolDBCacheServer.

Syntax
$CacheResetRequired = $ASPoolDB->invalidateCache( $GUID );
Input
$GUID (string)
site GUID

needCacheReset

Returns the GUIDs of sites that the ASPoolDB cache server should delete from its cache.

Syntax
$aSiteGUIDs = $ASPoolDB->needCacheReset
Return
$aSiteGUIDs (ref.array.string)
list of sites that need to be refreshed in cache

needsFullCacheReset

Returns true if the ASPoolDB cache server should reset its complete cache.

Syntax
$Reset = $ASPoolDB->needsFullCacheReset
Return
$Reset (ref.array.string)
true

new

Connects to the application server pool database.

Syntax
$ASPoolDB = DE_EPAGES::WebInterfacePoolDB::API::Object::ASPoolDB->new;
Return
$ASPoolDB (object)
ASPoolDB object

searchSiteByDomainName

Returns the sites corresponding a given domain pattern. Returns undef if no site corresponds to this pattern.

Syntax
$ahSites = $ASPoolDB->searchSiteByDomainName( $Pattern );
Example
$ahSites = $ASPoolDB->searchSiteByDomainName( 'www.epages.de' );
$ahSites = $ASPoolDB->searchSiteByDomainName( '%ep_g%de' );
Input
$Pattern (string)
domain name patterm
Return
$ahSites (ref.array.hash.string)
site info
  • StoreAlias - database alias - string
  • ObjectPath - object path in this database - string
  • PoolName - database pool name - string
  • GUID - sites GUID - string

setDatabasePool

Sets the pool for a database.

Syntax
$ASPoolDB->setDatabasePool($DatabaseName, $PoolName);
Example
$ASPoolDB->setDatabasePool('Store', 'StorePool');
Input
$DatabaseName (string)
name of database
$PoolName (string)
pool name

setSiteRequest

set domain and uri for site.

Syntax
$ASPoolDB->setSiteRequest($DatabaseName, $ObjectPath, $Host, $URI );
Example
$ASPoolDB->setSiteRequest('Store', '/Shops/DemoShop', 'www.provider.com', '/epages/MyShop.sf');
Input
$DatabaseName (string)
name of database of site (shop, system)
$ObjectPath (string)
path to site (shop, system)
$Host (string)
Web server name
$URI (string)
request URI

setSiteRequests

set domain and uri for site.

Syntax
$ASPoolDB->setSiteRequests($DatabaseName, $ObjectPath, $ahEntries);
Example
$ASPoolDB->setSiteRequests('Store', '/Shops/DemoShop', [{
    'Host'=>'www.provider.com',
    'URI'=>'/epages/MyShop.'
}]);
Input
$DatabaseName (string)
name of database of site (shop, system)
$ObjectPath (string)
path to site (shop, system)
$aEntries (ref.array.hash)
keys:
  • Host - Web server name - string
  • URI - request uri without extension - string
  • updateSite

    Updates the site.

    Syntax
    $ASPoolDB->updateSite($GUID, $hValues);
    Input
    $GUID (string)
    guid of shop
    $hValues (string)
    columns to update
    • StoreID - database id (in ASPoolDB) - int
    • ObjectPath - object path in the database - string
    • MaxServers - maximum number of application servers per site

    updateStore

    Updates a store.

    Syntax
    $ASPoolDB->updateStore($DatabaseName, $hStore);
    Example
    $ASPoolDB->updateStore('Store', { PoolID => $PoolID });
    Input
    $DatabaseName (string)
    database alias, e.g. 'Store'
    $hStore (reference to hash)
    with following keys:
    • PoolID - pool id - int
    • Name - store database alias - varchar(255)