-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More of cache expired as override class and file removal at WP_DEBUG
- Loading branch information
Andreas Ek
committed
May 10, 2016
1 parent
789a83f
commit c897b92
Showing
6 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
namespace Bladerunner; | ||
|
||
use Illuminate\View\Compilers\BladeCompiler; | ||
use Illuminate\Filesystem\Filesystem; | ||
|
||
class WPCompiler extends BladeCompiler | ||
{ | ||
/** | ||
* Determine if the view at the given path is expired. | ||
* | ||
* @param string $path | ||
* @return bool | ||
*/ | ||
public function isExpired($path) | ||
{ | ||
if (defined('WP_DEBUG') && true === WP_DEBUG) { | ||
return true; | ||
} | ||
|
||
$compiled = $this->getCompiledPath($path); | ||
|
||
// If the compiled file doesn't exist we will indicate that the view is expired | ||
// so that it can be re-compiled. Else, we will verify the last modification | ||
// of the views is less than the modification times of the compiled views. | ||
if (! $this->cachePath || ! $this->files->exists($compiled)) { | ||
return true; | ||
} | ||
|
||
$lastModified = $this->files->lastModified($path); | ||
|
||
return $lastModified >= $this->files->lastModified($compiled); | ||
} | ||
} |