Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -11,7 +11,7 @@
|
||||
namespace IPS\Theme\Cache;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -54,7 +54,7 @@ class _Template extends \IPS\Theme\Template
|
||||
{
|
||||
parent::__construct( $app, $templateLocation, $templateName );
|
||||
|
||||
static::$theme = \IPS\Theme::$memberTheme;
|
||||
static::$theme = ( \IPS\Dispatcher::hasInstance() AND class_exists( '\IPS\Dispatcher', FALSE ) and \IPS\Dispatcher::i()->controllerLocation === 'admin' ) ? \IPS\Theme::$adminSkin : \IPS\Theme::$memberTheme;
|
||||
|
||||
if ( ! static::$theme->cache_key )
|
||||
{
|
||||
@@ -79,11 +79,26 @@ class _Template extends \IPS\Theme\Template
|
||||
if ( file_exists( static::$file ) )
|
||||
{
|
||||
/* For FLOCK to work when setting, we need to flock when reading https://bugs.php.net/bug.php?id=52895 */
|
||||
$f = fopen( static::$file, 'r' );
|
||||
flock( $f, LOCK_SH );
|
||||
include_once( static::$file );
|
||||
flock( $f, LOCK_UN );
|
||||
fclose( $f );
|
||||
try
|
||||
{
|
||||
$f = fopen( static::$file, 'r' );
|
||||
flock( $f, LOCK_SH );
|
||||
include_once( static::$file );
|
||||
flock( $f, LOCK_UN );
|
||||
fclose( $f );
|
||||
}
|
||||
catch( \ParseError $e )
|
||||
{
|
||||
@unlink( static::$file );
|
||||
|
||||
/* Clear zend opcache if enabled */
|
||||
if ( \function_exists( 'opcache_invalidate' ) )
|
||||
{
|
||||
@opcache_invalidate( static::$file );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$class = "\\IPS\\Theme\\Cache\\" . \IPS\Theme::overloadHooks( static::$className, "IPS\\Theme\\Cache" );
|
||||
|
||||
@@ -96,7 +111,7 @@ class _Template extends \IPS\Theme\Template
|
||||
@unlink( static::$file );
|
||||
|
||||
/* Clear zend opcache if enabled */
|
||||
if ( function_exists( 'opcache_invalidate' ) )
|
||||
if ( \function_exists( 'opcache_invalidate' ) )
|
||||
{
|
||||
@opcache_invalidate( static::$file );
|
||||
}
|
||||
@@ -154,8 +169,10 @@ class _Template extends \IPS\Theme\Template
|
||||
$result = (bool) @\file_put_contents( static::$file, $template );
|
||||
}
|
||||
|
||||
@chmod( static::$file, \IPS\IPS_FILE_PERMISSION );
|
||||
|
||||
/* Clear zend opcache if enabled */
|
||||
if ( function_exists( 'opcache_invalidate' ) )
|
||||
if ( \function_exists( 'opcache_invalidate' ) )
|
||||
{
|
||||
@opcache_invalidate( static::$file );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user