Difference between revisions of "Update WHMCS database after the game server has been created"

Line 1: Line 1:
TCAdmin has a [[Update_IP_and_port_in_WHMCS|recurring task that can update your WHMCS database]] every few hours. If you need to update your database right after the game server has been created you can configure this script for the after created event. Update the mysql_ variables with your WHMCS database connection.
+
TCAdmin has a [[Update_IP_and_port_in_WHMCS|recurring task that can update your WHMCS database]] every few hours. If you need to update your database right after the game server has been created you can configure this global script for the after created event. Update the mysql_ variables with your WHMCS database connection.
  
 
  '''Operating System:''' Any
 
  '''Operating System:''' Any

Revision as of 12:19, 5 August 2020

TCAdmin has a recurring task that can update your WHMCS database every few hours. If you need to update your database right after the game server has been created you can configure this global script for the after created event. Update the mysql_ variables with your WHMCS database connection.

Operating System: Any
Description: Update WHMCS.
Script Engine: IronPython
Event: After Created
Script:
import clr;
import System;

clr.AddReference("TCAdmin.DatabaseProviders.MySql");
clr.AddReference("TCAdmin.SDK");
from TCAdmin.DatabaseProviders.MySql import MySqlManager;
from System import String;

mysql_server="WHMCSIP";
mysql_user="WHMCSUSER";
mysql_password="WHMCSPASSWORD";
mysql_database="WHMCSDATABASE";

with MySqlManager() as mysql:
 mysql.UseMasterWebService = False;
 mysql.DisableReplication = True;
 mysql.Connect(String.Format("Data Source={0};User Id={1};Password={2};Database={3};Pooling=False;", mysql_server, mysql_user, mysql_password, mysql_database));
 mysql.ExecuteNonQuery(String.Format("UPDATE tblhosting SET domain='{0}' WHERE id='{1}'", ThisService.ConnectionInfo, ThisService.BillingId));
Retrieved from "https://help.tcadmin.com/index.php?title=Update_WHMCS_database_after_the_game_server_has_been_created&oldid=2252"