function _uninstall_selected in Bibliography Module 7
1 call to _uninstall_selected()
- biblio_citeproc_style_manager_form_submit in modules/
CiteProc/ biblio_citeproc.admin.inc
File
- modules/
CiteProc/ biblio_citeproc.admin.inc, line 496
Code
function _uninstall_selected($ids = array()) {
$result = db_select('biblio_citeproc_styles', 'csl')
->fields('csl', array(
'id',
'filename',
'parent',
))
->orderBy('filename', 'ASC')
->execute();
foreach ($result as $csl) {
$fp[$csl->filename] = $csl->parent;
$fi[$csl->filename] = $csl->id;
}
foreach ($ids as $id) {
db_delete('biblio_citeproc_styles')
->condition('filename', $id)
->execute();
// If this is a dependent style, delete the parent style if no others are using it.
if (!empty($fp[$id])) {
$parent = array_keys($fp, $fp[$id]);
if (count($parent) == 1) {
db_delete('biblio_citeproc_styles')
->condition('id', $fp[$id])
->execute();
}
}
// Delete all the dependents.
$children = array_keys($fp, $fi[$id]);
if (!empty($children)) {
db_delete('biblio_citeproc_styles')
->condition('filename', $children, 'IN')
->execute();
}
if (variable_get('biblio_citeproc_style', 'ieee.csl') == $id) {
variable_del('biblio_citeproc_style');
}
}
}