Pgsql_Module

PostgreSQL operations
extends Module\Support\Sql
Methods Summary
public
# __construct( )
{{{ void __construct(void)

ignore


Overrides

public
public
# user_exists( string $user , string $host = 'localhost' )
Verify if PostgreSQL user exists
public
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_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
# 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( string $db , string $extension )
Enable extension on database
protected
# _getPermittedExtensions( )
Extensions permitted on database
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
# list_users( )
array list_users () Lists all created users for PostgreSQL
public
# set_privileges( string $user , string $host , string $db , array $privileges )
Assign privileges for database to user
public
# change_owner( string $db , string $newowner )
Change database owner
public
# get_owner( string $database )
Get owner from database
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
# set_password( $password )
public
# vacuum( $db )
string pg_vacuum_db (string) Vacuums a database
public
# vacuum_backend( $db )
public
public
# add_user( $user , $password , $maxconn = 20 )
bool add_user(string, string[, int])
public
# version( $pretty = false )
public
# empty( $db )
Database is empty
public
# empty_database( $db )
public
# import( $db , $file )
bool pgsql_import(string, string, string, strin)
public
# export( $db , $file = NULL )
public
# get_database_size( string $db )
Get disk space occupied by database
public
# clone( string $from , string $to )
Clone a database
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
renameDatabasePrefix(), renameDatabasePrefixByType(), pedantize(), renameUserPrefix(), renameUser(), renameUserPrefixByType(), renameUserByType(), installDatabaseService(), uninstallDatabaseService(), _register_temp_user(), _connect_root(), _get_elevated_password(), add_backup_real(), svc_enabled(), edit_backup_real(), list_backups_real(), get_backup_config_real(), delete_backup_real(), _escape(), _preImport(), _postImport()
Methods inherited from Module\Skeleton\Standard
__construct(), setUserParameters(), autoloadModule(), __wakeup(), _invoke(), __debugInfo(), getExportedFunctions(), _reset(), cleanUserParameters(), query()
Constants Summary
public array DEPENDENCY_MAP
# array ( 0 => 'siteinfo', 1 => 'diskquota', )
public int IDENTIFIER_MAXLEN
# 63
public string PG_TEMP_PASSWORD
# '23f!eoj3'
public string PGSQL_DATADIR
# '/var/lib/pgsql'
public int PER_DATABASE_CONNECTION_LIMIT
# 20
public string MASTER_USER
# 'root'
protected array PGSQL_PERMITTED_EXTENSIONS
# array ( 0 => 'pg_trgm', 1 => 'hstore', 2 => 'pgcrypto', )
Constants inherited from Module\Support\Sql
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