function drush_example_provision_install in Hosting 7.4
Same name and namespace in other branches
- 7.3 example/example_service/drush/install.provision.inc \drush_example_provision_install()
Implementation of drush_hook_provision_install.
Create the site specific configuration for this service.
In our basic implementation we do not have an implementation of this API method, because it wasn't necessary.
If the service implemented doesn't define this method, or no implementation has been selected, nothing will happen.
File
- example/
example_service/ drush/ install.provision.inc, line 22 - Drush invoke API hooks for the 'provision-install' command.
Code
function drush_example_provision_install() {
/**
* Using the d() accessor.
*
* Every object that aegir manages (namely servers, platforms and sites),
* has an associated 'named context' that we manage for it.
*
* You can run the provision commands on different objects, simply
* by specifying the context name before the drush command, such as:
*
* drush @server_master provision-verify
*
* When you have called a command in this way, you can use the d()
* function without any arguments to retrieve the object representing
* the current context.
*/
if (d()->type == 'site') {
// only run this code on site objects.
/**
* Calling service methods.
*
* All the provision context objects can register which
* servers handle specific services for them.
*
* To call the correct methods, you just need to use the
* the 'service' method with the service type you want
* to call as its only argument.
*/
d()
->service('example')
->create_config('site');
}
}