function _radioactivity_add_energy_internal in Radioactivity 6
Same name and namespace in other branches
- 5 radioactivity.inc \_radioactivity_add_energy_internal()
2 calls to _radioactivity_add_energy_internal()
- radioactivity_add_energy in ./
radioactivity.inc - Add energy to nodes.
- radioactivity_process_memcached_entries in ./
radioactivity.module
File
- ./
radioactivity.inc, line 201
Code
function _radioactivity_add_energy_internal($oid, $oclass, $source, $multiplier) {
$db_type = $GLOBALS['db_type'];
$timestamp = time();
$energies = radioactivity_get_energies_for_source($oid, $oclass, $source);
foreach ($energies as $dpid => $amount) {
if (!$amount) {
continue;
}
$amount *= $multiplier;
// remap id if necessary
$oid = _radioactivity_possibly_remap_id($oid, $oclass);
switch ($db_type) {
case 'mysql':
case 'mysqli':
_radioactivity_add_energy_mysql($oid, $oclass, $dpid, $amount, $timestamp);
break;
default:
_radioactivity_add_energy_std($oid, $oclass, $dpid, $amount, $timestamp);
break;
}
}
return TRUE;
}