function _hosting_package_load in Hostmaster (Aegir) 6
A generic method for finding whichever packages you are looking for.
This works similarly to node_load's implementation, but it will only look for fields related to packages.
Parameters
An associated array containing the following properties:
- name => A string containing the friendly name of the package
- short_name => The name of the drupal package in the system table
- old_short_name => The name that a package used to be called, for migration purposes.
- package_type => The type of package. (theme|module|profile|engine)
File
- modules/
hosting/ package/ hosting_package.module, line 209
Code
function _hosting_package_load($param) {
// Turn the conditions into a query.
foreach ($param as $key => $value) {
$cond[] = 'p.' . db_escape_table($key) . " = '%s'";
$arguments[] = $value;
}
$cond = implode(' AND ', $cond);
$result = db_query('SELECT n.nid FROM {node} n left join {hosting_package} p on n.nid = p.nid WHERE ' . $cond, $arguments);
while ($nid = db_fetch_object($result)) {
$return[$nid->nid] = node_load(array(
'nid' => $nid->nid,
));
}
if (sizeof($return)) {
return $return;
}
return null;
}