function _hosting_package_instances_load in Hostmaster (Aegir) 6
2 calls to _hosting_package_instances_load()
- hosting_package_instances_load in modules/
hosting/ package/ hosting_package.instance.inc - hosting_package_instance_load in modules/
hosting/ package/ hosting_package.instance.inc
File
- modules/
hosting/ package/ hosting_package.instance.inc, line 101 - API for mapping packages to various Hosting node types
Code
function _hosting_package_instances_load($param, $multiple = FALSE) {
$arguments = array();
if (is_numeric($param)) {
$cond = 'iid = %d';
$arguments[] = $param;
}
elseif (is_array($param)) {
// Turn the conditions into a query.
foreach ($param as $key => $value) {
$cond[] = $key . " = '%s'";
$arguments[] = $value;
}
$cond = implode(' AND ', $cond);
}
else {
return FALSE;
}
$instances = array();
$result = db_query("SELECT\n n.title, r.type, p.package_type, p.nid,\n i.iid, i.version, i.version_code, i.schema_version,\n i.status, p.description, p.short_name, p.old_short_name, i.rid,\n i.package_id\n FROM {hosting_package_instance} i\n LEFT JOIN {hosting_package} p ON p.nid=i.package_id\n LEFT JOIN {node} n ON p.nid=n.nid\n LEFT JOIN {node} r ON r.nid=i.rid\n LEFT JOIN {hosting_platform} h ON r.nid=h.nid\n WHERE " . $cond, $arguments);
while ($instance = db_fetch_object($result)) {
$instance->languages = _hosting_package_instances_load_languages($instance->iid);
if (!$multiple) {
return $instance;
}
$instances[$instance->iid] = $instance;
}
return $instances;
}