Pgsql_Module

+------------------------------------------------------------+ | apnscp | +------------------------------------------------------------+ | Copyright (c) Apis Networks | +------------------------------------------------------------+ | Licensed under Artistic License 2.0 | +------------------------------------------------------------+ | Author: Matt Saladna (msaladna@apisnetworks.com) | +------------------------------------------------------------+
extends Module_Support_Sql
Methods Summary
public
# __construct( )
{{{ void __construct(void)

ignore


Overrides

public
public
public
# user_exists( $user , string $host = 'localhost' )
Verify if PostgreSQL user exists
public
# delete_user( string $user , bool $cascade = false )
bool delete_user(string[, bool = false]) Delete a PostgreSQL user
public
# get_tablespace( )
Get tablespace name for domain
public
# site_from_tablespace( string $tblspace )
Get site from tablespace
public
# set_password( $password )
public
# set_username( $user )
public
# get_password( $user = NULL )
public
public
# change_prefix( string $prefix )
Change account database prefix
public
public
# service_enabled( )
bool service_enabled (string) Checks to see if a service is enabled

Deprecated


public
# enabled( )
MySQL/PostgreSQL service enabled on account Checks to see if either MySQL or PostgreSQL is enabled on an account
public
# add_user( $user , $password , $maxconn = 10 )
bool add_user(string, string[, int])
public
# create_database( string $db )
bool create_database (string)
public
# database_exists( string $db )
Query PostgreSQL system table for existence of database
public
# prep_tablespace( )
void prep_tablespace () Checks to see if tablespace exists, if not, creates it

private


public
# add_extension( $db , $extension )
public
# list_databases( )
array list_databases () Queries the db table in the pgsql database for applicable grants
public
# set_owner( string $db , string $owner )
Set database owner
public
# set_privileges( string $user , string $host , string $db , array $privileges )
Assign privileges for database to user
public
# prep_tablespace_backend( string $location )
void prep_tablespace_backend () {@link prep_tablespace}
public
# add_user_permissions( string $user , string $db , array $opts )
bool add_user_permissions (string, string, string, array) Add/removes privileges for a user to a table, any value listed as false or not supplied as an array key will revoke the privilege
public
# delete_user_permissions( $user , $db )
public
# get_user_permissions( $user , $db )
void get_user_permissions(string, string) Function not implemented in PostgreSQL
public
# delete_database( string $db )
bool delete_database(string) Drops the database and revokes all permssions
public
# delete_backup( string $db )
Remove PostgreSQL Backup
public
# edit_user( string $user , string $password , int $maxconn = NULL )
Modify use password and connection limit NOTE: Not implemented with PostgreSQL, owner of database automatically receives grants. Varying degrees of grants impact the usability of this function, i.e. common grants [SELECT, INSERT, UPDATE, DELETE] exist solely on the table level, while [CREATE, TEMP] exist on the database level
public
public
# list_users( )
array list_users () Lists all created users for PostgreSQL
public
# vacuum( $db )
string pg_vacuum_db (string) Vacuums a database
public
# vacuum_backend( $db )
public
public
# version( $pretty = false )
public
# empty_database( $db )
public
# import( $db , $file )
bool pgsql_import(string, string, string, strin)
public
# get_database_size( string $db )
Get disk space occupied by database
public
# export( $db , $file = NULL )
public
# export_pipe( $db )
Export a PGSQL db to a named pipe for immediate download
public
# export_pipe_real( $db , $user )
Export a PGSQL database to a named pipe Differs from export_pipe in that it may only be called internally or from backend, no API access
public
# get_uptime( )
int get_uptime
public
# add_backup( $db , $extension = 'zip', $span = 5, $preserve = '0', $email = '' )
public
# edit_backup( $db , $extension , $span = '0', $preserve = '0', $email = '' )
public
public
# get_backup_config( string $db )
Fetch MySQL backup task information span => (integer) days between backups hold => (integer) number of backups to preserve next => (integer) unix timestamp of next backup ext => (string) extension of backup email => (string) notify address after backup
public
# _delete( )
public
# _create( )
public
# _edit_user( string $userold , string $usernew , array $oldpwd )
public
# _edit( )
public
# _verify_conf( Opcenter\Service\ConfigurationContext $ctx )
public
# _create_user( string $user )
public
# _delete_user( string $user )
Methods inherited from Module_Support_Sql
pedantize(), renameDatabasePrefix(), renameDatabasePrefixByType(), renameUserPrefix(), renameUser(), renameUserByType(), renameUserPrefixByType(), installDatabaseService(), uninstallDatabaseService(), _register_temp_user(), _connect_root(), _get_elevated_password(), add_backup_real(), svc_enabled(), edit_backup_real(), list_backups_real(), delete_backup_real(), get_backup_config_real(), _escape(), _preImport(), _postImport()
Methods inherited from Module\Skeleton\Standard
__construct(), __wakeup(), autoloadModule(), setUserParameters(), cleanUserParameters(), setSessionId(), _invoke(), __debugInfo(), getExportedFunctions(), _reset(), getServices(), getNewServices(), getActiveServices(), getConfig(), getServiceValue(), setConfigJournal(), setConfig(), query(), _resetModule()
Constants Summary
public array DEPENDENCY_MAP
# array ( 0 => 'siteinfo', )
public string PG_TEMP_PASSWORD
# '23f!eoj3'
public string PGSQL_DATADIR
# '/var/lib/pgsql'
public string MASTER_USER
# 'root'
protected array PGSQL_PERMITTED_EXTENSIONS
# array ( 0 => 'pg_trgm', 1 => 'hstore', )
Constants inherited from Module_Support_Sql
PER_DATABASE_CONNECTION_LIMIT , DEFAULT_CONCURRENCY_LIMIT , MIN_PASSWORD_LENGTH , MIN_PREFIX_LENGTH , MASTER_USER , DB_BIN2TXT_MULT
Constants inherited from Module\Skeleton\Standard
DEPENDENCY_MAP
Properties inherited from Module_Support_Sql
$_tempUsers
Properties inherited from Module\Skeleton\Standard
$exportedFunctions, $username, $password, $domain, $user_id, $group_id, $permission_level, $session_id, $site, $site_id, $pgsql, $mysql