Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

no need for user to call setDocRoot()

  • Loading branch information...
commit 6d5a173664b373cdb6e5aeef7689f68fe7e745d0 1 parent b8a8ae6
Steve Clay authored September 04, 2011 acidvertigo committed December 07, 2011
3  min/builder/index.php
@@ -228,9 +228,6 @@
228 228
 $content = ob_get_clean();
229 229
 
230 230
 // setup Minify
231  
-if (0 === stripos(PHP_OS, 'win')) {
232  
-    Minify::setDocRoot(); // we may be on IIS
233  
-}
234 231
 Minify::setCache(
235 232
     isset($min_cachePath) ? $min_cachePath : ''
236 233
     ,$min_cacheFileLocking
3  min/index.php
@@ -25,8 +25,7 @@
25 25
 
26 26
 if ($min_documentRoot) {
27 27
     $_SERVER['DOCUMENT_ROOT'] = $min_documentRoot;
28  
-} elseif (0 === stripos(PHP_OS, 'win')) {
29  
-    Minify::setDocRoot(); // IIS may need help
  28
+    Minify::$isDocRootSet = true;
30 29
 }
31 30
 
32 31
 $min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks;
14  min/lib/Minify.php
@@ -59,7 +59,14 @@ class Minify {
59 59
      * @var string $importWarning
60 60
      */
61 61
     public static $importWarning = "/* See http://code.google.com/p/minify/wiki/CommonProblems#@imports_can_appear_in_invalid_locations_in_combined_CSS_files */\n";
62  
-    
  62
+
  63
+    /**
  64
+     * Has the DOCUMENT_ROOT been set in user code?
  65
+     * 
  66
+     * @var bool
  67
+     */
  68
+    public static $isDocRootSet = false;
  69
+
63 70
     /**
64 71
      * Specify a cache object (with identical interface as Minify_Cache_File) or
65 72
      * a path to use with Minify_Cache_File.
@@ -160,6 +167,10 @@ public static function setCache($cache = '', $fileLocking = true)
160 167
      */
161 168
     public static function serve($controller, $options = array())
162 169
     {
  170
+        if (! self::$isDocRootSet && 0 === stripos(PHP_OS, 'win')) {
  171
+            self::setDocRoot();
  172
+        }
  173
+
163 174
         if (is_string($controller)) {
164 175
             // make $controller into object
165 176
             $class = 'Minify_Controller_' . $controller;
@@ -401,6 +412,7 @@ public static function setDocRoot($unsetPathInfo = false)
401 412
             require_once 'Minify/Logger.php';
402 413
             Minify_Logger::log("setDocRoot() set DOCUMENT_ROOT to \"{$_SERVER['DOCUMENT_ROOT']}\"");
403 414
         }
  415
+        self::$isDocRootSet = true;
404 416
     }
405 417
     
406 418
     /**

0 notes on commit 6d5a173

Please sign in to comment.
Something went wrong with that request. Please try again.