----- Original Message ----- 
From: <[EMAIL PROTECTED]>
<big snip>
> 
> Reading the script again I cab see two possible issues that you may want to
> check -
> 
> 1)
> function file_lock($lock_filename)
>  {
>  if(!($handle = file_open($lock_filename, 'w')))
>    {
>    return FALSE;
>    }
> 
> Will opening an existing file in write mode fopen($filename, 'w') release
> any previous locks on the file ??
> 
> 2)
> function file_passthrough($source_handle, $destination_handle)
>  {
>  while(!feof($source_handle))
>    {
>    $buffer = fread($source_handle, 4096);
>    fwrite($destination_handle, $buffer);
>    }
>  }
> 
> I should have explained that I am somewhat of a newbe to php!

You could have fooled me?


> In some other languages the above will write to a RAM buffer and the buffer
> will only be written to the file system when the file stream is closed.
> 
> Does php have a way to flush a steam buffer to the file system ?
> 
> I will look.
> 
> Rob.
> ------------------------------------
> Here is the fix for the second issue -
> 
> function file_passthrough($source_handle, $destination_handle)
>  {
>  while(!feof($source_handle))
>    {
>    $buffer = fread($source_handle, 4096);
>    fwrite($destination_handle, $buffer);
>    fflush($destination_handle);
>    }
>  } 

Hi Rob,
I started reading about flock() out of interest.
I guess you've probably looked at the user notes:
http://uk.php.net/flock

It seems no-one can agree on anything to do with flock().
Would it be suitable to use a mysql database for an error log?

I'm assuming these problems wouldn't occur with a DB.
Regards, Bob E.



------------------------------------

Please remember to write your response BELOW the previous text. 

Community email addresses:
  Post message: php-list@yahoogroups.com
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-listYahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php-list/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to