class Provision_Context_site

Hierarchy

Expanded class hierarchy of Provision_Context_site

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
Provision_Context::$name public property Name for saving aliases and referencing.
Provision_Context::$oid_map protected property Keeps track of properites that are names of Provision_Context objects. Set with is_oid().
Provision_Context::$properties protected property Properties that will be persisted by provision-save. Access as object members, $evironment->property_name. __get() and __set handle this. In init(), set defaults with setProperty().
Provision_Context::$service_subs protected property
Provision_Context::$type public property 'server', 'platform', or 'site'.
Provision_Context::command_invoke function Allow a server to plug into a drush command that has been called.
Provision_Context::get_services function Return the merged list of services and the associated servers supplying them.
Provision_Context::init function Init stub function.
Provision_Context::is_oid function Specify that a property contains a named context.
Provision_Context::method_invoke function Execute a method on the object and all of it's associated services.
Provision_Context::service function Return a service object for the specific service type.
Provision_Context::services_invoke function Call method $callback on each of the context's service objects.
Provision_Context::service_subscribe function Subscribe a service handler.
Provision_Context::setProperty function Check the $options property for a field, saving to the properties array.
Provision_Context::type_invoke function Execute the method for the current object type.
Provision_Context::__call function Implement the __call magic method.
Provision_Context::__construct function Constructor for the context.
Provision_Context::__get function Retrieve value from $properties array if property does not exist in class proper. Properties that refer to Provision_Context objects will be run through d(), see is_oid().
Provision_Context::__isset function Check the properties array if the property does not exist in the class proper.
Provision_Context::__set function Store value in properties array if the property does not exist in class proper.
Provision_Context::__unset function Remove the value from the properties array if the property does not exist in the class proper.
Provision_Context_site::$parent_key public property Overrides Provision_Context::$parent_key
Provision_Context_site::init_site function
Provision_Context_site::option_documentation static function Return context-specific configuration options for help. Overrides Provision_Context::option_documentation
Provision_Context_site::write_alias function Write out this named context to an alias file. Overrides Provision_Context::write_alias

File

Provision/Context/site.php, line 7
Provision named context site class.

View source
class Provision_Context_site extends Provision_Context {
  public $parent_key = 'platform';

  static function option_documentation() {
    return array(
      'platform' => 'site: the platform the site is run on',
      'db_server' => 'site: the db server the site is run on',
      'uri' => 'site: example.com URI, no http:// or trailing /',
      'language' => 'site: site language; default en',
      'aliases' => 'site: comma-separated URIs',
      'redirection' => 'site: boolean for whether --aliases should redirect; default false',
      'client_name' => 'site: machine name of the client that owns this site',
      'profile' => 'site: Drupal profile to use; default standard',
      'drush_aliases' => 'site: Comma-separated list of additional Drush aliases through which this site can be accessed.',
    );
  }

  function init_site() {
    $this->setProperty('uri');

    // we need to set the alias root to the platform root, otherwise drush will cause problems.
    $this->root = $this->platform->root;

    // set this because this path is accessed a lot in the code, especially in config files.
    $this->site_path = $this->root . '/sites/' . $this->uri;

    $this->setProperty('site_enabled', true);
    $this->setProperty('language', 'en');
    $this->setProperty('client_name');
    $this->setProperty('aliases', array(), TRUE);
    $this->setProperty('redirection', FALSE);
    $this->setProperty('cron_key', '');
    $this->setProperty('drush_aliases', array(), TRUE);

    // this can potentially be handled by a Drupal sub class
    $this->setProperty('profile', 'standard');
  }

  /**
   * Write out this named context to an alias file.
   */
  function write_alias() {
    $config = new Provision_Config_Drushrc_Alias($this->name, $this->properties);
    $config->write();
    foreach ($this->drush_aliases as $drush_alias) {
      $config = new Provision_Config_Drushrc_Alias($drush_alias, $this->properties);
      $config->write();
    }
  }
}