Alternc
latest
Alternc logiel libre pour l'hébergement
|
Public Member Functions | |
__construct () | |
Constructor m_mysql([$mid]) Constructeur de la classe m_mysql, initialise le membre concerne. More... | |
reload_dbus () | |
list_db_servers () | |
hook_menu () | |
alternc_password_policy () | |
Password kind used in this class (hook for admin class) More... | |
get_dblist () | |
Get the list of the database for the current user. More... | |
php_myadmin_connect () | |
Get the login and password of the special user able to connect to phpmyadmin. More... | |
get_mysql_details ($dbn) | |
Returns the details of a user's database. More... | |
add_db ($dbn) | |
Create a new database for the current user. More... | |
del_db ($dbname) | |
Delete a database for the current user. More... | |
put_mysql_backup ($dbn, $bck_mode, $bck_history, $bck_gzip, $bck_dir) | |
Set the backup parameters for the database $db. More... | |
put_mysql_details ($password) | |
Change the password of the user in MySQL. More... | |
grant ($base, $user, $rights=null, $pass=null, $table=' *') | |
Function used to grant SQL rights to users: @base :database @user : database user @rights : rights to apply ( optional, every rights apply given if missing @pass : user password ( optional, if not given the pass stays the same, else it takes the new value ) @table : sql tables to apply rights. More... | |
restore ($file, $stdout, $id) | |
Restore a sql database. More... | |
get_db_size ($dbname) | |
Get the size of a database. More... | |
get_userslist ($all=null) | |
Returns the list of database users of an account. More... | |
get_defaultsparam ($dbn) | |
add_user ($usern, $password, $passconf) | |
Create a new user in MySQL rights tables. More... | |
change_user_password ($usern, $password, $passconf) | |
Change a user's MySQL password. More... | |
del_user ($user, $all=false, $caller_is_deldb=false) | |
Delete a user in MySQL rights tables. More... | |
get_user_dblist ($user) | |
Return the list of the database rights of user $user. More... | |
set_user_rights ($user, $dbn, $rights) | |
Set the access rights of user $user to database $dbn to be rights $rights. More... | |
available_sql_rights () | |
list of all possible SQL rights More... | |
hook_lxc_params ($params) | |
Hook function called by the lxc class to set mysql_host and port parameters @access private. More... | |
hook_quota_get () | |
Hook function called by the quota class to compute user used quota Returns the used quota for the $name service for the current user. More... | |
alternc_add_member () | |
Hook function called when a user is created. More... | |
alternc_del_member () | |
Hook function called when a user is deleted. More... | |
alternc_del_session () | |
Hook function called when a user is logged out. More... | |
alternc_export_conf () | |
Exports all the mysql information of an account @access private EXPERIMENTAL 'sid' function ;) More... | |
alternc_export_data ($dir) | |
Exports all the mysql databases a of give account to $dir directory @access private EXPERIMENTAL 'sid' function ;) More... | |
get_dbus_size ($db_name, $db_host, $db_login, $db_password, $db_client) | |
Return the size of each databases in a SQL Host given in parameter. More... | |
Public Attributes | |
$dbus | |
Definition at line 58 of file m_mysql.php.
m_mysql::__construct | ( | ) |
Constructor m_mysql([$mid]) Constructeur de la classe m_mysql, initialise le membre concerne.
Definition at line 67 of file m_mysql.php.
References $cuid, and variable_get().
m_mysql::add_db | ( | $dbn | ) |
Create a new database for the current user.
$dbn | string Database name ($user_$dbn is the mysql db name) |
Definition at line 224 of file m_mysql.php.
References $c, $cuid, $db, $len, $msg, $passwd_classcount, $password, add_user(), create_pass(), grant(), and variable_get().
m_mysql::add_user | ( | $usern, | |
$password, | |||
$passconf | |||
) |
Create a new user in MySQL rights tables.
$usern | the username (we will add _[alternc-account] to it) | |
string | $password | The password for this username |
string | $passconf | The password confirmation |
Definition at line 655 of file m_mysql.php.
References $cuid, $db, $len, $login, $mem, $msg, $password, $user, grant(), and variable_get().
Referenced by add_db().
m_mysql::alternc_add_member | ( | ) |
Hook function called when a user is created.
AlternC's standard function that create a member @access private
Definition at line 957 of file m_mysql.php.
References $cuid, $db, $mem, $msg, $password, and create_pass().
m_mysql::alternc_del_member | ( | ) |
Hook function called when a user is deleted.
AlternC's standard function that delete a member @access private
Definition at line 981 of file m_mysql.php.
References $c, $d, $i, $msg, del_db(), del_user(), get_dblist(), and get_userslist().
m_mysql::alternc_del_session | ( | ) |
Hook function called when a user is logged out.
We just remove the cookie created in admin/sql_admin.php a @access private
Definition at line 1005 of file m_mysql.php.
m_mysql::alternc_export_conf | ( | ) |
Exports all the mysql information of an account @access private EXPERIMENTAL 'sid' function ;)
Definition at line 1017 of file m_mysql.php.
m_mysql::alternc_export_data | ( | $dir | ) |
Exports all the mysql databases a of give account to $dir directory @access private EXPERIMENTAL 'sid' function ;)
Definition at line 1049 of file m_mysql.php.
m_mysql::alternc_password_policy | ( | ) |
Password kind used in this class (hook for admin class)
Definition at line 126 of file m_mysql.php.
m_mysql::available_sql_rights | ( | ) |
list of all possible SQL rights
Definition at line 910 of file m_mysql.php.
m_mysql::change_user_password | ( | $usern, | |
$password, | |||
$passconf | |||
) |
Change a user's MySQL password.
$usern | the username |
$password | The password for this username |
$passconf | The password confirmation |
Definition at line 717 of file m_mysql.php.
m_mysql::del_db | ( | $dbname | ) |
Delete a database for the current user.
$dbname | string Name of the database to delete. The db name is $user_$dbn |
Definition at line 318 of file m_mysql.php.
References $cuid, $db, $msg, and del_user().
Referenced by alternc_del_member().
Delete a user in MySQL rights tables.
$user | the username (we will add "[alternc-account]_" to it) to delete | |
integer | $all |
Definition at line 745 of file m_mysql.php.
References $cuid, $db, $login, $msg, and $user.
Referenced by alternc_del_member(), and del_db().
m_mysql::get_db_size | ( | $dbname | ) |
Get the size of a database.
$dbname | name of the database |
Definition at line 555 of file m_mysql.php.
Referenced by get_mysql_details().
m_mysql::get_dblist | ( | ) |
Get the list of the database for the current user.
Definition at line 138 of file m_mysql.php.
References $bro, $c, $cuid, $db, $msg, and split_mysql_database_name().
Referenced by alternc_del_member(), get_user_dblist(), and hook_quota_get().
m_mysql::get_dbus_size | ( | $db_name, | |
$db_host, | |||
$db_login, | |||
$db_password, | |||
$db_client | |||
) |
Return the size of each databases in a SQL Host given in parameter.
$db_name | the human name of the host |
$db_host | the host hosting the SQL databases |
$db_login | the login to access the SQL db |
$db_password | the password to access the SQL db |
$db_client | the client to access the SQL db |
Definition at line 1076 of file m_mysql.php.
m_mysql::get_defaultsparam | ( | $dbn | ) |
Definition at line 594 of file m_mysql.php.
m_mysql::get_mysql_details | ( | $dbn | ) |
Returns the details of a user's database.
$dbn is the name of the database (after the _) or nothing for the database "$user"
Definition at line 194 of file m_mysql.php.
References $cuid, $db, $msg, $root, get_db_size(), getuserpath(), and split_mysql_database_name().
Referenced by restore().
m_mysql::get_user_dblist | ( | $user | ) |
Return the list of the database rights of user $user.
$user | the username |
Definition at line 787 of file m_mysql.php.
m_mysql::get_userslist | ( | $all = null | ) |
Returns the list of database users of an account.
Definition at line 571 of file m_mysql.php.
References $c, $cuid, $db, and $msg.
Referenced by alternc_del_member().
m_mysql::grant | ( | $base, | |
$user, | |||
$rights = null , |
|||
$pass = null , |
|||
$table = '*' |
|||
) |
Function used to grant SQL rights to users: @base :database @user : database user @rights : rights to apply ( optional, every rights apply given if missing @pass : user password ( optional, if not given the pass stays the same, else it takes the new value ) @table : sql tables to apply rights.
Definition at line 453 of file m_mysql.php.
References $db, $msg, $user, and elseif.
Referenced by add_db(), add_user(), and set_user_rights().
m_mysql::hook_lxc_params | ( | $params | ) |
Hook function called by the lxc class to set mysql_host and port parameters @access private.
Definition at line 920 of file m_mysql.php.
m_mysql::hook_menu | ( | ) |
m_mysql::hook_quota_get | ( | ) |
Hook function called by the quota class to compute user used quota Returns the used quota for the $name service for the current user.
$name | string name of the quota |
Definition at line 939 of file m_mysql.php.
References $c, $mem, $msg, $q, and get_dblist().
m_mysql::list_db_servers | ( | ) |
Definition at line 81 of file m_mysql.php.
m_mysql::php_myadmin_connect | ( | ) |
Get the login and password of the special user able to connect to phpmyadmin.
Definition at line 157 of file m_mysql.php.
m_mysql::put_mysql_backup | ( | $dbn, | |
$bck_mode, | |||
$bck_history, | |||
$bck_gzip, | |||
$bck_dir | |||
) |
Set the backup parameters for the database $db.
$dbn | string database name |
$bck_mode | integer Backup mode (0 = none 1 = daily 2 = weekly) |
$bck_history | integer How many backup should we keep ? |
$bck_gzip | boolean shall we compress the backup ? |
$bck_dir | string Directory relative to the user account where the backup will be stored |
Definition at line 354 of file m_mysql.php.
References $bro, $cuid, $db, $msg, and variable_get().
m_mysql::put_mysql_details | ( | $password | ) |
Change the password of the user in MySQL.
$password | string new password (cleartext) |
Definition at line 409 of file m_mysql.php.
References $cuid, $db, $len, $login, $msg, $password, and variable_get().
m_mysql::reload_dbus | ( | ) |
Definition at line 76 of file m_mysql.php.
m_mysql::restore | ( | $file, | |
$stdout, | |||
$id | |||
) |
Restore a sql database.
$file | string The filename, relative to the user root dir, which contains a sql dump |
$stdout | boolean shall-we dump the error to stdout ? |
$id | integer The ID of the database to dump to. |
Definition at line 506 of file m_mysql.php.
References $bro, $id, $msg, $r, elseif, and get_mysql_details().
m_mysql::set_user_rights | ( | $user, | |
$dbn, | |||
$rights | |||
) |
Set the access rights of user $user to database $dbn to be rights $rights.
$user | the username to give rights to |
$dbn | The database to give rights to |
$rights | The rights as an array of MySQL keywords (insert, select ...) |
Definition at line 827 of file m_mysql.php.
m_mysql::$dbus |
Definition at line 60 of file m_mysql.php.