Changeset 837

Show
Ignore:
Timestamp:
08/15/07 14:32:32 (11 months ago)
Author:
mikey
Message:

bugfix: allow subdirectories in stub:include

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/examples/config/xml/pages/txt/main_index.xml

    r705 r837  
    2727 
    2828      <!-- This is an include from a different file --> 
    29       <stub:include part="disclaimer" href="parts.xml"/> 
     29      <stub:include part="disclaimer" href="include/parts.xml"/> 
    3030    </div> 
    3131 
  • trunk/src/main/php/net/stubbles/xml/stubXMLXIncludeStreamWrapper.php

    r533 r837  
    9898    public static function setCachePath($cachePath) 
    9999    { 
    100         self::$cachePath = $cachePath
    101         if (file_exists($cachePath . '/xml') == false) { 
    102             if (!@mkdir($cachePath . '/xml', 0700, true)) { 
    103                 throw new stubException("Can not create cache directory at " . $cachePath . '/xml.'); 
     100        self::$cachePath = $cachePath . '/xml/xinc'
     101        if (file_exists($cachePath) == false) { 
     102            if (!@mkdir($cachePath, 0700, true)) { 
     103                throw new stubException("Can not create cache directory " . $cachePath . '.'); 
    104104            } 
    105105        } 
     
    288288        list($fileName, $part) = sscanf($path, 'xinc://%[^?]?part=%[^$]'); 
    289289        $this->fileName        = $fileName; 
     290        $this->part            = $part; 
     291        $language              = ''; 
    290292        if (self::$xslProcessor->hasParameter('', 'lang') == true) { 
    291             $language = self::$xslProcessor->getParameter('', 'lang') . '_'; 
    292         } else { 
    293             $language = ''; 
    294         } 
    295         $this->cachedFileName  = self::$cachePath . '/xml/' . $language  . $fileName; 
    296         $this->part            = $part; 
     293            $language = self::$xslProcessor->getParameter('', 'lang'); 
     294        } 
     295         
     296        $this->cachedFileName = self::$cachePath . '/' . $language  . '/' . $fileName; 
     297        if (file_exists(dirname($this->cachedFileName)) === false) { 
     298            mkdir(dirname($this->cachedFileName), 0700, true); 
     299        } 
    297300    } 
    298301}