site.php

  1. 7.x-3.x http/Provision/Config/Nginx/Site.php
  2. 7.x-3.x http/Provision/Config/Apache/Ssl/Site.php
  3. 7.x-3.x http/Provision/Config/Nginx/Ssl/Site.php
  4. 7.x-3.x http/Provision/Config/Http/Site.php
  5. 7.x-3.x http/Provision/Config/Apache/Site.php
  6. 7.x-3.x Provision/Context/site.php
  7. 7.x-3.x Provision/Config/Drushrc/Site.php
  8. 7.x-3.x http/Provision/Config/Http/Ssl/Site.php

Provision named context site class.

Classes

File

Provision/Context/site.php
View source
  1. <?php
  2. /**
  3. * @file Provision named context site class.
  4. */
  5. class Provision_Context_site extends Provision_Context {
  6. public $parent_key = 'platform';
  7. static function option_documentation() {
  8. return array(
  9. 'platform' => 'site: the platform the site is run on',
  10. 'db_server' => 'site: the db server the site is run on',
  11. 'uri' => 'site: example.com URI, no http:// or trailing /',
  12. 'language' => 'site: site language; default en',
  13. 'aliases' => 'site: comma-separated URIs',
  14. 'redirection' => 'site: boolean for whether --aliases should redirect; default false',
  15. 'client_name' => 'site: machine name of the client that owns this site',
  16. 'profile' => 'site: Drupal profile to use; default standard',
  17. 'drush_aliases' => 'site: Comma-separated list of additional Drush aliases through which this site can be accessed.',
  18. );
  19. }
  20. function init_site() {
  21. $this->setProperty('uri');
  22. // we need to set the alias root to the platform root, otherwise drush will cause problems.
  23. $this->root = $this->platform->root;
  24. // set this because this path is accessed a lot in the code, especially in config files.
  25. $this->site_path = $this->root . '/sites/' . $this->uri;
  26. $this->setProperty('site_enabled', true);
  27. $this->setProperty('language', 'en');
  28. $this->setProperty('client_name');
  29. $this->setProperty('aliases', array(), TRUE);
  30. $this->setProperty('redirection', FALSE);
  31. $this->setProperty('cron_key', '');
  32. $this->setProperty('drush_aliases', array(), TRUE);
  33. // this can potentially be handled by a Drupal sub class
  34. $this->setProperty('profile', 'standard');
  35. }
  36. /**
  37. * Write out this named context to an alias file.
  38. */
  39. function write_alias() {
  40. $config = new Provision_Config_Drushrc_Alias($this->name, $this->properties);
  41. $config->write();
  42. foreach ($this->drush_aliases as $drush_alias) {
  43. $config = new Provision_Config_Drushrc_Alias($drush_alias, $this->properties);
  44. $config->write();
  45. }
  46. }
  47. }