solved bug on setDB found by Sebastien Lion (recompilation trigger)

This commit is contained in:
Martin Monperrus
2011-12-11 12:46:59 +01:00
parent ac682585cb
commit e76077da0b
+7 -6
View File
@@ -391,7 +391,7 @@ function setDB() {
// we try to save a "compiled" in a txt file // we try to save a "compiled" in a txt file
$compiledbib = 'bibtexbrowser_'.md5($_GET[Q_FILE]).'.dat'; $compiledbib = 'bibtexbrowser_'.md5($_GET[Q_FILE]).'.dat';
$parse=true; $parse=false;
foreach(explode(MULTIPLE_BIB_SEPARATOR, $_GET[Q_FILE]) as $bib) { foreach(explode(MULTIPLE_BIB_SEPARATOR, $_GET[Q_FILE]) as $bib) {
// do we have a compiled version ? // do we have a compiled version ?
if (is_file($compiledbib) && is_readable($compiledbib)) { if (is_file($compiledbib) && is_readable($compiledbib)) {
@@ -401,12 +401,11 @@ function setDB() {
$_GET[Q_DB] = unserialize(file_get_contents($compiledbib)); $_GET[Q_DB] = unserialize(file_get_contents($compiledbib));
// basic test // basic test
// do we have an correct version of the file // do we have an correct version of the file
if (is_a($_GET[Q_DB],'BibDataBase')) { if (!is_a($_GET[Q_DB],'BibDataBase')) {
// at least we can switch off the parsing $parse=true;
$parse=false;
}
}
} }
} else {$parse=true;}
} else {$parse=true;}
} // end for each } // end for each
// we don't have a compiled version // we don't have a compiled version
@@ -431,6 +430,8 @@ function setDB() {
} }
//else echo '<!-- please chmod the directory containing the bibtex file to be able to keep a compiled version (much faster requests for large bibtex files) -->'; //else echo '<!-- please chmod the directory containing the bibtex file to be able to keep a compiled version (much faster requests for large bibtex files) -->';
} // end parsing and saving } // end parsing and saving
return $parse;
} // end function setDB } // end function setDB