Part of the EllisLab Network

Bug Report

unlink and chmod() warnings in is_really_writable() for >100 connections per second

Date: 10/16/2008 Severity: Trivial
Status: Resolved Reporter: Andriy Sylka
Version: 1.6.3
Keywords: Libraries

Description

Sometimes We have unlink or chmode warnings like
unlink(/var/www/system/cache/98dce83da57b0395e163467c9dae521b) in backend width >100 connections per second.

Probably it is colling md5(rand(1,100)).

Disabling checking is_really_writable() resolve this problem.
Add to config/config.php
$config[‘is_realy_writebale_enable’] = false;

Code Sample

function is_really_writable($file)
{
    
if (!config_item('is_realy_writebale_enable'))
        return
true;
    if (
is_dir($file))
    
{
        $file
= rtrim($file, '/').'/'.md5(rand(1,100));
        
        if ((
$fp = @fopen($file, 'ab')) === FALSE)
        
{
            
return FALSE;
        
}
        
        fclose
($fp);
        @
chmod($file, 0777);
        @
unlink($file);
        return
TRUE;
    
}
    
elseif (($fp = @fopen($file, 'ab')) === FALSE)
    
{
        
return FALSE;
    
}

    fclose
($fp);
    return
TRUE;
}

Expected Result

Actual Result

Comment on Bug Report

Page 1 of 1 pages
Posted by: Rick Ellis on 22 October 2008 2:40pm
Rick Ellis's avatar

I assume you’re on a unix server?  If so, I added some code to that function which should take care of the problem.

Posted by: Andriy Sylka on 24 October 2008 7:26am
Andriy Sylka's avatar

Yes,  it is Fedora 8.
Ok, your solution in 1.7 is better.

Name:

Email:

Location:

URL:

Remember my personal information

Notify me of follow-up comments?