зеркало из https://github.com/mozilla/pjs.git
Bug 265188: GenerateVersionTable should only overwrite versioncache if it's changed - Patch by Fr�d�ric Buclin <LpSolit@gmail.com> r=glob,justdave a=justdave
This commit is contained in:
Родитель
8eb3a01684
Коммит
8374a27bd7
|
@ -308,6 +308,8 @@ if ($action eq 'update') {
|
|||
SET name=? WHERE id=?");
|
||||
$sth->execute($classification,$classification_id);
|
||||
$vars->{'updated_classification'} = 1;
|
||||
|
||||
unlink "$datadir/versioncache";
|
||||
}
|
||||
|
||||
if ($description ne $descriptionold) {
|
||||
|
@ -316,11 +318,12 @@ if ($action eq 'update') {
|
|||
WHERE id=?");
|
||||
$sth->execute($description,$classification_id);
|
||||
$vars->{'updated_description'} = 1;
|
||||
|
||||
unlink "$datadir/versioncache";
|
||||
}
|
||||
|
||||
$dbh->bz_unlock_tables();
|
||||
|
||||
unlink "$datadir/versioncache";
|
||||
LoadTemplate($action);
|
||||
}
|
||||
|
||||
|
|
|
@ -325,24 +325,19 @@ sub GetKeywordIdFromName {
|
|||
$::VersionTableLoaded = 0;
|
||||
sub GetVersionTable {
|
||||
return if $::VersionTableLoaded;
|
||||
my $mtime = file_mod_time("$datadir/versioncache");
|
||||
if (!defined $mtime || $mtime eq "" || !-r "$datadir/versioncache") {
|
||||
$mtime = 0;
|
||||
}
|
||||
if (time() - $mtime > 3600) {
|
||||
use Bugzilla::Token;
|
||||
Bugzilla::Token::CleanTokenTable() if Bugzilla->dbwritesallowed;
|
||||
my $file_generated = 0;
|
||||
if (!-r "$datadir/versioncache") {
|
||||
GenerateVersionTable();
|
||||
$file_generated = 1;
|
||||
}
|
||||
require "$datadir/versioncache";
|
||||
if (!defined %::versions) {
|
||||
if (!defined %::versions && !$file_generated) {
|
||||
GenerateVersionTable();
|
||||
do "$datadir/versioncache";
|
||||
|
||||
}
|
||||
if (!defined %::versions) {
|
||||
die "Can't generate file $datadir/versioncache";
|
||||
}
|
||||
}
|
||||
$::VersionTableLoaded = 1;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче