VIII. Host Reference

Midgard uses host records to map a page structure and a style for a given hostname.

1. Host Record Definition

A host record contains information about a host, its status and its owner.

Fields of a host record

id

The id of the host record.

name

The base URL of the Midgard host. This should contain only the host part of the URL. To serve pages for http://www.midgard-project.org/manual/ the name must be set to www.midgard-project.org.

root

The page-id of the rootpage for the host.

style

The style-id of the default style for the host.

info

If this field is set to 'auth', the authentication is required to access the host.

owner

The group-id of the owner of the host record.

port

The port this host will listen at. If set to 0 then the host will react to any port.

online

If set to zero, Midgard will not serve pages for this host. If set to one, Migard will serve pages for this host.

prefix

The path part of the Midgard host. If the host should serve pages for http://www.midgard-project.org/manual/, prefix should be test to /manual.

sitegroup

The id of the sitegroup the host belongs to.

2. Host Object Definition

Midgard functions like mgd_get_host and mgd_list_hosts return objects upon success. This section describes the contents of thos objects. Most object parameters map directly to the record fields described above.

The functions listed within the object definition are the object methods that are available for the object. Usage information about those methods can be found in Object Methods.

/* Host Object Prototype */

Class host {

  var $N;      # only with mgd_list_XXX functions.
  var $id;
  var $name;
  var $root;
  var $style;
  var $info;
  var $owner;
  var $port;
  var $online;
  var $prefix;
  var $sitegroup;

  function fetch();             # Only with mgd_list_XXX functions.

  function create();
  function update();
  function delete();

  function setsitegroup();
  function getsitegroup();

  function parameter();
  function listparameters();
  function searchparameters();

  function setscore();

  function settype();

  function createattachment();
  function updateattachment();
  function deleteattachment();
  function getattachment();
  function listattachment();
  function openattachment();
  function serveattachment();
}
Table of Contents
mgd_get_host — Get a host record
mgd_get_host_by_name — Get a host by its name
mgd_create_host — Create a host record
mgd_delete_host — Delete a host record
mgd_update_host — Update a host record
mgd_is_host_owner — Check host ownership
mgd_list_hosts — List midgard hosts