Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation



integrationblogcta.jpg

Postgres Module Documentation

This module allows you to access cPanel's PostgreSQL functions.

The functions within this module may or may not be governed by a feature list. The required feature list may vary from function to function, to review a total list of the available features sets on a cPanel server, please see "Feature Manager" in WHM.

Postgres::listusersopt

API Version: 1 - Click here for documentation
Syntax: Postgres::listusersopt( )
Description: List PostgreSQL database users associated with a cPanel account.
Returns:  
 
The output should resemble the following:
<option value="cpanelusername_user">cpanelusername_user</option>
<option value="cpanelusername_user2">cpanelusername_user2</option>


Postgres::deluser

API Version: 1 - Click here for documentation
Syntax: Postgres::deluser( user )
Description: Delete a PostgreSQL database user. This function requires access to the 'postgres' feature. This function is not available in demo mode.
Parameters:  
  user (string)
  The name of the database user to delete. Remember: The account's cPanel username and an underscore should be prepended to the database user's name (e.g., $user_database-user).
Returns:  
 
This function will not generate any output if it is successful.

Postgres::number_of_dbs

API Version: 1 - Click here for documentation
Syntax: Postgres::number_of_dbs( )
Description: Print the number of PostgreSQL databases associated with a cPanel account.
Returns:  
 
The output will be an integer value, such as:
2


Postgres::adduser

API Version: 1 - Click here for documentation
Syntax: Postgres::adduser( user, password )
Description: Add a PostgreSQL database user. This function requires access to the 'postgres' feature. This function is not available in demo mode.
Parameters:  
  user (string)
  The database to which to add the new user. Remember: The account's cPanel username and an underscore need to be prepended to the database's name (e.g., $user_database).
  password (string)
  The password for the new database user.
Returns:  
 
This function will not display any output if it is successful.

Postgres::initcache

API Version: 1 - Click here for documentation
Syntax: Postgres::initcache( )
Description: Initialize cPanel's PostgreSQL caches.
Returns:  
 
This function does not generate any output.

Postgres::listdbsopt

API Version: 1 - Click here for documentation
Syntax: Postgres::listdbsopt( )
Description: List PostgreSQL databases owned by a cPanel account.
Returns:  
 
The output should resemble the following:
<option value="cpanelusername_dbname">cpanelusername_dbname</option>
<option value="cpanelusername_dbname2">cpanelusername_dbname2</option>

Postgres::deluserdb

API Version: 1 - Click here for documentation
Syntax: Postgres::deluserdb( db, user )
Description: Remove a PostgreSQL database user's access to a database. This function requires access to the 'postgres' feature. This function is not available in demo mode.
Parameters:  
  db (string)
  The name of the database from which to remove the user's access. Remember: The account's cPanel username and an underscore must be prepended to the database's name (e.g., $user_database).
  user (string)
  The name of the user whose access will be removed. Remember: The account's cPanel username and an underscore must be prepended to the user's name (e.g., $user_database-user).
Returns:  
 
This function will not generate any output if it is successful.

Postgres::deldb

API Version: 1 - Click here for documentation
Syntax: Postgres::deldb( dbname )
Description: Remove a PostgreSQL database. This function requires access to the 'postgres' feature. This function is not available in demo mode.
Parameters:  
  dbname (string)
  The name of the database to delete. Remember: This value must include the account's cPanel username and an underscore before the name of the database (e.g., $user_database).
Returns:  
 
This function does not produce any output if it is successful.

Postgres::adduserdb

API Version: 1 - Click here for documentation
Syntax: Postgres::adduserdb( db, user )
Description: Add an existing PostgreSQL user to a database. This function requires access to the 'postgres' feature. This function is not available in demo mode.
Parameters:  
  db (string)
  The name of the database to which to add the new user. Remember: The database's full name should be specified, including the account's cPanel username and an underscore (e.g., $user_database).
  user (string)
  The name of the database user to add to the database. Remember: The account's cPanel username and an underscore should prepend the database user's name (e.g., $user_database-user).
Returns:  
 
This function will not display any output if it is successful.

Postgres::number_of_users

API Version: 1 - Click here for documentation
Syntax: Postgres::number_of_users( )
Description: Print the number of PostgreSQL users associated with a cPanel account.
Returns:  
 
The output will be an integer, such as:
2


Postgres::adddb

API Version: 1 - Click here for documentation
Syntax: Postgres::adddb( dbname )
Description: Add a PostgreSQL database to the cPanel account. This function requires access to the 'postgres' feature. This function is not available in demo mode.
Parameters:  
  dbname (string)
  The name of the database to create. Note: The account's username and an underscore are automatically prepended to the name of the database. For example, if a database name test were specified, the database's name would be $user_test.
Returns:  
 
This function does not generate any output if it is successful.

Topic revision: r2 - 27 Mar 2012 - 19:15:32 - Main.JenniferDoubrava