Registration of an Additional Service

<?php

/**
 * Sample code to register an additional service in
 * Plesk 10.1 and above.
 *
 */

/**
 * Use the following instructions to initialize the Plesk PHP
 * environment when running command-line PHP script with sw-engine-pleskrun
 * utility. On Linux OSes, it resides in /usr/local/psa/bin/.
 *
 * For Windows servers, use the following command to run the registration script.
 * "%plesk_bin%\php.exe" -d auto_prepend_file="" "<ABSOLUTE-PATH-TO-SCRIPT>"
 *
 * Comment the following two lines if you run the PHP script through the Plesk
 * web interface.
 */
require_once('api-common/cu.php');
cu::initCLI();

/**
 * The following code registers the service that was
 * implemented with the servicedir_servicefile class. This class must
 * be available for autoloading from Plesk.
 */

Db_Table_Broker::get('PlanItems')->register(
    new servicedir_servicefile(),
    servicedir_servicefile::getSubjectTypes()
);
 

Leave your comments on this page

Leave your feedback or question on this documentation topic below. For technical assistance, contact your hosting service provider or submit a request to Plesk support. Suggest new features for Plesk here. Discuss general questions on the Plesk forum. All offtopic comments will be removed.