Mysql_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
# user_exists( $user , $host = 'localhost' )
public
public
# delete_user( string $user , string $host , string $cascade = true )
bool delete_mysql_user(string, string[, bool = false]) Delete a MySQL user
public
# store_password( string $sqlpasswd )
bool store_sql_password (string, string)
public
# set_option( string $option , string $value = NULL, string $group = 'client' )
Set MySQL client option Reads from ~/.my.cnf and creates if necessary. Specify a value of null to remove an option.
public
# get_password( )
string retrieve_sql_password (string)
public
# get_option( string $option , string $group = 'client' )
Get option from MySQL client/server configuration
public
public
# import( string $db , string $file )
Import a database from a dump

see

public
# list_databases( )
array list_mysql_databases () Queries the db table in the mysql database for applicable grants
public
# change_prefix( string $prefix )
Change account database prefix
public
public
# list_users( )
array list_mysql_users () Lists all created users for MySQL
public
# add_user( $user , $host , $password , int $maxconn = 10, int $maxupdates = 0, int $maxquery = 0, string $ssl = '', string $cipher = '', string $issuer = '', string $subject = '' )
bool add_mysql_user(string, string, string[, int[, int[, int[, string[, string[, string[, string]]]]]]])
public
public
# create_database( string $db , string $charset = 'latin1', string $collation = 'latin1_swedish_ci' )
Create a new mysql database
public
# charset_valid( $charset )
public
public
# collation_valid( string $collation )
Validate collation name
public
public
# collation_compatible( string $collation , string $charset )
Verify collation + charset combination are compatible
public
# database_exists( string $db )
Query information_schema for existence of MySQL database
public
# create_database_backend( $db , $charset , $collation )
bool create_mysql_database_backend (string) {@link create_mysql_database}
public
# add_user_permissions( string $user , string $host , string $db , array $opts )
bool add_mysql_user_permissions (string, string, string, array)

Deprecated


see

public
# set_privileges( string $user , string $host , string $db , array $privileges )
Set grants for a MySQL user
public
# delete_user_permissions( $user , $host , $db )
public
# revoke_privileges( string $user , string $host , string $db )
Revoke all privileges on a database from a MySQL user
public
# get_user_permissions( $user , $host , $db )
public
# get_privileges( string $user , string $host , string $db )
Get MySQL grants for a user on a database
public
# version( $pretty = false )
Returns the version of the MySQL server as an integer The form of this version number is main_version * 10000 + minor_version * 100 + sub_version (i.e. version 4.1.0 is 40100)
public
# delete_database( string $db )
Delete MySQL database from system
public
# delete_backup( string $db )
Remove MySQL Backup
public
# assert_permissions( )
Ensure that /var/lib/mysql/ has mysql:<group id> ownership
public
public
# edit_user( string $user , string $host , array $opts )
bool edit_mysql_user(string, string, array) Note when calling through SOAP, all options must be given, otherwise the will default to server preferences.
public
# service_enabled( )
bool service_enabled (string) Checks to see if a service is enabled

Deprecated


see

public
# enabled( )
MySQL/PostgreSQL service enabled on account Checks to see if either MySQL or PostgreSQL is enabled on an account
public
public
# empty_database( $db )
public
# export( string $db , string|null $file = NULL )
Export a MySQL database
public
# get_database_size( string $db )
Get disk space occupied by database
public
# export_pipe( $db )
Export a db to a named pipe for immediate download
public
# export_pipe_real( $db , $user )
Export a 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_mysql_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
public
# kill( int $id )
Kill a mysql connection

link

public
# get_processlist( )
Get active mysql connections Array ( [0] => Array ( [id] => 11024 [user] => debug [host] => localhost [db] => debug [command] => Query [state] => User sleep [info] => select sleep(1000) ) )
public
# schema_column_maxlen( string $field )
Get max length of a column in mysql schema
public
# _delete( )
public
# _create( )
public
# _edit( )
public
# _verify_conf( Opcenter\Service\ConfigurationContext $ctx )
public
# _create_user( string $user )
public
# _delete_user( string $user )
public
# _edit_user( string $userold , string $usernew , array $oldpwd )
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 int MYSQL_USER_FIELD_SIZE
# 16
public string MYSQL_DATADIR
# '/var/lib/mysql'
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