summaryrefslogtreecommitdiffstats
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
parentfbc1b4d228f0cd84b07bec08ed030708304e661d (diff)
Polish changes from PR #5684 and drop ['log_file_extension']; ref #5648
-rw-r--r--application/config/config.php18
-rw-r--r--system/core/Log.php24
-rw-r--r--user_guide_src/source/changelog.rst2
-rw-r--r--user_guide_src/source/installation/upgrade_320.rst12
4 files changed, 23 insertions, 33 deletions
diff --git a/application/config/config.php b/application/config/config.php
index 83d8802fb..1e37856fe 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -232,24 +232,10 @@ $config['log_path'] = '';
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
-| 'log-'.date('Y-m-d') filename. No DIRECTORY_SEPARATOR(s) or file extension
+| 'log-'.date('Y-m-d').'.php'. No DIRECTORY_SEPARATOR(s), just the filename.
|
*/
-$config['log_file'] = '';
-
-/*
-|--------------------------------------------------------------------------
-| Log File Extension
-|--------------------------------------------------------------------------
-|
-| The default filename extension for log files. The default 'php' allows for
-| protecting the log files via basic scripting, when they are to be stored
-| under a publicly accessible directory.
-|
-| Note: Leaving it blank will default to 'php'.
-|
-*/
-$config['log_file_extension'] = '';
+$config['log_filename'] = '';
/*
|--------------------------------------------------------------------------
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";
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 704652381..d7a757901 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -16,6 +16,8 @@ Release Date: Not Released
- Core
+ - Added a ``$config['log_file']`` option.
+ - Removed ``$config['log_file_extension']``.
- Removed ``$config['rewrite_short_tags']`` (irrelevant on PHP 5.4+).
- Removed previously deprecated ``$config['global_xss_filtering']``.
- Removed previously deprecated :doc:`Routing Class <general/routing>` methods ``fetch_directory()``, ``fetch_class()`` and ``fetch_method()`` (use the respective class properties instead).
diff --git a/user_guide_src/source/installation/upgrade_320.rst b/user_guide_src/source/installation/upgrade_320.rst
index 2616a2a47..48914c414 100644
--- a/user_guide_src/source/installation/upgrade_320.rst
+++ b/user_guide_src/source/installation/upgrade_320.rst
@@ -267,3 +267,15 @@ The ``$curs_id`` property is also removed.
If you were using those, you can create your own cursors via ``oci_new_cursor()``
and the publicly accessible ``$conn_id()``.
+
+Stop 14: Replace $config['log_file_extension'] with $config['log_filename'] in application/config/config.php
+============================================================================================================
+
+You can now specify the full log filename via ``$config['log_filename']``.
+Add this configuration option to your **application/config/config.php**,
+if you haven't copied the new one over.
+
+The previously existing ``$config['log_file_extension']`` option has been
+removed and no longer works. However, its functionality is essentially
+integrated into the new ``$config['log_filename']``, since it includes the
+filename extension in itself.