function _aat_legacy_migrate_from_d5 in Amazon Product Advertisement API 6
Process one node.
Parameters
$nid: The nid to which we are to add values.
$type: The ntype field from amazonnode table: the content type we're working with.
Return value
the updated node.
1 call to _aat_legacy_migrate_from_d5()
- _aat_legacy_migrate_field_from_d5 in aat_legacy/
aat_legacy.d5-migrate.inc - Batch Operation Callback
File
- aat_legacy/
aat_legacy.d5-migrate.inc, line 50 - Migration for the amazonnode and related item links from D5 amazontools.
Code
function _aat_legacy_migrate_from_d5($nid, $type) {
$results = db_query("SELECT asin, ntype FROM {amazonnode} an WHERE an.nid = %d and an.ntype = '%s'", $nid, $type);
$dirty = FALSE;
$node = node_load($nid);
while ($asin = db_fetch_object($results)) {
// if (!in_array($asin->asin, array_keys(array_values($node->field_legacy_asin)))) {
$node->field_legacy_asin[]['asin'] = $asin->asin;
// }
}
node_save($node);
$sql = "DELETE FROM {amazonnode} WHERE nid = %d AND ntype = '%s'";
db_query($sql, $nid, $type);
return $node;
}