mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding fix for Ticket #2239
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4658 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
3b90fdbe2e
commit
7cc6185076
1 changed files with 26 additions and 28 deletions
|
@ -32,10 +32,7 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
|||
/**
|
||||
* Enter description here...
|
||||
*/
|
||||
require(CONFIGS . 'paths.php');
|
||||
require(CAKE . 'basics.php');
|
||||
require(LIBS . 'folder.php');
|
||||
require(LIBS . 'file.php');
|
||||
uses('file');
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
|
@ -45,11 +42,11 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
|||
*/
|
||||
function make_clean_css($path, $name) {
|
||||
require(VENDORS . 'csspp' . DS . 'csspp.php');
|
||||
$data =file_get_contents($path);
|
||||
$csspp =new csspp();
|
||||
$output=$csspp->compress($data);
|
||||
$ratio =100 - (round(strlen($output) / strlen($data), 3) * 100);
|
||||
$output=" /* file: $name, ratio: $ratio% */ " . $output;
|
||||
$data = file_get_contents($path);
|
||||
$csspp = new csspp();
|
||||
$output = $csspp->compress($data);
|
||||
$ratio = 100 - (round(strlen($output) / strlen($data), 3) * 100);
|
||||
$output = " /* file: $name, ratio: $ratio% */ " . $output;
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
|
@ -63,7 +60,7 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
|||
if (!is_dir(dirname($path))) {
|
||||
mkdir(dirname($path));
|
||||
}
|
||||
$cache=new File($path);
|
||||
$cache = new File($path);
|
||||
return $cache->write($content);
|
||||
}
|
||||
|
||||
|
@ -80,18 +77,19 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
|||
}
|
||||
|
||||
if (file_exists($cachepath)) {
|
||||
$templateModified=filemtime($filepath);
|
||||
$cacheModified =filemtime($cachepath);
|
||||
$templateModified = filemtime($filepath);
|
||||
$cacheModified = filemtime($cachepath);
|
||||
|
||||
if ($templateModified > $cacheModified) {
|
||||
$output=make_clean_css($filepath, $filename);
|
||||
$output = make_clean_css($filepath, $filename);
|
||||
write_css_cache($cachepath, $output);
|
||||
} else {
|
||||
$output = file_get_contents($cachepath);
|
||||
}
|
||||
} else {
|
||||
$output=make_clean_css($filepath, $filename);
|
||||
$output = make_clean_css($filepath, $filename);
|
||||
write_css_cache($cachepath, $output);
|
||||
$templateModified = time();
|
||||
}
|
||||
|
||||
header("Date: " . date("D, j M Y G:i:s ", $templateModified) . 'GMT');
|
||||
|
|
Loading…
Reference in a new issue