• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Event handler for subscription created

eworksmedia

New Pleskian
Which Event Handler gets fired when a subscription is created? I've tried both "Hosting settings created" and "Default domain (the first domain added to a subscription/webspace) created" but those don't seem to be firing when I create a new subscription. After creating the Event Handler the psa service was restarted each time. I have a script setup to just log the NEW_DOMAIN_NAME to a file, but that isn't happening.
 
I too am experiencing this very same problem. I need to run a script that automates a few things each time a new domain is created for a new subscription, but I can't seem to find the correct event trigger. I've tried a couple, including "Hosting settings created" and "Default domain (the first domain added to a subscription/webspace) created" to no avail.

Has anybody had any luck with this yet? Are there any log files I can look at to see if the event listener is even being triggered?

Cheers,
Pedro
 
This is how I solved it. Save a file like this:

Code:
class MYEventListener_EventListener implements EventListener {
	
	private static $domain_name = '';
	
	public function handleEvent($objectType, $objectId, $action, $oldValues, $newValues) { // called for all Plesk events
		if($action == 'phys_hosting_create'){ // subscription created
			self::$domain_name = $newValues['Domain Name'];
		}
	}
	
}

return new MYEventListener_EventListener();

To
Code:
/usr/local/psa/admin/plib/registry/EventListener/MYEventListener.php
 
Thanks for the quick reply. I eventually found the error. I was a stupid typo in the command field. One of those you read over and over and all is fine in your head, until another person reads it and spots the error... :(
 
Back
Top