function biblio_pm_check_md5 in Bibliography Module 7
Same name and namespace in other branches
- 6.2 modules/pubmed/biblio_pm.module \biblio_pm_check_md5()
- 6 pubmed/biblio_pm.module \biblio_pm_check_md5()
- 7.2 modules/pubmed/biblio_pm.module \biblio_pm_check_md5()
1 call to biblio_pm_check_md5()
- _biblio_pm_create_node_from_xml in modules/
pubmed/ biblio_pm.module
File
- modules/
pubmed/ biblio_pm.module, line 525
Code
function biblio_pm_check_md5($pmid, $md5) {
static $pm_md5s = array();
static $pm_nids = array();
if (empty($pm_md5s)) {
$result = db_query("SELECT * FROM {biblio_pubmed} ");
foreach ($result as $row) {
$pm_md5s[$row->biblio_pubmed_md5] = $row->nid;
$pm_nids[$row->biblio_pubmed_id] = $row->nid;
}
}
// Must be an exact duplicate of an existing node (return the nid)
if (isset($pm_nids[$pmid]) && isset($pm_md5s[$md5])) {
return $pm_md5s[$md5];
}
elseif (isset($pm_nids[$pmid]) && !isset($pm_md5s[$md5])) {
return -$pm_nids[$pmid];
}
else {
// Gaurd against duplicates in the same import.
$pm_md5s[$md5] = TRUE;
$pm_nids[$pmid] = TRUE;
return;
}
}