You are here

function _get_zip_from_github in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 modules/CiteProc/biblio_citeproc.admin.inc \_get_zip_from_github()
  2. 7.2 modules/CiteProc/biblio_citeproc.admin.inc \_get_zip_from_github()
3 calls to _get_zip_from_github()
biblio_citeproc_style_manager_form in modules/CiteProc/biblio_citeproc.admin.inc
biblio_citeproc_style_manager_form_submit in modules/CiteProc/biblio_citeproc.admin.inc
biblio_citeproc_update_available in modules/CiteProc/biblio_citeproc.admin.inc
1 string reference to '_get_zip_from_github'
biblio_citeproc_update_installed in modules/CiteProc/biblio_citeproc.admin.inc

File

modules/CiteProc/biblio_citeproc.admin.inc, line 397

Code

function _get_zip_from_github() {
  $zip_file = FALSE;
  $zip_url = 'https://github.com/citation-style-language/styles-distribution/archive/master.zip';
  $destination = file_build_uri('Biblio-CiteProc-Styles.zip');
  $zip_file = system_retrieve_file($zip_url, $destination, TRUE, FILE_EXISTS_REPLACE);
  if ($zip_file) {
    $usage = file_usage_list($zip_file);
  }
  else {
    drupal_set_message("Error downloading styles", 'error');
    return $zip_file;
  }
  if (empty($usage)) {
    file_usage_add($zip_file, 'biblio_citeproc', 'csl', 0);
  }
  variable_set('biblio_citeproc_styles_zip_file', $zip_file);
  cache_clear_all('biblio_citeproc_styles', 'cache');
  return $zip_file;
}