Development

#2145: setPermToLogFileAtCreationTime.patch

You must first sign up to be able to contribute.

Ticket #2145: setPermToLogFileAtCreationTime.patch

File setPermToLogFileAtCreationTime.patch, 0.8 kB (added by Nicolas.DHOMONT, 1 year ago)
  • /trunk/lib/log/sfLogger/sfFileLogger.class.php

    old new  
    4444      mkdir($dir, 0777, true); 
    4545    } 
    4646 
    47     if (!is_writable($dir) || (file_exists($options['file']) && !is_writable($options['file']))) 
     47    $file_exists = file_exists($options['file']); 
     48 
     49    if (!is_writable($dir) || ($file_exists && !is_writable($options['file']))) 
    4850    { 
    4951      throw new sfFileException(sprintf('Unable to open the log file "%s" for writing.', $options['file'])); 
    5052    } 
     
    5153 
    5254    $this->fp = fopen($options['file'], 'a'); 
    5355 
     56    if (!$file_exists) 
     57    { 
     58      chmod($options['file'], 0666); 
     59    } 
     60 
    5461    return parent::initialize($options); 
    5562  } 
    5663