Changeset 2595


Ignore:
Timestamp:
04/20/10 08:08:44 (14 years ago)
Author:
amuller
Message:

Ticket #1036 - Força regerar o pacote toda vez que um js é mais novo que o pacote

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/inc/class.javascript.inc.php

    r2580 r2595  
    132132                                                                foreach($files as $file => $ignored) 
    133133                                                                { 
     134                                                                        $jsFilePath=PHPGW_INCLUDE_ROOT.SEP.$app.SEP.'js'.SEP.$pkg.SEP.$file.'.js'; 
    134135                                                                        if ($GLOBALS['phpgw_info']['server']['jspacker'] == "True") 
    135136                                                                        { 
    136137 
    137                                                                                 if (!file_exists(PHPGW_INCLUDE_ROOT.SEP.$app.SEP.'js'.SEP.$pkg.SEP.$pkg.'.jspack.js')) 
     138                                                                                $packFilePath=PHPGW_INCLUDE_ROOT.SEP.$app.SEP.'js'.SEP.$pkg.SEP.$pkg.'.jspack.js'; 
     139                                                                                if (filemtime($jsFilePath) > filemtime($packFilePath)) // Is newer 
    138140                                                                                { 
    139                                                                                         $filePath=PHPGW_INCLUDE_ROOT.SEP.$app.SEP.'js'.SEP.$pkg.SEP.$file.'.js'; 
    140                                                                                         $script .= file_get_contents($filePath); 
     141                                                                                        $regeratePack = True; 
    141142                                                                                } 
     143                                                                                $script .= file_get_contents($jsFilePath); 
    142144                                                                        } 
    143145                                                                        else 
    144146                                                                        { 
    145                                                                                 $_file = PHPGW_INCLUDE_ROOT . SEP . $app . SEP . 'js' . SEP . $pkg . SEP. $file . '.js'; 
    146  
    147147                                                                                $links .= '<script type="text/javascript" src="' 
    148148                                                                                        . $GLOBALS['phpgw_info']['server']['webserver_url'] 
    149                                                                                         . "/$app/js/$pkg/$file" . '.js?' . filemtime( $_file ) . '">' 
     149                                                                                        . "/$app/js/$pkg/$file" . '.js?' . filemtime( $jsFilePath ) . '">' 
    150150                                                                                        . "</script>\n"; 
    151151                                                                        } 
     
    157157                                                        if ($GLOBALS['phpgw_info']['server']['jspacker'] == "True") 
    158158                                                        { 
    159                                                                 $filePath=PHPGW_INCLUDE_ROOT.SEP.$app.SEP.'js'.SEP.$pkg.SEP.$pkg.'.jspack.js'; 
    160                                                                 if (!file_exists($filePath)) 
     159                                                                if (!file_exists($packFilePath) || $regeratePack) 
    161160                                                                { 
    162                                                                         $fp = fopen($filePath, 'w'); 
     161                                                                        $fp = fopen($packFilePath, 'w'); 
    163162                                                                        require_once('class.JavaScriptPacker.php'); 
    164163                                                                        $packer = new JavaScriptPacker($script, 'High ASCII', true, true); 
Note: See TracChangeset for help on using the changeset viewer.