Changeset 1662

Show
Ignore:
Timestamp:
03/02/10 13:44:43 (5 months ago)
Author:
martin
Message:

Added html purifier cache dir creation to ullCorePluginConfiguration

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/ullCorePlugin/config/ullCorePluginConfiguration.class.php

    r1538 r1662  
    2323    // KU: 2009-11-19: disabled apc cache because of typical caching problems. 
    2424    //   let's see if we really need it. 
    25 //    if (extension_loaded('apc')) 
    26 //    { 
    27 //      $cacheDriver = new Doctrine_Cache_Apc();     
    28 //    } 
    29 //    else 
    30 //    { 
    31       // Array cache driver only caches during a single request 
    32       $cacheDriver = new Doctrine_Cache_Array(); 
    33 //    } 
     25    //    if (extension_loaded('apc')) 
     26    //    { 
     27    //      $cacheDriver = new Doctrine_Cache_Apc();     
     28    //    } 
     29    //    else 
     30    //    { 
     31          // Array cache driver only caches during a single request 
     32            $cacheDriver = new Doctrine_Cache_Array(); 
     33    //    } 
    3434 
    35 //    $manager->setAttribute(Doctrine::ATTR_RESULT_CACHE_LIFESPAN, 60 * 5); 
     35    //    $manager->setAttribute(Doctrine::ATTR_RESULT_CACHE_LIFESPAN, 60 * 5); 
    3636 
    3737    $manager->setAttribute(Doctrine::ATTR_RESULT_CACHE, $cacheDriver);  
    38       
    3938     
    4039    // disabled because ist has sideeffects which have to be investigated (i18n, ...) 
     
    4342    // disabled because ist has sideeffects which have to be investigated 
    4443    // $manager->setAttribute('use_dql_callbacks', true); 
     44     
     45    $this->createHTMLPurifierCache(); 
    4546  } 
    4647 
     48  /** 
     49   * Create cache dir tree for HTML Purifier if not already available 
     50   */ 
     51  protected function createHTMLPurifierCache() 
     52  { 
     53    $purifierCachePath = sfConfig::get('sf_cache_dir') . DIRECTORY_SEPARATOR . 'htmlpurifier'; 
     54     
     55    if (!file_exists($purifierCachePath)) 
     56    { 
     57      mkdir($purifierCachePath, 0755); 
     58       
     59      foreach(array('HTML', 'CSS', 'URI') as $type) 
     60      { 
     61        mkdir($purifierCachePath . DIRECTORY_SEPARATOR . $type, 0777, true); 
     62        //set perms again because of interfering umask 
     63        chmod($purifierCachePath . DIRECTORY_SEPARATOR . $type, 0777); 
     64      } 
     65    } 
     66     
     67    sfConfig::add(array('htmlpurifier_cache_dir' => $purifierCachePath)); 
     68  } 
    4769}