function biblio_update_6027 in Bibliography Module 6
Same name and namespace in other branches
- 6.2 biblio.install \biblio_update_6027()
- 7 biblio.install \biblio_update_6027()
- 7.2 biblio.install \biblio_update_6027()
File
- ./
biblio.install, line 1841 - Install file for biblio module
Code
function biblio_update_6027() {
// renunmber the author rank such that it is zero based accross all categories
// this only needs to be done for entries that actually have auth_categories other than 1
require_once drupal_get_path('module', 'biblio') . '/biblio.contributors.inc';
$result = array();
$count = 0;
$db_result = db_query("SELECT DISTINCT(vid),nid FROM {biblio_contributor} WHERE auth_category IN (2,3,4,5) ");
$db_count_result = db_query("SELECT COUNT(DISTINCT(vid)) FROM {biblio_contributor} WHERE auth_category IN (2,3,4,5) ");
$count_success = db_result($db_count_result);
while ($node = db_fetch_object($db_result)) {
$contributors = biblio_load_contributors($node->vid);
_save_contributors($contributors, $node->nid, $node->vid, $update = FALSE);
$count++;
}
$mesg = "Reordered the authors on {$count}/{$count_success} nodes";
$result[] = array(
'success' => $count_success == $count,
'query' => $mesg,
);
return $result;
}