diff options
author | lpsolit%gmail.com <> | 2005-07-19 23:52:59 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2005-07-19 23:52:59 +0200 |
commit | 59b918bbce20a2258d25443bb01dbd99255f1d54 (patch) | |
tree | 945bfaa050e8fb98967e1616a55f4e35b74039b1 | |
parent | 20e0d1f73fdaf8954941ce65d0a976d1c620e954 (diff) | |
download | bugzilla-59b918bbce20a2258d25443bb01dbd99255f1d54.tar.gz bugzilla-59b918bbce20a2258d25443bb01dbd99255f1d54.tar.xz |
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
-rwxr-xr-x | editclassifications.cgi | 5 | ||||
-rw-r--r-- | globals.pl | 19 |
2 files changed, 11 insertions, 13 deletions
diff --git a/editclassifications.cgi b/editclassifications.cgi index 5c01616b6..737db21d5 100755 --- a/editclassifications.cgi +++ b/editclassifications.cgi @@ -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); } diff --git a/globals.pl b/globals.pl index 89e70e0a8..780e85e0b 100644 --- a/globals.pl +++ b/globals.pl @@ -325,23 +325,18 @@ 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"; - } + } + if (!defined %::versions) { + die "Can't generate file $datadir/versioncache"; } $::VersionTableLoaded = 1; } |