Commit caae02ef authored by ergonlogic's avatar ergonlogic

Issue #2103173: Provide an example of saving data to a site context.

parent f78effaa
<?php
/**
* The site_data service class.
*/
class Provision_Service_site_data extends Provision_Service {
public $service = 'site_data';
/**
* Add the needed properties to the site context.
*/
static function subscribe_site($context) {
$context->setProperty('site_data');
}
}
<?php
/**
* Implements hook_drush_init().
*/
function site_data_drush_init() {
site_data_provision_register_autoload();
}
/**
* Register our directory as a place to find provision classes.
*/
function site_data_provision_register_autoload() {
static $loaded = FALSE;
if (!$loaded) {
$loaded = TRUE;
provision_autoload_register_prefix('Provision_', dirname(__FILE__));
}
}
/**
* Expose the service type this extension defines to provision.
*
* @return
* An array with the service type the key, and the default implementation the value.
*/
function site_data_provision_services() {
site_data_provision_register_autoload();
return array('site_data' => NULL);
}
/**
* Implements drush_hook_post_COMMAND().
*/
function drush_site_data_post_provision_install() {
drush_log('[SITE_DATA] d()->site_data: ' . d()->site_data, 'warning');
}
<?php
/**
* Implements hook_drush_load().
*
* Checks if the corresponsing Hosting Feature is enabled.
*/
function site_data_drush_load() {
return in_array('site_data', drush_get_option('hosting_features', array()));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment