Development

Changeset 28656

You must first sign up to be able to contribute.

Changeset 28656

Show
Ignore:
Timestamp:
03/21/10 23:34:03 (3 years ago)
Author:
rande
Message:

[swCombinePlugin] add version management, add more note

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/swCombinePlugin/trunk/README

    r28585 r28656  
    3737           } 
    3838        } 
     39 
     40 * edit your app.yml file and add an optional version value 
    3941  
     42        [yaml] 
     43        swToolbox: 
     44          swCombine: 
     45            # the version number can be used to force load of new files from the media server 
     46            #   you can configure a never ending expired time on your media server 
     47            #   if the version is never updated, media will be never reloaded ... 
     48            version: 3 
     49   
    4050 * add a config_handlers.yml inside APP/config 
    4151  
    4252        [yaml] 
    4353        modules/*/config/view.yml: 
    44           class:    swCombineViewConfigHandler 
     54          # put sfViewConfigHandler to restore the default symfony config handler 
     55          # class: sfViewConfigHandler 
     56          class: swCombineViewConfigHandler  
    4557          param: 
    46            enabled: true 
    4758           private_path: %SF_WEB_DIR%/sw-combine 
    4859           public_path:  /sw-combine 
    4960           configuration: 
    5061             javascript: 
    51                enabled:  true 
    5262               combine:  swCombineJavascript 
    5363               driver:   swDriverJSMinPlus 
     
    7787 
    7888             stylesheet: 
    79                enabled:  true 
    8089               combine:  swCombineStylesheet 
    8190               driver:   swDriverCssmin 
  • plugins/swCombinePlugin/trunk/lib/combine/swCombineJavascript.class.php

    r28585 r28656  
    2424    $this->paths    = array(); 
    2525     
    26     // echo `cat $asset`; 
    2726    $contents = @file_get_contents($asset); 
    2827     
    29  
    3028    if(!$contents) 
    3129    { 
  • plugins/swCombinePlugin/trunk/lib/combine/swCombineStylesheet.class.php

    r28585 r28656  
    4343    // get the version, otherwise set to the current time 
    4444    // so each time the cache is cleared then the image are reload from the webserver 
    45     $version = sfConfig::get('app_sfCombinePlugin_asset_version', strtotime('now')); 
     45    $version = sfConfig::get('app_swCombine_asset_version', strtotime('now')); 
    4646     
    4747    $pattern = '/url\(("|\'|)(.*)("|\'|)\)/smU'; 
  • plugins/swCombinePlugin/trunk/lib/config/swCombineViewConfigHandler.class.php

    r28585 r28656  
    2727  protected function addHtmlAsset($viewName = '') 
    2828  { 
     29     
    2930    // Merge the current view's stylesheets with the app's default stylesheets 
    3031    $stylesheets = $this->mergeConfigValue('stylesheets', $viewName); 
    3132    $stylesheets = $this->combineValues('stylesheet', $stylesheets, $viewName); 
    32        
     33     
    3334    $css = $this->addAssets('Stylesheet', $stylesheets); 
    3435   
     
    145146  public function getCombinedName($type, array $assets) 
    146147  { 
    147     // TODO : add the media revision number in the hash 
    148148    $format = $this->getParameterHolder()->get('configuration['.$type.'][filename]', '%s'); 
    149149 
     
    161161    sort($assets); 
    162162     
    163     return sprintf($format, md5(serialize($assets))); 
     163    // compute the name 
     164    $name =  md5(serialize($assets)); 
     165     
     166    return sprintf($format, $name); 
    164167  } 
    165168   
    166169  public function getPackageName($type, $name) 
    167170  { 
    168     // TODO : add the media revision number in the hash 
    169     $format = $this->getParameterHolder()->get('configuration['.$type.'][filename]', '%s'); 
    170       
    171      // var_dump(sprintf($format, md5(sfInflector::underscore('package_'.$type.'_'.$name)))); die(); 
    172     return sprintf($format, md5(sfInflector::underscore('package_'.$type.'_'.$name))); 
     171    $format  = $this->getParameterHolder()->get('configuration['.$type.'][filename]', '%s'); 
     172    $name    = md5(sfInflector::underscore('package_'.$type.'_'.$name)); 
     173     
     174    return sprintf($format, $name); 
    173175  } 
    174176