Implementation

Contexts in Aegir are stored as a simple array of data in a file within the backend of Aegir. However this array of data is accessed and modified with a set of objects and accessors. Here is an example of what a context file looks like:

INSERT EXAMPLE CONTEXT

Notice that Contexts can reference other contexts, for example, a site's context will contain a reference to the context of the platform that it is running on.

There are also a number of other interesting properties in the example, note the 'web_server' property, which has a value that is another context. We shall see later that these properties are special, and allow developers to easily access functions of the 'web_server' without needing to care which web server they are talking to.

Contexts are used within drush commands as objects, which subclass provision_context. This allows much more flexibility and cleverness, though can make them very confusing to use sometimes! As a developer you will only need to worry about the context objects, as Aegir handles storing them in the files for you. But it is important to note that each context must be representable in a flat text file (or be prepared to do some serious leg-work.)