function _install_from_zip in Bibliography Module 7.2
Same name and namespace in other branches
- 6.2 modules/CiteProc/biblio_citeproc.admin.inc \_install_from_zip()
1 string reference to '_install_from_zip'
- biblio_citeproc_style_manager_form_submit in modules/
CiteProc/ biblio_citeproc.admin.inc
File
- modules/
CiteProc/ biblio_citeproc.admin.inc, line 301
Code
function _install_from_zip(&$context = NULL) {
$destination = variable_get('github_zip', '');
if (!empty($destination)) {
$zip = zip_open($destination);
$za = new ZipArchive();
if ($za
->open($destination) !== TRUE) {
$message = t('Could not open zip file containing styles: !file', array(
'!file' => realpath($destination),
));
$message = check_plain($message);
drupal_set_message($message, 'error');
return;
}
if (empty($context['sandbox'])) {
$context['sandbox']['progress'] = 0;
$context['results']['install_count'] = 0;
}
$num_files = $za->numFiles;
$start = $context['sandbox']['progress'];
$end = min($start + 50, $num_files);
for ($i = $start; $i < $end; $i++) {
$name = $za
->getNameIndex($i);
$name = basename($name);
if (strstr($name, '.csl')) {
$csl = $za
->getFromIndex($i);
_install_csl($name, $csl, NULL, TRUE);
$context['results']['install_count']++;
}
$context['sandbox']['progress']++;
}
$za
->close();
if ($context['sandbox']['progress'] != $num_files) {
$context['finished'] = $context['sandbox']['progress'] / $num_files;
}
}
}