Part of the EllisLab Network
   
2 of 6
2
AssetLibPro - An advanced CI Asset Library
Posted: 22 May 2008 09:17 AM   [ Ignore ]   [ # 11 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  162
Joined  02-14-2007

line 274 has:

$this->_unlink_old_caches($this->cache_dir_css, $this->cache_file_js[$group]);

I think it should be

$this->_unlink_old_caches($this->cache_dir_js, $this->cache_file_js[$group]);
 Signature 

Trying to do it right the first time! whoops guess that didn’t work out so well…

Profile
 
 
Posted: 22 May 2008 09:29 AM   [ Ignore ]   [ # 12 ]  
Grad Student
Avatar
Rank
Total Posts:  65
Joined  03-17-2008

uh, yeah… evil copy & paste mad
I’ll fix that a.s.a.p
Way too busy right now, though.

 Signature 

AssetLibPro - An advanced CI Asset Library
Improving CI’s native Caching

Profile
 
 
Posted: 28 May 2008 01:05 AM   [ Ignore ]   [ # 13 ]  
Summer Student
Total Posts:  9
Joined  10-17-2007

Hi guys,

Nice work on this library!

I really like what you got there but i think there’s a problem with it (correct me if i’m wrong)...
Even if the resulting file is already in cache you still read its contents (when you call add_css)? whats the point of doing that?


Please give me a feedback, I really want to use the library smile
Fabio

Profile
 
 
Posted: 28 May 2008 06:57 AM   [ Ignore ]   [ # 14 ]  
Grad Student
Avatar
Rank
Total Posts:  65
Joined  03-17-2008
fgrehm - 28 May 2008 01:05 AM

Hi guys,

Nice work on this library!

I really like what you got there but i think there’s a problem with it (correct me if i’m wrong)...
Even if the resulting file is already in cache you still read its contents (when you call add_css)? whats the point of doing that?


Please give me a feedback, I really want to use the library smile
Fabio

Sory, what do you mean exactly?

 Signature 

AssetLibPro - An advanced CI Asset Library
Improving CI’s native Caching

Profile
 
 
Posted: 28 May 2008 07:50 AM   [ Ignore ]   [ # 15 ]  
Summer Student
Total Posts:  9
Joined  10-17-2007

On the _add method we’ve got these lines:

if ($fileinfo['extension'] === 'js' || $fileinfo['extension'] === 'css') {
                $this
->_assets[$fileinfo['extension']][$group][$file_path] = file_get_contents($file);
                if (!
in_array($group,$this->asset_groups[$fileinfo['extension']]))
                    
$this->asset_groups[$fileinfo['extension']][] = $group;
            
}

I think ‘file_get_contents’ should only be called when the resulting cache file doesn’t exists. The way it is, we read file contents even if the cache exists.

This is the way i think it should be done:
- Add js / ccs path to $this->_assets array (only the file path and not its contents)
- When output($type) method is called, the hash is calculated
- If the cache file doesn’t exists, read all assets contents and generate it


I hope you undertand now smile

Fabio
PS: Sorry about my english, it’s been a while since I wrote something in english raspberry

Profile
 
 
Posted: 28 May 2008 07:55 AM   [ Ignore ]   [ # 16 ]  
Grad Student
Avatar
Rank
Total Posts:  65
Joined  03-17-2008

Okay, thanks. I’ll take a look later today.
Expect a fix then wink

 Signature 

AssetLibPro - An advanced CI Asset Library
Improving CI’s native Caching

Profile
 
 
Posted: 31 May 2008 05:07 PM   [ Ignore ]   [ # 17 ]  
Grad Student
Avatar
Rank
Total Posts:  65
Joined  03-17-2008
TheLoops - 28 May 2008 07:55 AM

Okay, thanks. I’ll take a look later today.
Expect a fix then wink

See first post for update.

 Signature 

AssetLibPro - An advanced CI Asset Library
Improving CI’s native Caching

Profile
 
 
Posted: 02 June 2008 08:10 PM   [ Ignore ]   [ # 18 ]  
Grad Student
Rank
Total Posts:  75
Joined  01-02-2008

Ps: Don’t forget to leave a comment if you like it (or don’t) wink

I didn’t!

private function _add($file, $group = NULL) {
    $file_path
= $file;
    if (
$group === NULL)
        return
FALSE;
            
    
$file = realpath(trim($file, "/"));
    if (
file_exists($file) && is_readable($file)) {
        $fileinfo
= pathinfo($file);
        
        if (
$fileinfo['extension'] === 'js' || $fileinfo['extension'] === 'css') {
            $this
->_assets[$fileinfo['extension']][$group][$file_path] = '';
            if (!
in_array($group,$this->asset_groups[$fileinfo['extension']]))
                
$this->asset_groups[$fileinfo['extension']][] = $group;
        
}
    }else{
        
echo "file doesn't exists or isn't readable";
    
}
}

I spent an hour!! Why you don’t put a little validation there!

Thanks

Profile
 
 
Posted: 02 June 2008 10:05 PM   [ Ignore ]   [ # 19 ]  
Grad Student
Rank
Total Posts:  75
Joined  01-02-2008

Why this?

echo $this->cache_dir_css.'/'.$this->cache_file_css[$group];

What about ie6 & ie7 sytles?

$this->csstidy_loaded = TRUE;echo 'ss';

??????

Profile
 
 
Posted: 03 June 2008 12:20 AM   [ Ignore ]   [ # 20 ]  
Grad Student
Avatar
Rank
Total Posts:  65
Joined  03-17-2008
Ignacio - 02 June 2008 08:10 PM
private function _add($file, $group = NULL) {
    
//. . .
    
if (file_exists($file) && is_readable($file)) {
        
//. . .
    
}else{
        
echo "file doesn't exists or isn't readable";
    
}
}

I spent an hour!! Why you don’t put a little validation there!

Thanks

I’m very sorry for this. red face I will add an error log in the next update.

Ignacio - 02 June 2008 10:05 PM

Why this?

echo $this->cache_dir_css.'/'.$this->cache_file_css[$group];

What’s the problem here? hmmm

Ignacio - 02 June 2008 10:05 PM

What about ie6 & ie7 sytles?

What do you mean exactly?

Ignacio - 02 June 2008 10:05 PM
$this->csstidy_loaded = TRUE;echo 'ss';

??????

Well, I have no idea what this was meant for during initial development and especially: why it’s still in there. shut eye
Damn, didn’t I check the code twice? I did.

 Signature 

AssetLibPro - An advanced CI Asset Library
Improving CI’s native Caching

Profile
 
 
   
2 of 6
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120479 Total Logged-in Users: 23
Total Topics: 126554 Total Anonymous Users: 3
Total Replies: 665404 Total Guests: 272
Total Posts: 791958    
Members ( View Memberlist )