function biblio_backup in Bibliography Module 6
Same name and namespace in other branches
- 6.2 includes/biblio.import.export.inc \biblio_backup()
- 7 includes/biblio.import.export.inc \biblio_backup()
- 7.2 includes/biblio.import.export.inc \biblio_backup()
1 string reference to 'biblio_backup'
- biblio_import in ./
biblio.import.export.inc - Import data from a file and return the node ids created.
File
- ./
biblio.import.export.inc, line 1239 - Functions that are used to import and export biblio data.
Code
function biblio_backup() {
$csv_function = !function_exists('fputcsv') ? 'biblio_fputcsv' : 'fputcsv';
$count_sql = "SELECT COUNT(*)\n FROM {biblio} b, {node} n, {node_revisions} nr\n WHERE b.vid = n.vid and nr.vid = n.vid;";
$field_type_sql = "SELECT * FROM {biblio_field_type} ";
$field_type_data_sql = "SELECT * FROM {biblio_field_type_data} ";
$field_fields_sql = "SELECT * FROM {biblio_fields} ";
$types_sql = "SELECT * FROM {biblio_types} ";
$sql = "SELECT b.*,\n n.type, n.language, n.title, n.uid, n.status, n.created,\n n.changed, n.comment, n.promote, n.moderate, n.sticky,\n n.tnid, n.translate,\n nr.title, nr.body, nr.teaser, nr.log, nr.timestamp, nr.format\n FROM {biblio} b, {node} n, {node_revisions} nr\n WHERE b.vid = n.vid and nr.vid = n.vid;";
$biblio_count = db_result(db_query($count_sql));
if ($biblio_count) {
drupal_set_header('Content-Type: text/plain; charset=utf-8');
drupal_set_header('Content-Disposition: attachment; filename=Biblio-export.csv');
$biblio_nodes = db_query($sql);
while ($node = db_fetch_array($biblio_nodes)) {
$results[] = $node;
}
print biblio_csv_export($results);
unset($results);
$result = db_query($field_type_data_sql, 'biblio_field_type_data.csv');
while ($data = db_fetch_array($result)) {
$results[] = $data;
}
print biblio_csv_export($results);
unset($results);
$result = db_query($field_fields_sql, 'biblio_fields.csv');
while ($data = db_fetch_array($result)) {
$results[] = $data;
}
print biblio_csv_export($results);
unset($results);
$result = db_query($types_sql, 'biblio_types.csv');
while ($data = db_fetch_array($result)) {
$results[] = $data;
}
print biblio_csv_export($results);
unset($results);
$result = db_query($field_type_sql, 'biblio_field_type.csv');
while ($data = db_fetch_array($result)) {
$results[] = $data;
}
print biblio_csv_export($results);
}
}