1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-14 10:05:59 +02:00

no need for user to call setDocRoot()

This commit is contained in:
Steve Clay
2011-09-03 20:39:25 -04:00
parent 2f11b725b8
commit 9a1f306305
3 changed files with 14 additions and 6 deletions

View File

@@ -228,9 +228,6 @@ $(function () {
$content = ob_get_clean();
// setup Minify
if (0 === stripos(PHP_OS, 'win')) {
Minify::setDocRoot(); // we may be on IIS
}
Minify::setCache(
isset($min_cachePath) ? $min_cachePath : ''
,$min_cacheFileLocking

View File

@@ -25,8 +25,7 @@ Minify::setCache(
if ($min_documentRoot) {
$_SERVER['DOCUMENT_ROOT'] = $min_documentRoot;
} elseif (0 === stripos(PHP_OS, 'win')) {
Minify::setDocRoot(); // IIS may need help
Minify::$isDocRootSet = true;
}
$min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks;

View File

@@ -59,7 +59,14 @@ class Minify {
* @var string $importWarning
*/
public static $importWarning = "/* See http://code.google.com/p/minify/wiki/CommonProblems#@imports_can_appear_in_invalid_locations_in_combined_CSS_files */\n";
/**
* Has the DOCUMENT_ROOT been set in user code?
*
* @var bool
*/
public static $isDocRootSet = false;
/**
* Specify a cache object (with identical interface as Minify_Cache_File) or
* a path to use with Minify_Cache_File.
@@ -160,6 +167,10 @@ class Minify {
*/
public static function serve($controller, $options = array())
{
if (! self::$isDocRootSet && 0 === stripos(PHP_OS, 'win')) {
self::setDocRoot();
}
if (is_string($controller)) {
// make $controller into object
$class = 'Minify_Controller_' . $controller;
@@ -400,6 +411,7 @@ class Minify {
require_once 'Minify/Logger.php';
Minify_Logger::log("setDocRoot() set DOCUMENT_ROOT to \"{$_SERVER['DOCUMENT_ROOT']}\"");
}
self::$isDocRootSet = true;
}
/**