fix warning

This commit is contained in:
Martin Monperrus
2024-10-12 19:02:27 +02:00
parent 2d59cd8384
commit cf3ad21700
+14 -13
View File
@@ -405,27 +405,28 @@ function _zetDB($bibtex_filenames) {
} }
} }
// now we may update the database if (config_value('BIBTEXBROWSER_USE_CACHE')==true) {
if (!file_exists($compiledbib)) { // now we may update the database
@touch($compiledbib); if (!file_exists($compiledbib)) {
$updated = true; // limit case @touch($compiledbib);
} else foreach(explode(MULTIPLE_BIB_SEPARATOR, $bibtex_filenames) as $bib) { $updated = true; // limit case
// is it up to date ? wrt to the bib file and the script } else foreach(explode(MULTIPLE_BIB_SEPARATOR, $bibtex_filenames) as $bib) {
// then upgrading with a new version of bibtexbrowser triggers a new compilation of the bib file // is it up to date ? wrt to the bib file and the script
if (filemtime($bib)>filemtime($compiledbib) || filemtime(__FILE__)>filemtime($compiledbib)) { // then upgrading with a new version of bibtexbrowser triggers a new compilation of the bib file
// echo "updating ".$bib; if (filemtime($bib)>filemtime($compiledbib) || filemtime(__FILE__)>filemtime($compiledbib)) {
$db->update($bib); // echo "updating ".$bib;
$updated = true; $db->update($bib);
$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