summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2022-01-05 20:27:11 +0100
committerAndrey Andreev <narf@devilix.net>2022-01-05 20:27:11 +0100
commitb2af476c9bb3a3eb24f93e7128eee327758461a9 (patch)
treefb2561f3aa5e6adaacb5811a5428714590f872ce /system/core
parentfbc1b4d228f0cd84b07bec08ed030708304e661d (diff)
Polish changes from PR #5684 and drop ['log_file_extension']; ref #5648
Diffstat (limited to 'system/core')
-rw-r--r--system/core/Log.php24
1 files changed, 7 insertions, 17 deletions
diff --git a/system/core/Log.php b/system/core/Log.php
index 8ce1b83a2..999e51718 100644
--- a/system/core/Log.php
+++ b/system/core/Log.php
@@ -54,13 +54,13 @@ class CI_Log {
* @var string
*/
protected $_log_path;
-
+
/**
- * Filename of log
+ * Log filename
*
* @var string
*/
- protected $_log_file;
+ protected $_log_filename;
/**
* File permissions
@@ -91,13 +91,6 @@ class CI_Log {
protected $_date_fmt = 'Y-m-d H:i:s';
/**
- * Filename extension
- *
- * @var string
- */
- protected $_file_ext;
-
- /**
* Whether or not the logger can write to the log files
*
* @var bool
@@ -134,11 +127,8 @@ class CI_Log {
$this->_log_path = ($config['log_path'] !== '')
? rtrim($config['log_path'], '/\\').DIRECTORY_SEPARATOR : APPPATH.'logs'.DIRECTORY_SEPARATOR;
- $this->_log_file = (isset($config['log_file']) && $config['log_file'] !== '')
- ? $config['log_file'] : 'log-'.date('Y-m-d');
-
- $this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '')
- ? ltrim($config['log_file_extension'], '.') : 'php';
+ $this->_log_filename = (isset($config['log_filename']) && $config['log_filename'] !== '')
+ ? $config['log_filename'] : 'log-'.date('Y-m-d').'.php';
file_exists($this->_log_path) OR mkdir($this->_log_path, 0755, TRUE);
@@ -194,14 +184,14 @@ class CI_Log {
return FALSE;
}
- $filepath = $this->_log_path.$this->_log_file.'.'.$this->_file_ext;
+ $filepath = $this->_log_path.$this->_log_filename;
$message = '';
if ( ! file_exists($filepath))
{
$newfile = TRUE;
// Only add protection to php files
- if ($this->_file_ext === 'php')
+ if (substr($this->_log_filename, -3, 3) === 'php')
{
$message .= "<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>\n\n";
}