File tree 3 files changed +21
-1
lines changed
3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,14 @@ abstract class Compiler
42
42
*
43
43
* @var string
44
44
*/
45
- protected $ compiledExtension = 'php ' ;
45
+ protected $ compiledExtension ;
46
+
47
+ /**
48
+ * Determines if view cache timestamps should be ignored.
49
+ *
50
+ * @var bool
51
+ */
52
+ protected $ ignoreCacheTimestamps ;
46
53
47
54
/**
48
55
* Create a new compiler instance.
@@ -61,6 +68,7 @@ public function __construct(
61
68
$ basePath = '' ,
62
69
$ shouldCache = true ,
63
70
$ compiledExtension = 'php ' ,
71
+ $ ignoreCacheTimestamps = false ,
64
72
) {
65
73
if (! $ cachePath ) {
66
74
throw new InvalidArgumentException ('Please provide a valid cache path. ' );
@@ -71,6 +79,7 @@ public function __construct(
71
79
$ this ->basePath = $ basePath ;
72
80
$ this ->shouldCache = $ shouldCache ;
73
81
$ this ->compiledExtension = $ compiledExtension ;
82
+ $ this ->ignoreCacheTimestamps = $ ignoreCacheTimestamps ;
74
83
}
75
84
76
85
/**
@@ -94,6 +103,10 @@ public function getCompiledPath($path)
94
103
*/
95
104
public function isExpired ($ path )
96
105
{
106
+ if ($ this ->ignoreCacheTimestamps ) {
107
+ return false ;
108
+ }
109
+
97
110
if (! $ this ->shouldCache ) {
98
111
return true ;
99
112
}
Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ public function registerBladeCompiler()
100
100
$ app ['config ' ]->get ('view.relative_hash ' , false ) ? $ app ->basePath () : '' ,
101
101
$ app ['config ' ]->get ('view.cache ' , true ),
102
102
$ app ['config ' ]->get ('view.compiled_extension ' , 'php ' ),
103
+ $ app ['config ' ]->get ('view.ignore_cache_timestamps ' , false ),
103
104
), function ($ blade ) {
104
105
$ blade ->component ('dynamic-component ' , DynamicComponent::class);
105
106
});
Original file line number Diff line number Diff line change @@ -55,6 +55,12 @@ public function testIsExpiredReturnsTrueWhenUseCacheIsFalse()
55
55
$ this ->assertTrue ($ compiler ->isExpired ('foo ' ));
56
56
}
57
57
58
+ public function testIsExpiredReturnsFalseWhenIgnoreCacheTimestampsIsTrue ()
59
+ {
60
+ $ compiler = new BladeCompiler ($ this ->getFiles (), __DIR__ , $ ignoreCacheTimestamps = true );
61
+ $ this ->assertFalse ($ compiler ->isExpired ('foo ' ));
62
+ }
63
+
58
64
public function testCompilePathIsProperlyCreated ()
59
65
{
60
66
$ compiler = new BladeCompiler ($ this ->getFiles (), __DIR__ );
You can’t perform that action at this time.
0 commit comments