AAAAhome/academiac/www/plugins/vmpayment/sofort/sofort/library/sofortLib_Logger.inc.php000060400000003411151376506340024734 0ustar00logRotate($uri)) { $this->fp = fopen($uri, 'w'); fclose($this->fp); } $this->fp = fopen($uri, 'a'); fwrite($this->fp, '['.date('Y-m-d H:i:s').'] '.$message."\n"); fclose($this->fp); } /** * Copy the content of the logfile to a backup file if file size got too large * Put the old log file into a tarball for later reference * @param URI $uri */ public function logRotate($uri) { $date = date('Y-m-d_h-i-s', time()); if (file_exists($uri)) { if ($this->fp != null && filesize($uri) != false && filesize($uri) >= $this->maxFilesize) { $oldUri = $uri; // file ending $ending = $ext = pathinfo($oldUri, PATHINFO_EXTENSION); $newUri = dirname($oldUri).'/log_'.$date.'.'.$ending; rename($oldUri, $newUri); if (file_exists($oldUri)) { unlink($oldUri); } return true; } } return false; } } /// \endcond ?>