Guest User

Untitled

a guest
Jun 21st, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. $this->createDir();
  2. $this->errorMessage = null;
  3. set_error_handler(array($this, 'customErrorHandler'));
  4. $this->stream = fopen($this->url, 'a');
  5. if ($this->filePermission !== null) {
  6. @chmod($this->url, $this->filePermission);
  7. }
  8. restore_error_handler();
  9. if (!is_resource($this->stream)) {
  10. $this->stream = null;
  11. throw new UnexpectedValueException(sprintf('The stream or file "%s" could not be opened: '.$this->errorMessage, $this->url));
  12. }
  13. }
  14.  
  15. if ($this->useLocking) {
  16. // ignoring errors here, there's not much we can do about them
  17. flock($this->stream, LOCK_EX);
  18. }
  19.  
  20. $this->streamWrite($this->stream, $record);
  21.  
  22. if ($this->useLocking) {
  23. flock($this->stream, LOCK_UN);
  24. }
  25. }
Add Comment
Please, Sign In to add comment