@@ -59,14 +59,14 @@ public function getPattern()
59
59
}
60
60
61
61
/**
62
- * Returns true if the resource has not been updated since the given timestamp.
63
- *
64
- * @param integer $timestamp The last time the resource was loaded
62
+ * Returns resource mtime.
65
63
*
66
- * @return Boolean true if the resource has not been updated, false otherwise
64
+ * @return integer
67
65
*/
68
- public function isFresh ( $ timestamp )
66
+ public function getModificationTime ( )
69
67
{
68
+ clearstatcache (true , $ this ->resource );
69
+
70
70
if (!is_dir ($ this ->resource )) {
71
71
return false ;
72
72
}
@@ -84,10 +84,37 @@ public function isFresh($timestamp)
84
84
continue ;
85
85
}
86
86
87
+ clearstatcache (true , (string ) $ file );
87
88
$ newestMTime = max ($ file ->getMTime (), $ newestMTime );
88
89
}
89
90
90
- return $ newestMTime < $ timestamp ;
91
+ return $ newestMTime ;
92
+ }
93
+
94
+ /**
95
+ * Returns true if the resource has not been updated since the given timestamp.
96
+ *
97
+ * @param integer $timestamp The last time the resource was loaded
98
+ *
99
+ * @return Boolean true if the resource has not been updated, false otherwise
100
+ */
101
+ public function isFresh ($ timestamp )
102
+ {
103
+ if (!$ this ->exists ()) {
104
+ return false ;
105
+ }
106
+
107
+ return $ this ->getModificationTime () <= $ timestamp ;
108
+ }
109
+
110
+ /**
111
+ * Returns true if the resource exists in the filesystem.
112
+ *
113
+ * @return Boolean
114
+ */
115
+ public function exists ()
116
+ {
117
+ return file_exists ($ this ->resource );
91
118
}
92
119
93
120
public function serialize ()
0 commit comments