]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 278791 : Move ModTime() to Bugzilla::Util
authortravis%sedsystems.ca <>
Fri, 28 Jan 2005 04:08:33 +0000 (04:08 +0000)
committertravis%sedsystems.ca <>
Fri, 28 Jan 2005 04:08:33 +0000 (04:08 +0000)
Patch by Max K-A <mkanat@kerio.com>   r=vladd   a=justdave

Bugzilla/Util.pm
globals.pl
showdependencygraph.cgi

index b832d16987e16f24d2da67c3cdf47a7bc1a2fa71..e5207af786df530182aa9823dc70e82034aed382 100644 (file)
@@ -33,7 +33,8 @@ use base qw(Exporter);
                              css_class_quote
                              lsearch max min
                              trim diff_strings
-                             format_time format_time_decimal);
+                             format_time format_time_decimal
+                             file_mod_time);
 
 use Bugzilla::Config;
 use Bugzilla::Error;
@@ -223,6 +224,14 @@ sub format_time_decimal {
     return $newtime;
 }
 
+sub file_mod_time ($) {
+    my ($filename) = (@_);
+    my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
+        $atime,$mtime,$ctime,$blksize,$blocks)
+        = stat($filename);
+    return $mtime;
+}
+
 sub ValidateDate {
     my ($date, $format) = @_;
 
@@ -272,6 +281,9 @@ Bugzilla::Util - Generic utility functions for bugzilla
   # Functions for formatting time
   format_time($time);
 
+  # Functions for dealing with files
+  $time = file_mod_time($filename);
+
 =head1 DESCRIPTION
 
 This package contains various utility functions which do not belong anywhere
@@ -408,6 +420,13 @@ shown in different formats.
 Returns a number with 2 digit precision, unless the last digit is a 0. Then it 
 returns only 1 digit precision.
 
+=head2 Files
+
+=over 4
+
+=item C<file_mod_time($filename)>
+
+Takes a filename and returns the modification time. It returns it in the format of the "mtime" parameter of the perl "stat" function.
 
 =back
 
index 32dc64a6d7ae6d34130bf7161b4851fe48f6170c..0c1ba852bb66eb454391cb255f3a4476df9d042c 100644 (file)
@@ -352,22 +352,10 @@ sub GetKeywordIdFromName {
 }
 
 
-
-
-# Returns the modification time of a file.
-
-sub ModTime {
-    my ($filename) = (@_);
-    my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
-        $atime,$mtime,$ctime,$blksize,$blocks)
-        = stat($filename);
-    return $mtime;
-}
-
 $::VersionTableLoaded = 0;
 sub GetVersionTable {
     return if $::VersionTableLoaded;
-    my $mtime = ModTime("$datadir/versioncache");
+    my $mtime = file_mod_time("$datadir/versioncache");
     if (!defined $mtime || $mtime eq "" || !-r "$datadir/versioncache") {
         $mtime = 0;
     }
index 0d33d316d6275a76518a8f2d9c326f92040472cc..da7f0d7b84d42e8bc255e1370b7338f71d413269 100755 (executable)
@@ -28,6 +28,7 @@ use lib qw(.);
 use File::Temp;
 use Bugzilla;
 use Bugzilla::Config qw(:DEFAULT $webdotdir);
+use Bugzilla::Util;
 
 require "CGI.pl";
 
@@ -271,7 +272,7 @@ foreach my $f (@files)
     # symlinks), this can't escape to delete anything it shouldn't
     # (unless someone moves the location of $webdotdir, of course)
     trick_taint($f);
-    if (ModTime($f) < $since) {
+    if (file_mod_time($f) < $since) {
         unlink $f;
     }
 }