function biblio_update_6027 in Bibliography Module 6.2
Same name and namespace in other branches
- 6 biblio.install \biblio_update_6027()
- 7 biblio.install \biblio_update_6027()
- 7.2 biblio.install \biblio_update_6027()
Update ...
This update function ...
Return value
array An array of associaive arrays with 'success' and 'query' keys.
File
- ./
biblio.install, line 2503 - Install, update, and uninstall functions for the biblio module.
Code
function biblio_update_6027() {
// Renunmber the author rank such that it is zero based across all categories.
// This only needs to be performed on biblio entries that actually have
// auth_categories other than 1.
require_once drupal_get_path('module', 'biblio') . '/includes/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);
_biblio_save_contributors($contributors, $node->nid, $node->vid, $update = FALSE);
$count++;
}
$message = "Reordered the authors on {$count}/{$count_success} nodes";
$result[] = array(
'success' => $count_success == $count,
'query' => $message,
);
return $result;
}