provision.context.site.inc 1.71 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
<?php
// $Id$

/**
 * @file Provision named context site class.
 */

class provisionContext_site extends provisionContext {
  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_email' => 'site: email for the site owner',
      '--profile' => 'site: Drupal profile to use; default default',
    );
  }

  function init() {
    $this->parent_key = 'platform';

    parent::init();
    $this->type = 'site';
    
    $this->setProperty('platform');
    $this->is_oid('platform');

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

    // 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_email');
    $this->setProperty('aliases', array(), TRUE);
    $this->setProperty('redirection', FALSE);

    // TODO :: figure out how to put this into service classes.
    $this->setProperty('ssl_enabled', 0);
    $this->setProperty('ssl_key', null);

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