You are here

class Provision_Service_example in Hosting 7.3

Same name and namespace in other branches
  1. 7.4 example/example_service/drush/Provision/Service/example.php \Provision_Service_example

The service type base class.

All implementations of the service type will inherit this class. This class should define the 'public API' to be used by the rest of the system, which should not expose implementation details.

Hierarchy

Expanded class hierarchy of Provision_Service_example

File

example/example_service/drush/Provision/Service/example.php, line 10

View source
class Provision_Service_example extends Provision_Service {
  public $service = 'example';

  /**
   * Initialize the service along with the server object.
   */
  function init() {

    // REMEMBER TO CALL THE PARENT!
    parent::init();

    /**
     * We do not need to use this in our example.
     *
     * You would extend this if you needed to save values
     * for all possible implementations of this service type.
     */
  }

  /**
   * Called on provision-verify.
   *
   * We change what we will do based on what the
   * type of object the command is being run against.
   */
  function verify() {
    $this
      ->create_config(d()->type);
    $this
      ->parse_configs();
  }

  /**
   * PUBLIC API!
   *
   * These are just a basic example, the thing to notice here is that these
   * methods are just stubs for later implementations to extend.
   *
   * If a specific implementation doesn't need to parse the configuration files
   * that are generated for instance, it can just not implement the stub.
   */

  /**
   * Commonly something like running the restart_cmd or sending SIGHUP to a process.
   */
  function parse_configs() {
    return TRUE;
  }

  /**
   * Generate a site specific configuration file
   */
  function create_site_config() {
    return TRUE;
  }

  /**
   * Remove an existing site configuration file.
   */
  function delete_site_config() {
    return TRUE;
  }

  /**
   * Add a new platform specific configuration file.
   */
  function create_platform_config() {
    return TRUE;
  }

  /**
   * Remove an existing platform configuration file.
   */
  function delete_platform_config() {
    return TRUE;
  }

  /**
   * Create a new server specific configuration file.
   */
  function create_server_config() {
    return TRUE;
  }

  /**
   * Remove an existing server specific configuration file
   */
  function delete_server_config() {
    return TRUE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Provision_Service_example::$service public property
Provision_Service_example::create_platform_config function Add a new platform specific configuration file.
Provision_Service_example::create_server_config function Create a new server specific configuration file.
Provision_Service_example::create_site_config function Generate a site specific configuration file
Provision_Service_example::delete_platform_config function Remove an existing platform configuration file.
Provision_Service_example::delete_server_config function Remove an existing server specific configuration file
Provision_Service_example::delete_site_config function Remove an existing site configuration file.
Provision_Service_example::init function Initialize the service along with the server object.
Provision_Service_example::parse_configs function Commonly something like running the restart_cmd or sending SIGHUP to a process.
Provision_Service_example::verify function Called on provision-verify. 1