Browse Source

fix warning

master
Martin Monperrus 9 months ago
parent
commit
cf3ad21700
No known key found for this signature in database GPG Key ID: 7D398AD45AEEEC93
  1. 7
      bibtexbrowser.php

7
bibtexbrowser.php

@ -405,6 +405,7 @@ function _zetDB($bibtex_filenames) {
} }
} }
if (config_value('BIBTEXBROWSER_USE_CACHE')==true) {
// now we may update the database // now we may update the database
if (!file_exists($compiledbib)) { if (!file_exists($compiledbib)) {
@touch($compiledbib); @touch($compiledbib);
@ -413,19 +414,19 @@ function _zetDB($bibtex_filenames) {
// is it up to date ? wrt to the bib file and the script // is it up to date ? wrt to the bib file and the script
// then upgrading with a new version of bibtexbrowser triggers a new compilation of the bib file // then upgrading with a new version of bibtexbrowser triggers a new compilation of the bib file
if (filemtime($bib)>filemtime($compiledbib) || filemtime(__FILE__)>filemtime($compiledbib)) { if (filemtime($bib)>filemtime($compiledbib) || filemtime(__FILE__)>filemtime($compiledbib)) {
// echo "updating ".$bib;
// echo "updating ".$bib;
$db->update($bib); $db->update($bib);
$updated = true; $updated = true;
} }
} }
}
// echo var_export($parse); // echo var_export($parse);
// echo var_export($updated); // echo var_export($updated);
$saved = false; $saved = false;
// are we able to save the compiled version ? // are we able to save the compiled version ?
// note that the compiled version is saved in the current working directory // note that the compiled version is saved in the current working directory
if ( ($parse || $updated ) && is_writable($compiledbib)) {
if ( config_value('BIBTEXBROWSER_USE_CACHE')==true && ( $parse || $updated ) && is_writable($compiledbib)) {
// we use 'a' because the file is not locked between fopen and flock // we use 'a' because the file is not locked between fopen and flock
$f = fopen($compiledbib,'a'); $f = fopen($compiledbib,'a');
//we use a lock to avoid that a call to bibbtexbrowser made while we write the object loads an incorrect object //we use a lock to avoid that a call to bibbtexbrowser made while we write the object loads an incorrect object

Loading…
Cancel
Save