芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/www/prisma/system/classes/kohana/log/file.php
Debug::path($directory))); } // Determine the directory path $this->_directory = realpath($directory).DIRECTORY_SEPARATOR; } /** * Writes each of the messages into the log file. The log file will be * appended to the `YYYY/MM/DD.log.php` file, where YYYY is the current * year, MM is the current month, and DD is the current day. * * $writer->write($messages); * * @param array messages * @return void */ public function write(array $messages) { // Set the yearly directory name $directory = $this->_directory.date('Y'); if ( ! is_dir($directory)) { // Create the yearly directory mkdir($directory, 02777); // Set permissions (must be manually set to fix umask issues) chmod($directory, 02777); } // Add the month to the directory $directory .= DIRECTORY_SEPARATOR.date('m'); if ( ! is_dir($directory)) { // Create the monthly directory mkdir($directory, 02777); // Set permissions (must be manually set to fix umask issues) chmod($directory, 02777); } // Set the name of the log file $filename = $directory.DIRECTORY_SEPARATOR.date('d').EXT; if ( ! file_exists($filename)) { // Create the log file file_put_contents($filename, Kohana::FILE_SECURITY.' ?>'.PHP_EOL); // Allow anyone to write to log files chmod($filename, 0666); } foreach ($messages as $message) { // Write each message into the log file // Format: time --- level: body file_put_contents($filename, PHP_EOL.$message['time'].' --- '.$this->_log_levels[$message['level']].': '.$message['body'], FILE_APPEND); } } } // End Kohana_Log_File