Create database(LiveAPI) inside Perl Module Standardized Hook
Hi everybody, I'm trying to learn a bit of Perl in order to automate some tasks that are done after new account creation. I've created a standardized hook for Whostmgr::Accounts::Create, and I'm able to grab the username of the created user... Now I'd like to create a Mysql database with this name. I'm trying to follow the example for the LiveAPI Perl Module here: https://api.docs.cpanel.net/guides/guide-to-the-liveapi-system/guide-to-the-liveapi-system-perl-module
Thanks again for any help.
-
Hello :) One of the first steps you can take when troubleshooting this type of issue is to utilize the API shell option in cPanel to see if it works outside of your custom script: https://docs.cpanel.net/cpanel/advanced/api-shell-for-cpanel/ Could you let us know if it works as expected when utilizing the API shell in cPanel? Thank you.
0 -
Hi Michael, I took a pretty long break from this project, but I wanted to post what I ended up with as my solution for anybody who searches this forum in the future. I never did get the LiveAPI module to work, instead I pulled in three Perl modules to make requests to WHM's JSON API:
- https://metacpan.org/pod/HTTP::Request::Common
- Trigger account creation via API through a custom web admin panel
- Move files from the staging area to a sandboxed cPanel account
- Dump the SQL from staging and execute a find and replace to update URL info
- Create a new database for the WordPress site
- Create a new database user for the WordPress database
- Assign all permissions for this new database to the new database user
- Import the dumped and modified SQL into the new database and get rid of the leftover .SQL file
- https://api.docs.cpanel.net/guides/guide-to-standardized-hooks/
0
Please sign in to leave a comment.
Comments
2 comments