From 19311361d52413746327b590e3ef51e4d718fd82 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 7 Apr 2015 00:02:14 +0300 Subject: Move strtolower() call from PR #3739 out of the loop --- system/database/DB_query_builder.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index a77ed57d0..5005d0163 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -918,6 +918,8 @@ abstract class CI_DB_query_builder extends CI_DB_driver { } is_bool($escape) OR $escape = $this->_protect_identifiers; + // lowercase $side in case somebody writes e.g. 'BEFORE' instead of 'before' (doh) + $side = strtolower($side); foreach ($field as $k => $v) { @@ -925,9 +927,6 @@ abstract class CI_DB_query_builder extends CI_DB_driver { ? $this->_group_get_type('') : $this->_group_get_type($type); $v = $this->escape_like_str($v); - - // lowercase $side for in case of UPPERCASE string - $side = strtolower($side); if ($side === 'none') { -- cgit v1.2.3-24-g4f1b From 475dfac090505832719cb6ff4ff13ab7ac655fbb Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 7 Apr 2015 00:07:04 +0300 Subject: Disallow empty FV rules ... for consistency Related: #3736 --- system/libraries/Form_validation.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 05de59628..522eba704 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -198,22 +198,20 @@ class CI_Form_validation { return $this; } - // No fields? Nothing to do... - if ( ! is_string($field) OR $field === '') + // No fields or no rules? Nothing to do... + if ( ! is_string($field) OR $field === '' OR empty($rules)) { return $this; } elseif ( ! is_array($rules)) { // BC: Convert pipe-separated rules string to an array - if (is_string($rules)) - { - $rules = explode('|', $rules); - } - else + if ( ! is_string($rules)) { return $this; } + + $rules = explode('|', $rules); } // If the field label wasn't passed we use the field name -- cgit v1.2.3-24-g4f1b From 9b9a06c9635cd3b4fce0aebe4d2eead4809999a5 Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Tue, 7 Apr 2015 18:36:51 +0800 Subject: [feature] check redis auth failed --- system/libraries/Cache/drivers/Cache_redis.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index a35fbf6d2..d97643632 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -302,7 +302,11 @@ class CI_Cache_redis extends CI_Driver if (isset($config['password'])) { - $this->_redis->auth($config['password']); + if ( ! $this->_redis->auth($config['password'])) + { + log_message('debug', 'Cache: Redis authentication failed.'); + return FALSE; + } } // Initialize the index of serialized values. -- cgit v1.2.3-24-g4f1b From 5c58e6744c9cf616d93f6f12255e0fc70c751341 Mon Sep 17 00:00:00 2001 From: mult1mate Date: Wed, 8 Apr 2015 16:03:31 +0300 Subject: typo --- system/core/Common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/core/Common.php b/system/core/Common.php index f28272b5b..a96828e96 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -181,7 +181,7 @@ if ( ! function_exists('load_class')) // Did we find the class? if ($name === FALSE) { - // Note: We use exit() rather then show_error() in order to avoid a + // Note: We use exit() rather than show_error() in order to avoid a // self-referencing loop with the Exceptions class set_status_header(503); echo 'Unable to locate the specified class: '.$class.'.php'; -- cgit v1.2.3-24-g4f1b From 1924eb37cc5488be7560a8a754663bba6a47a5e4 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 8 Apr 2015 17:19:24 +0300 Subject: [ci skip] Fix comment typos https://github.com/bcit-ci/CodeIgniter/pull/3748#issuecomment-90925762 --- system/core/Router.php | 2 +- system/database/DB_query_builder.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/core/Router.php b/system/core/Router.php index eb3da2285..f91d3f6ec 100644 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -493,7 +493,7 @@ class CI_Router { * Set directory name * * @param string $dir Directory name - * @param bool $appent Whether we're appending rather then setting the full value + * @param bool $appent Whether we're appending rather than setting the full value * @return void */ public function set_directory($dir, $append = FALSE) diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php index 5005d0163..8251f4558 100644 --- a/system/database/DB_query_builder.php +++ b/system/database/DB_query_builder.php @@ -2255,7 +2255,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver { else { // Cycle through the "select" portion of the query and prep each column name. - // The reason we protect identifiers here rather then in the select() function + // The reason we protect identifiers here rather than in the select() function // is because until the user calls the from() function we don't know if there are aliases foreach ($this->qb_select as $key => $val) { -- cgit v1.2.3-24-g4f1b From abd713f3a6d09f83304e3cf97ff1dfc7b237e094 Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Thu, 9 Apr 2015 13:11:51 +0800 Subject: use = instead of += --- system/libraries/Cache/drivers/Cache_redis.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index a35fbf6d2..43e217784 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -270,7 +270,7 @@ class CI_Cache_redis extends CI_Driver if ($CI->config->load('redis', TRUE, TRUE)) { - $config += $CI->config->item('redis'); + $config = $CI->config->item('redis'); } $config = array_merge(self::$_default_config, $config); -- cgit v1.2.3-24-g4f1b From b2119a785cc980cc0b22bc8535729dbad50a0913 Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Thu, 9 Apr 2015 13:27:01 +0800 Subject: [fix] redis get_metadata --- system/libraries/Cache/drivers/Cache_redis.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index 43e217784..114c32983 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -223,7 +223,7 @@ class CI_Cache_redis extends CI_Driver { $value = $this->get($key); - if ($value) + if ($value !== FALSE) { return array( 'expire' => time() + $this->_redis->ttl($key), -- cgit v1.2.3-24-g4f1b From ebfc48a9ee05dbd96a372894ab65f6287fe6c398 Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Thu, 9 Apr 2015 22:34:27 +0800 Subject: add changelog for #3744 --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 8fa4d1ef1..04a0aa55a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -15,6 +15,7 @@ Bug fixes for 3.0.1 ------------------- - Fixed a bug (#3733) - Autoloading of libraries with aliases didn't work, although it was advertised to. +- Fixed a bug (#3744) - Redis :doc:`Caching ` driver didn't handle authentication failures properly. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b From c14aa9bcca4b5876f2bf46bbe9eb4c7d3e0e013a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 12 Apr 2015 14:23:47 +0300 Subject: Close #3761 --- system/helpers/url_helper.php | 2 +- user_guide_src/source/changelog.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index bf623b000..5f8c6ce67 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -161,7 +161,7 @@ if ( ! function_exists('anchor')) $site_url = is_array($uri) ? site_url($uri) - : preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri); + : (preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri)); if ($title === '') { diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 04a0aa55a..94a383294 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -16,6 +16,7 @@ Bug fixes for 3.0.1 - Fixed a bug (#3733) - Autoloading of libraries with aliases didn't work, although it was advertised to. - Fixed a bug (#3744) - Redis :doc:`Caching ` driver didn't handle authentication failures properly. +- Fixed a bug (#3761) - :doc:`URL Helper ` function :php:func:`anchor()` didn't work with array inputs. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b From 2b7a97c55eb7e2797cea0ee39a96996a80c43f27 Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Tue, 14 Apr 2015 11:19:38 +0800 Subject: Status Code Definitions --- system/core/Common.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/system/core/Common.php b/system/core/Common.php index a96828e96..a81e45500 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -506,6 +506,9 @@ if ( ! function_exists('set_status_header')) { is_int($code) OR $code = (int) $code; $stati = array( + 100 => 'Continue', + 101 => 'Switching Protocols', + 200 => 'OK', 201 => 'Created', 202 => 'Accepted', @@ -524,6 +527,7 @@ if ( ! function_exists('set_status_header')) 400 => 'Bad Request', 401 => 'Unauthorized', + 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', -- cgit v1.2.3-24-g4f1b From 1a973c31f7ed13b8edb70026b3b1a064f5f4fba7 Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Tue, 14 Apr 2015 16:59:44 +0800 Subject: [helper]update plural regular --- system/helpers/inflector_helper.php | 1 + 1 file changed, 1 insertion(+) diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php index d8ed45df9..f2890059f 100644 --- a/system/helpers/inflector_helper.php +++ b/system/helpers/inflector_helper.php @@ -133,6 +133,7 @@ if ( ! function_exists('plural')) } $plural_rules = array( + '/(quiz)$/' => '\1zes', // quizzes '/^(ox)$/' => '\1\2en', // ox '/([m|l])ouse$/' => '\1ice', // mouse, louse '/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index -- cgit v1.2.3-24-g4f1b From aaca76cf4d9ea66249771b89a84c1bd436296b07 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 14 Apr 2015 15:51:29 +0300 Subject: [ci skip] Change Array helpers element(), elements() signatures Close #3767 --- system/helpers/array_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php index e07b52bb5..2ce55b9c4 100644 --- a/system/helpers/array_helper.php +++ b/system/helpers/array_helper.php @@ -62,7 +62,7 @@ if ( ! function_exists('element')) * @param mixed * @return mixed depends on what the array contains */ - function element($item, $array, $default = NULL) + function element($item, array $array, $default = NULL) { return array_key_exists($item, $array) ? $array[$item] : $default; } @@ -99,7 +99,7 @@ if ( ! function_exists('elements')) * @param mixed * @return mixed depends on what the array contains */ - function elements($items, $array, $default = NULL) + function elements($items, array $array, $default = NULL) { $return = array(); -- cgit v1.2.3-24-g4f1b From 8af87468487101e14e69effb80a166870f1b79be Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 14 Apr 2015 15:59:54 +0300 Subject: Fix #3773 --- .../drivers/pdo/subdrivers/pdo_mysql_driver.php | 24 ++++++++++++++++++++++ user_guide_src/source/changelog.rst | 1 + 2 files changed, 25 insertions(+) diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php index 67dc5f5ec..206d83595 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php @@ -156,6 +156,30 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver { // -------------------------------------------------------------------- + /** + * Select the database + * + * @param string $database + * @return bool + */ + public function db_select($database = '') + { + if ($database === '') + { + $database = $this->database; + } + + if (FALSE !== $this->simple_query('USE '.$this->escape_identifiers($database))) + { + $this->database = $database; + return TRUE; + } + + return FALSE; + } + + // -------------------------------------------------------------------- + /** * Show table query * diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 94a383294..596cd0faf 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -17,6 +17,7 @@ Bug fixes for 3.0.1 - Fixed a bug (#3733) - Autoloading of libraries with aliases didn't work, although it was advertised to. - Fixed a bug (#3744) - Redis :doc:`Caching ` driver didn't handle authentication failures properly. - Fixed a bug (#3761) - :doc:`URL Helper ` function :php:func:`anchor()` didn't work with array inputs. +- Fixed a bug (#3773) - ``db_select()`` didn't work for MySQL with the PDO :doc:`Database ` driver. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b From 5d8e2a6e4c50b772f4b789ea5d831f47c45dc851 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 14 Apr 2015 16:56:28 +0300 Subject: Fix #3771 --- system/libraries/Form_validation.php | 14 ++++---------- user_guide_src/source/changelog.rst | 1 + 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 522eba704..bb872c7cc 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -870,17 +870,11 @@ class CI_Form_validation { */ protected function _translate_fieldname($fieldname) { - // Do we need to translate the field name? - // We look for the prefix lang: to determine this - if (sscanf($fieldname, 'lang:%s', $line) === 1) + // Do we need to translate the field name? We look for the prefix 'lang:' to determine this + // If we find one, but there's no translation for the string - just return it + if (sscanf($fieldname, 'lang:%s', $line) === 1 && FALSE === ($fieldname = $this->CI->lang->line($line, FALSE))) { - // Were we able to translate the field name? If not we use $line - if (FALSE === ($fieldname = $this->CI->lang->line('form_validation_'.$line)) - // DEPRECATED support for non-prefixed keys - && FALSE === ($fieldname = $this->CI->lang->line($line, FALSE))) - { - return $line; - } + return $line; } return $fieldname; diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 596cd0faf..5454638ac 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -18,6 +18,7 @@ Bug fixes for 3.0.1 - Fixed a bug (#3744) - Redis :doc:`Caching ` driver didn't handle authentication failures properly. - Fixed a bug (#3761) - :doc:`URL Helper ` function :php:func:`anchor()` didn't work with array inputs. - Fixed a bug (#3773) - ``db_select()`` didn't work for MySQL with the PDO :doc:`Database ` driver. +- Fixed a bug (#3771) - :doc:`Form Validation Library ` was looking for a 'form_validation_' prefix when trying to translate field name labels. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b From d78dd8e7ec777e34aa6aed960a05520b074914c5 Mon Sep 17 00:00:00 2001 From: Brett Santore Date: Tue, 14 Apr 2015 10:54:48 -0400 Subject: Add test for email address with subdomain --- tests/codeigniter/helpers/email_helper_test.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/codeigniter/helpers/email_helper_test.php b/tests/codeigniter/helpers/email_helper_test.php index 53a206825..529e96910 100644 --- a/tests/codeigniter/helpers/email_helper_test.php +++ b/tests/codeigniter/helpers/email_helper_test.php @@ -13,6 +13,7 @@ class Email_helper_test extends CI_TestCase { $this->assertEquals(FALSE, valid_email('test@test@test.com')); $this->assertEquals(TRUE, valid_email('test@test.com')); $this->assertEquals(TRUE, valid_email('my.test@test.com')); + $this->assertEquals(TRUE, valid_email('my.test@subdomain.test.com')); } public function test_send_mail() -- cgit v1.2.3-24-g4f1b From 6b620fb7e61f1051f5bced189d1b57bd30a97126 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 20 Apr 2015 12:46:46 +0300 Subject: [ci skip] Remove whitespace --- system/core/Common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/core/Common.php b/system/core/Common.php index a81e45500..b850fd39a 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -749,7 +749,7 @@ if ( ! function_exists('html_escape')) { return $var; } - + if (is_array($var)) { return array_map('html_escape', $var, array_fill(0, count($var), $double_encode)); -- cgit v1.2.3-24-g4f1b From d3913f591353d17954ee900f2524f24c1833af85 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 20 Apr 2015 14:47:00 +0300 Subject: Fix #3787 --- system/libraries/Ftp.php | 2 +- user_guide_src/source/changelog.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php index af45bb55f..b53207577 100644 --- a/system/libraries/Ftp.php +++ b/system/libraries/Ftp.php @@ -490,7 +490,7 @@ class CI_FTP { // so we'll recursively call delete_dir() if ( ! preg_match('#/\.\.?$#', $list[$i]) && ! @ftp_delete($this->conn_id, $list[$i])) { - $this->delete_dir($list[$i]); + $this->delete_dir($filepath.$list[$i]); } } } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 5454638ac..ae8dde6f9 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -19,6 +19,7 @@ Bug fixes for 3.0.1 - Fixed a bug (#3761) - :doc:`URL Helper ` function :php:func:`anchor()` didn't work with array inputs. - Fixed a bug (#3773) - ``db_select()`` didn't work for MySQL with the PDO :doc:`Database ` driver. - Fixed a bug (#3771) - :doc:`Form Validation Library ` was looking for a 'form_validation_' prefix when trying to translate field name labels. +- Fixed a bug (#3787) - :doc:`FTP Library ` method ``delete_dir()`` failed when the target has subdirectories. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b From 29fc79abf644c7b28f44fbbbb5454dfdc97c1996 Mon Sep 17 00:00:00 2001 From: Abs Date: Thu, 23 Apr 2015 18:43:36 +0100 Subject: Adding two new characters and their ASCII equivalent --- application/config/foreign_chars.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/config/foreign_chars.php b/application/config/foreign_chars.php index d02dea958..ac406e3d4 100644 --- a/application/config/foreign_chars.php +++ b/application/config/foreign_chars.php @@ -56,6 +56,7 @@ $foreign_characters = array( '/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's', '/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T', '/ț|ţ|ť|ŧ|т/' => 't', + '/Þ|þ/' => 'th', '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U', '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u', '/Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y', -- cgit v1.2.3-24-g4f1b From 24812132d7aa039bbdca1f150a850dc776ce7bd7 Mon Sep 17 00:00:00 2001 From: Tyler Brownell Date: Thu, 23 Apr 2015 15:11:03 -0400 Subject: Updates the fallback driver variable name to match the config option name. --- system/libraries/Cache/Cache.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index 40ac70103..fd49f33ab 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -81,7 +81,7 @@ class CI_Cache extends CI_Driver_Library { * * @var string */ - protected $_backup_driver = 'dummy'; + protected $_backup = 'dummy'; /** * Cache key prefix @@ -119,23 +119,23 @@ class CI_Cache extends CI_Driver_Library { if (isset($config['backup']) && in_array($config['backup'], $this->valid_drivers)) { - $this->_backup_driver = $config['backup']; + $this->_backup = $config['backup']; } // If the specified adapter isn't available, check the backup. if ( ! $this->is_supported($this->_adapter)) { - if ( ! $this->is_supported($this->_backup_driver)) + if ( ! $this->is_supported($this->_backup)) { // Backup isn't supported either. Default to 'Dummy' driver. - log_message('error', 'Cache adapter "'.$this->_adapter.'" and backup "'.$this->_backup_driver.'" are both unavailable. Cache is now using "Dummy" adapter.'); + log_message('error', 'Cache adapter "'.$this->_adapter.'" and backup "'.$this->_backup.'" are both unavailable. Cache is now using "Dummy" adapter.'); $this->_adapter = 'dummy'; } else { // Backup is supported. Set it to primary. - log_message('debug', 'Cache adapter "'.$this->_adapter.'" is unavailable. Falling back to "'.$this->_backup_driver.'" backup adapter.'); - $this->_adapter = $this->_backup_driver; + log_message('debug', 'Cache adapter "'.$this->_adapter.'" is unavailable. Falling back to "'.$this->_backup.'" backup adapter.'); + $this->_adapter = $this->_backup; } } } -- cgit v1.2.3-24-g4f1b From 229a546efbbc0e6d70c2ea764d74b9c1c57516c2 Mon Sep 17 00:00:00 2001 From: Tyler Brownell Date: Thu, 23 Apr 2015 15:38:06 -0400 Subject: Cache Library Defaults Fixed - Comments! - Updates the cache library to validate *both* adapters. - No longer attempts to set an undefined "memcached" class variable. - $key variable renamed to $driver_type (more descriptive). --- system/libraries/Cache/Cache.php | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index fd49f33ab..5d32240ce 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -100,28 +100,19 @@ class CI_Cache extends CI_Driver_Library { */ public function __construct($config = array()) { - $default_config = array( - 'adapter', - 'memcached' - ); - - foreach ($default_config as $key) + // Loop through the available driver types and overwrite them as they're found. + foreach (array('adapter', 'backup') as $driver_type) { - if (isset($config[$key])) + if (isset($config[$driver_type]) && in_array($config[$driver_type], $this->valid_drivers)) { - $param = '_'.$key; - - $this->{$param} = $config[$key]; + $option = '_'.$driver_type; + $this->{$option} = $config[$driver_type]; } } + // Overwrite the default key prefix. isset($config['key_prefix']) && $this->key_prefix = $config['key_prefix']; - if (isset($config['backup']) && in_array($config['backup'], $this->valid_drivers)) - { - $this->_backup = $config['backup']; - } - // If the specified adapter isn't available, check the backup. if ( ! $this->is_supported($this->_adapter)) { -- cgit v1.2.3-24-g4f1b From bf2ca381da2f63439f23df91369a68dccae6ea4b Mon Sep 17 00:00:00 2001 From: Tyler Brownell Date: Thu, 23 Apr 2015 15:44:37 -0400 Subject: Renames $_adapter to $_driver. It's what we call it everywhere else. --- system/libraries/Cache/Cache.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index 5d32240ce..39d05d930 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -74,7 +74,7 @@ class CI_Cache extends CI_Driver_Library { * * @var mixed */ - protected $_adapter = 'dummy'; + protected $_driver = 'dummy'; /** * Fallback driver @@ -114,19 +114,19 @@ class CI_Cache extends CI_Driver_Library { isset($config['key_prefix']) && $this->key_prefix = $config['key_prefix']; // If the specified adapter isn't available, check the backup. - if ( ! $this->is_supported($this->_adapter)) + if ( ! $this->is_supported($this->_driver)) { if ( ! $this->is_supported($this->_backup)) { // Backup isn't supported either. Default to 'Dummy' driver. - log_message('error', 'Cache adapter "'.$this->_adapter.'" and backup "'.$this->_backup.'" are both unavailable. Cache is now using "Dummy" adapter.'); - $this->_adapter = 'dummy'; + log_message('error', 'Cache adapter "'.$this->_driver.'" and backup "'.$this->_backup.'" are both unavailable. Cache is now using "Dummy" adapter.'); + $this->_driver = 'dummy'; } else { // Backup is supported. Set it to primary. - log_message('debug', 'Cache adapter "'.$this->_adapter.'" is unavailable. Falling back to "'.$this->_backup.'" backup adapter.'); - $this->_adapter = $this->_backup; + log_message('debug', 'Cache adapter "'.$this->_driver.'" is unavailable. Falling back to "'.$this->_backup.'" backup adapter.'); + $this->_driver = $this->_backup; } } } @@ -144,7 +144,7 @@ class CI_Cache extends CI_Driver_Library { */ public function get($id) { - return $this->{$this->_adapter}->get($this->key_prefix.$id); + return $this->{$this->_driver}->get($this->key_prefix.$id); } // ------------------------------------------------------------------------ @@ -160,7 +160,7 @@ class CI_Cache extends CI_Driver_Library { */ public function save($id, $data, $ttl = 60, $raw = FALSE) { - return $this->{$this->_adapter}->save($this->key_prefix.$id, $data, $ttl, $raw); + return $this->{$this->_driver}->save($this->key_prefix.$id, $data, $ttl, $raw); } // ------------------------------------------------------------------------ @@ -173,7 +173,7 @@ class CI_Cache extends CI_Driver_Library { */ public function delete($id) { - return $this->{$this->_adapter}->delete($this->key_prefix.$id); + return $this->{$this->_driver}->delete($this->key_prefix.$id); } // ------------------------------------------------------------------------ @@ -187,7 +187,7 @@ class CI_Cache extends CI_Driver_Library { */ public function increment($id, $offset = 1) { - return $this->{$this->_adapter}->increment($id, $offset); + return $this->{$this->_driver}->increment($id, $offset); } // ------------------------------------------------------------------------ @@ -201,7 +201,7 @@ class CI_Cache extends CI_Driver_Library { */ public function decrement($id, $offset = 1) { - return $this->{$this->_adapter}->decrement($id, $offset); + return $this->{$this->_driver}->decrement($id, $offset); } // ------------------------------------------------------------------------ @@ -213,7 +213,7 @@ class CI_Cache extends CI_Driver_Library { */ public function clean() { - return $this->{$this->_adapter}->clean(); + return $this->{$this->_driver}->clean(); } // ------------------------------------------------------------------------ @@ -226,7 +226,7 @@ class CI_Cache extends CI_Driver_Library { */ public function cache_info($type = 'user') { - return $this->{$this->_adapter}->cache_info($type); + return $this->{$this->_driver}->cache_info($type); } // ------------------------------------------------------------------------ @@ -239,7 +239,7 @@ class CI_Cache extends CI_Driver_Library { */ public function get_metadata($id) { - return $this->{$this->_adapter}->get_metadata($this->key_prefix.$id); + return $this->{$this->_driver}->get_metadata($this->key_prefix.$id); } // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b From fd1bc2213f158ae9368a3d85dc108f641dd566bf Mon Sep 17 00:00:00 2001 From: Ivan Tcholakov Date: Thu, 23 Apr 2015 23:21:08 +0300 Subject: Output cache: Fixing a wrong timestamp. Credits to khoggatt (CodeIgniter forum). --- system/core/Output.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/core/Output.php b/system/core/Output.php index 02f66936c..e7d559a1d 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -674,7 +674,7 @@ class CI_Output { $cache_info = unserialize($match[1]); $expire = $cache_info['expire']; - $last_modified = filemtime($cache_path); + $last_modified = filemtime($filepath); // Has the file expired? if ($_SERVER['REQUEST_TIME'] >= $expire && is_really_writable($cache_path)) -- cgit v1.2.3-24-g4f1b From 67c1e222c5312d064b987d899d29cb619fd7bd71 Mon Sep 17 00:00:00 2001 From: Ivan Tcholakov Date: Fri, 24 Apr 2015 13:30:23 +0300 Subject: A changelog update. --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index ae8dde6f9..28b92f23a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -20,6 +20,7 @@ Bug fixes for 3.0.1 - Fixed a bug (#3773) - ``db_select()`` didn't work for MySQL with the PDO :doc:`Database ` driver. - Fixed a bug (#3771) - :doc:`Form Validation Library ` was looking for a 'form_validation_' prefix when trying to translate field name labels. - Fixed a bug (#3787) - :doc:`FTP Library ` method ``delete_dir()`` failed when the target has subdirectories. +- Fixed a bug (#3801) - :doc: The `Output class ` method ``_display_cache()`` assigned incorrect timestamps. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b From 28fc4c7a4aecce433b29ca7bb027130a529fb262 Mon Sep 17 00:00:00 2001 From: Ivan Tcholakov Date: Fri, 24 Apr 2015 13:32:49 +0300 Subject: A changelog update 2. --- user_guide_src/source/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 28b92f23a..18aeac8c0 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -20,7 +20,7 @@ Bug fixes for 3.0.1 - Fixed a bug (#3773) - ``db_select()`` didn't work for MySQL with the PDO :doc:`Database ` driver. - Fixed a bug (#3771) - :doc:`Form Validation Library ` was looking for a 'form_validation_' prefix when trying to translate field name labels. - Fixed a bug (#3787) - :doc:`FTP Library ` method ``delete_dir()`` failed when the target has subdirectories. -- Fixed a bug (#3801) - :doc: The `Output class ` method ``_display_cache()`` assigned incorrect timestamps. +- Fixed a bug (#3801) - :doc: The `Output class ` method ``_display_cache()`` failed to read timestamps correctly. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b From d593535a2a80c7e1a13e31b6fe94684b42e8a306 Mon Sep 17 00:00:00 2001 From: Ivan Tcholakov Date: Fri, 24 Apr 2015 13:57:01 +0300 Subject: A changelog update 3. --- user_guide_src/source/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 18aeac8c0..cda5d319e 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -20,7 +20,7 @@ Bug fixes for 3.0.1 - Fixed a bug (#3773) - ``db_select()`` didn't work for MySQL with the PDO :doc:`Database ` driver. - Fixed a bug (#3771) - :doc:`Form Validation Library ` was looking for a 'form_validation_' prefix when trying to translate field name labels. - Fixed a bug (#3787) - :doc:`FTP Library ` method ``delete_dir()`` failed when the target has subdirectories. -- Fixed a bug (#3801) - :doc: The `Output class ` method ``_display_cache()`` failed to read timestamps correctly. +- Fixed a bug (#3801) - :doc:`Output Library ` method ``_display_cache()`` incorrectly looked for the last modified time of a directory instead of the cache file. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b From 0416a7f859e1ee6df557644b36ca10cfd356d224 Mon Sep 17 00:00:00 2001 From: Tyler Brownell Date: Fri, 24 Apr 2015 10:25:38 -0400 Subject: Reverts previous variable renaming and removes the foreach loop in favor of a simple if condition. --- system/libraries/Cache/Cache.php | 47 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index 39d05d930..73dec72ab 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -74,14 +74,14 @@ class CI_Cache extends CI_Driver_Library { * * @var mixed */ - protected $_driver = 'dummy'; + protected $_adapter = 'dummy'; /** * Fallback driver * * @var string */ - protected $_backup = 'dummy'; + protected $_backup_driver = 'dummy'; /** * Cache key prefix @@ -100,33 +100,32 @@ class CI_Cache extends CI_Driver_Library { */ public function __construct($config = array()) { - // Loop through the available driver types and overwrite them as they're found. - foreach (array('adapter', 'backup') as $driver_type) + if (isset($config['adapter']) && in_array($config['adapter'], $this->valid_drivers)) { - if (isset($config[$driver_type]) && in_array($config[$driver_type], $this->valid_drivers)) - { - $option = '_'.$driver_type; - $this->{$option} = $config[$driver_type]; - } + $this->_adapter = $config['adapter']; + } + + if (isset($config['backup']) && in_array($config['backup'], $this->valid_drivers)) + { + $this->_backup_driver = $config['backup']; } - // Overwrite the default key prefix. isset($config['key_prefix']) && $this->key_prefix = $config['key_prefix']; // If the specified adapter isn't available, check the backup. - if ( ! $this->is_supported($this->_driver)) + if ( ! $this->is_supported($this->_adapter)) { - if ( ! $this->is_supported($this->_backup)) + if ( ! $this->is_supported($this->_backup_driver)) { // Backup isn't supported either. Default to 'Dummy' driver. - log_message('error', 'Cache adapter "'.$this->_driver.'" and backup "'.$this->_backup.'" are both unavailable. Cache is now using "Dummy" adapter.'); - $this->_driver = 'dummy'; + log_message('error', 'Cache adapter "'.$this->_adapter.'" and backup "'.$this->_backup_driver.'" are both unavailable. Cache is now using "Dummy" adapter.'); + $this->_adapter = 'dummy'; } else { // Backup is supported. Set it to primary. - log_message('debug', 'Cache adapter "'.$this->_driver.'" is unavailable. Falling back to "'.$this->_backup.'" backup adapter.'); - $this->_driver = $this->_backup; + log_message('debug', 'Cache adapter "'.$this->_adapter.'" is unavailable. Falling back to "'.$this->_backup_driver.'" backup adapter.'); + $this->_adapter = $this->_backup_driver; } } } @@ -144,7 +143,7 @@ class CI_Cache extends CI_Driver_Library { */ public function get($id) { - return $this->{$this->_driver}->get($this->key_prefix.$id); + return $this->{$this->_adapter}->get($this->key_prefix.$id); } // ------------------------------------------------------------------------ @@ -160,7 +159,7 @@ class CI_Cache extends CI_Driver_Library { */ public function save($id, $data, $ttl = 60, $raw = FALSE) { - return $this->{$this->_driver}->save($this->key_prefix.$id, $data, $ttl, $raw); + return $this->{$this->_adapter}->save($this->key_prefix.$id, $data, $ttl, $raw); } // ------------------------------------------------------------------------ @@ -173,7 +172,7 @@ class CI_Cache extends CI_Driver_Library { */ public function delete($id) { - return $this->{$this->_driver}->delete($this->key_prefix.$id); + return $this->{$this->_adapter}->delete($this->key_prefix.$id); } // ------------------------------------------------------------------------ @@ -187,7 +186,7 @@ class CI_Cache extends CI_Driver_Library { */ public function increment($id, $offset = 1) { - return $this->{$this->_driver}->increment($id, $offset); + return $this->{$this->_adapter}->increment($id, $offset); } // ------------------------------------------------------------------------ @@ -201,7 +200,7 @@ class CI_Cache extends CI_Driver_Library { */ public function decrement($id, $offset = 1) { - return $this->{$this->_driver}->decrement($id, $offset); + return $this->{$this->_adapter}->decrement($id, $offset); } // ------------------------------------------------------------------------ @@ -213,7 +212,7 @@ class CI_Cache extends CI_Driver_Library { */ public function clean() { - return $this->{$this->_driver}->clean(); + return $this->{$this->_adapter}->clean(); } // ------------------------------------------------------------------------ @@ -226,7 +225,7 @@ class CI_Cache extends CI_Driver_Library { */ public function cache_info($type = 'user') { - return $this->{$this->_driver}->cache_info($type); + return $this->{$this->_adapter}->cache_info($type); } // ------------------------------------------------------------------------ @@ -239,7 +238,7 @@ class CI_Cache extends CI_Driver_Library { */ public function get_metadata($id) { - return $this->{$this->_driver}->get_metadata($this->key_prefix.$id); + return $this->{$this->_adapter}->get_metadata($this->key_prefix.$id); } // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b From 541e8b2d40d24d2dd37e6c6a0bf6fbd956c0b9b8 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 27 Apr 2015 13:03:58 +0300 Subject: [ci skip] Remove redundant comment about log_threshold --- application/config/config.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/application/config/config.php b/application/config/config.php index f78371f13..94e5d28a9 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -192,8 +192,6 @@ $config['directory_trigger'] = 'd'; | Error Logging Threshold |-------------------------------------------------------------------------- | -| If you have enabled error logging, you can set an error threshold to -| determine what gets logged. Threshold options are: | You can enable error logging by setting a threshold over zero. The | threshold determines what gets logged. Threshold options are: | -- cgit v1.2.3-24-g4f1b From b7661228c22c180cdf289300c88825dafeda39d9 Mon Sep 17 00:00:00 2001 From: Tyler Brownell Date: Mon, 27 Apr 2015 11:54:08 -0400 Subject: Adds error-level log messages when invalid adapters are set. --- system/libraries/Cache/Cache.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index 73dec72ab..ff68a4fd8 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -104,11 +104,19 @@ class CI_Cache extends CI_Driver_Library { { $this->_adapter = $config['adapter']; } + elseif (! in_array($config['adapter'], $this->valid_drivers)) + { + log_message('error', 'Cache adapter "'.$config['adapter'].'" is invalid.'); + } if (isset($config['backup']) && in_array($config['backup'], $this->valid_drivers)) { $this->_backup_driver = $config['backup']; } + elseif (! in_array($config['backup'], $this->valid_drivers)) + { + log_message('error', 'Cache backup adapter "'.$config['backup'].'" is invalid.'); + } isset($config['key_prefix']) && $this->key_prefix = $config['key_prefix']; -- cgit v1.2.3-24-g4f1b From ef0173db881f326db14e00cb333b9059349fc9a3 Mon Sep 17 00:00:00 2001 From: Tyler Brownell Date: Tue, 28 Apr 2015 10:33:05 -0400 Subject: Removed extra adapter validation. Adapter validation already happens in the system Driver library. --- system/libraries/Cache/Cache.php | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index ff68a4fd8..215a7c528 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -100,24 +100,8 @@ class CI_Cache extends CI_Driver_Library { */ public function __construct($config = array()) { - if (isset($config['adapter']) && in_array($config['adapter'], $this->valid_drivers)) - { - $this->_adapter = $config['adapter']; - } - elseif (! in_array($config['adapter'], $this->valid_drivers)) - { - log_message('error', 'Cache adapter "'.$config['adapter'].'" is invalid.'); - } - - if (isset($config['backup']) && in_array($config['backup'], $this->valid_drivers)) - { - $this->_backup_driver = $config['backup']; - } - elseif (! in_array($config['backup'], $this->valid_drivers)) - { - log_message('error', 'Cache backup adapter "'.$config['backup'].'" is invalid.'); - } - + isset($config['adapter']) && $this->_adapter = $config['adapter']; + isset($config['backup']) && $this->_backup_driver = $config['backup']; isset($config['key_prefix']) && $this->key_prefix = $config['key_prefix']; // If the specified adapter isn't available, check the backup. -- cgit v1.2.3-24-g4f1b From 7eedc63baae068b139256ee2369d43189e93fa7e Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 29 Apr 2015 15:43:46 +0900 Subject: Fix migration_version --- user_guide_src/source/libraries/migration.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/libraries/migration.rst b/user_guide_src/source/libraries/migration.rst index 25be0c93c..9eb9b78b1 100644 --- a/user_guide_src/source/libraries/migration.rst +++ b/user_guide_src/source/libraries/migration.rst @@ -88,7 +88,7 @@ as *20121031100537_add_blog.php*. } } -Then in **application/config/migration.php** set ``$config['migration_version'] = 1;``. +Then in **application/config/migration.php** set ``$config['migration_version'] = 20121031100537;``. ************* Usage Example @@ -181,4 +181,4 @@ Class Reference specific versions. It works just like ``current()`` but ignores ``$config['migration_version']``. :: - $this->migration->version(5); \ No newline at end of file + $this->migration->version(5); -- cgit v1.2.3-24-g4f1b From b137d232ef895cc47da4e39dfcb7c9078ba6be2b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 29 Apr 2015 11:44:38 +0300 Subject: Fix #3816 --- system/libraries/Form_validation.php | 2 +- user_guide_src/source/changelog.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index bb872c7cc..7599602c0 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -461,7 +461,7 @@ class CI_Form_validation { { $this->_field_data[$field]['postdata'] = $this->_reduce_array($validation_array, $row['keys']); } - elseif (isset($validation_array[$field]) && $validation_array[$field] !== '') + elseif (isset($validation_array[$field])) { $this->_field_data[$field]['postdata'] = $validation_array[$field]; } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index cda5d319e..a3e1dc44a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -21,6 +21,7 @@ Bug fixes for 3.0.1 - Fixed a bug (#3771) - :doc:`Form Validation Library ` was looking for a 'form_validation_' prefix when trying to translate field name labels. - Fixed a bug (#3787) - :doc:`FTP Library ` method ``delete_dir()`` failed when the target has subdirectories. - Fixed a bug (#3801) - :doc:`Output Library ` method ``_display_cache()`` incorrectly looked for the last modified time of a directory instead of the cache file. +- Fixed a bug (#3816) - :doc:`Form Validation Library ` treated empty string values as non-existing ones. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b From 0f8509025d2338dc069ddf42b6ade974a5da0ca3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 29 Apr 2015 12:33:11 +0300 Subject: Add list_fields() support for SQLite3 --- system/database/DB_driver.php | 2 +- .../drivers/pdo/subdrivers/pdo_sqlite_driver.php | 30 ++++++++++++++++------ system/database/drivers/sqlite3/sqlite3_driver.php | 30 ++++++++++++++++------ user_guide_src/source/changelog.rst | 4 +++ 4 files changed, 49 insertions(+), 17 deletions(-) diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 3d35c2d70..64ee880c8 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -1218,7 +1218,7 @@ abstract class CI_DB_driver { /** * Fetch Field Names * - * @param string the table name + * @param string $table Table name * @return array */ public function list_fields($table) diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php b/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php index f07f49f84..d5ca741fd 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php @@ -121,17 +121,31 @@ class CI_DB_pdo_sqlite_driver extends CI_DB_pdo_driver { // -------------------------------------------------------------------- /** - * Show column query + * Fetch Field Names * - * Generates a platform-specific query string so that the column names can be fetched - * - * @param string $table - * @return string + * @param string $table Table name + * @return array */ - protected function _list_columns($table = '') + public function list_fields($table) { - // Not supported - return FALSE; + // Is there a cached result? + if (isset($this->data_cache['field_names'][$table])) + { + return $this->data_cache['field_names'][$table]; + } + + if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) + { + return FALSE; + } + + $this->data_cache['field_names'][$table] = array(); + foreach ($result as $row) + { + $this->data_cache['field_names'][$table][] = $row['name']; + } + + return $this->data_cache['field_names'][$table]; } // -------------------------------------------------------------------- diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php index fdbe94939..a7c6420bb 100644 --- a/system/database/drivers/sqlite3/sqlite3_driver.php +++ b/system/database/drivers/sqlite3/sqlite3_driver.php @@ -247,17 +247,31 @@ class CI_DB_sqlite3_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Show column query + * Fetch Field Names * - * Generates a platform-specific query string so that the column names can be fetched - * - * @param string $table - * @return string + * @param string $table Table name + * @return array */ - protected function _list_columns($table = '') + public function list_fields($table) { - // Not supported - return FALSE; + // Is there a cached result? + if (isset($this->data_cache['field_names'][$table])) + { + return $this->data_cache['field_names'][$table]; + } + + if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE) + { + return FALSE; + } + + $this->data_cache['field_names'][$table] = array(); + foreach ($result as $row) + { + $this->data_cache['field_names'][$table][] = $row['name']; + } + + return $this->data_cache['field_names'][$table]; } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index a3e1dc44a..2fc50b956 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -11,6 +11,10 @@ Release Date: Not Released - Added DoS mitigation to :php:func:`hash_pbkdf2()` :doc:`compatibility function `. +- Database + + - Added ``list_fields()`` support for SQLite ('sqlite3' and 'pdo_sqlite' drivers). + Bug fixes for 3.0.1 ------------------- -- cgit v1.2.3-24-g4f1b From 12617cf6602164a1b43a71aa8fc7c3571881d3be Mon Sep 17 00:00:00 2001 From: Master Yoda Date: Thu, 30 Apr 2015 02:32:59 -0700 Subject: Fix typos in user guide. Corrected "csrf_regenerate" in libraries/security.rst (it read "csrf_regeneration", incorrect per source code). Corrected "blog" as default controller in general/controllers.rst (it read "Blog", not per convention). --- user_guide_src/source/general/controllers.rst | 2 +- user_guide_src/source/libraries/security.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/general/controllers.rst b/user_guide_src/source/general/controllers.rst index bc8319dd8..7ab5a7f6a 100644 --- a/user_guide_src/source/general/controllers.rst +++ b/user_guide_src/source/general/controllers.rst @@ -138,7 +138,7 @@ present, as will be the case when only your site root URL is requested. To specify a default controller, open your **application/config/routes.php** file and set this variable:: - $route['default_controller'] = 'Blog'; + $route['default_controller'] = 'blog'; Where Blog is the name of the controller class you want used. If you now load your main index.php file without specifying any URI segments you'll diff --git a/user_guide_src/source/libraries/security.rst b/user_guide_src/source/libraries/security.rst index ac56fc589..16b397994 100644 --- a/user_guide_src/source/libraries/security.rst +++ b/user_guide_src/source/libraries/security.rst @@ -88,7 +88,7 @@ may alter this behavior by editing the following config parameter :: - $config['csrf_regeneration'] = TRUE; + $config['csrf_regenerate'] = TRUE; Select URIs can be whitelisted from csrf protection (for example API endpoints expecting externally POSTed content). You can add these URIs -- cgit v1.2.3-24-g4f1b From 73b9e851a96dcafc0c07a0d0480853e31ba48e59 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 30 Apr 2015 13:06:40 +0300 Subject: Fix #3823 --- system/libraries/Session/drivers/Session_memcached_driver.php | 2 +- system/libraries/Session/drivers/Session_redis_driver.php | 2 +- user_guide_src/source/changelog.rst | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php index c7185ee44..97b860588 100644 --- a/system/libraries/Session/drivers/Session_memcached_driver.php +++ b/system/libraries/Session/drivers/Session_memcached_driver.php @@ -322,7 +322,7 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa $this->_lock_key = $lock_key; break; } - while ($attempt++ < 30); + while (++$attempt < 30); if ($attempt === 30) { diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php index 1ce101daf..b098cc441 100644 --- a/system/libraries/Session/drivers/Session_redis_driver.php +++ b/system/libraries/Session/drivers/Session_redis_driver.php @@ -336,7 +336,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle $this->_lock_key = $lock_key; break; } - while ($attempt++ < 30); + while (++$attempt < 30); if ($attempt === 30) { diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 2fc50b956..2d10f8f96 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -26,6 +26,7 @@ Bug fixes for 3.0.1 - Fixed a bug (#3787) - :doc:`FTP Library ` method ``delete_dir()`` failed when the target has subdirectories. - Fixed a bug (#3801) - :doc:`Output Library ` method ``_display_cache()`` incorrectly looked for the last modified time of a directory instead of the cache file. - Fixed a bug (#3816) - :doc:`Form Validation Library ` treated empty string values as non-existing ones. +- Fixed a bug (#3823) - :doc:`Session Library ` drivers Redis and Memcached didn't properly handle locks that are blocking the request for more than 30 seconds. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b From 801fa75045252c54653a71ce8e36553186d2a492 Mon Sep 17 00:00:00 2001 From: Intekhab Rizvi Date: Fri, 1 May 2015 13:00:56 +0530 Subject: MIMES : added new mime type for 3gp based video file upload --- application/config/mimes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/config/mimes.php b/application/config/mimes.php index 8eff4d2d5..bb4b67982 100644 --- a/application/config/mimes.php +++ b/application/config/mimes.php @@ -127,7 +127,7 @@ return array( 'rsa' => 'application/x-pkcs7', 'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'), '3g2' => 'video/3gpp2', - '3gp' => 'video/3gp', + '3gp' => array('video/3gp','video/3gpp'), 'mp4' => 'video/mp4', 'm4a' => 'audio/x-m4a', 'f4v' => 'video/mp4', -- cgit v1.2.3-24-g4f1b From 66553a0d117e4e2a2692a3a89a605ab2424f199f Mon Sep 17 00:00:00 2001 From: Intekhab Rizvi Date: Fri, 1 May 2015 15:08:02 +0530 Subject: MIMES : added new mime type for 3gp based video file upload, added space between array --- application/config/mimes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/config/mimes.php b/application/config/mimes.php index bb4b67982..98a6fde97 100644 --- a/application/config/mimes.php +++ b/application/config/mimes.php @@ -127,7 +127,7 @@ return array( 'rsa' => 'application/x-pkcs7', 'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'), '3g2' => 'video/3gpp2', - '3gp' => array('video/3gp','video/3gpp'), + '3gp' => array('video/3gp', 'video/3gpp'), 'mp4' => 'video/mp4', 'm4a' => 'audio/x-m4a', 'f4v' => 'video/mp4', -- cgit v1.2.3-24-g4f1b From 06a69ecd0d134c95a5190980ccae920bd08be67b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 2 May 2015 16:32:03 +0300 Subject: [ci skip] Fix a doc link causing a Sphinx compile warning --- user_guide_src/source/overview/features.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/overview/features.rst b/user_guide_src/source/overview/features.rst index b230be9a3..f62546b61 100644 --- a/user_guide_src/source/overview/features.rst +++ b/user_guide_src/source/overview/features.rst @@ -8,8 +8,8 @@ how intuitively or intelligently it is designed. Features don't reveal anything about the quality of the code, or the performance, or the attention to detail, or security practices. The only way to really judge an app is to try it and get to know the code. -:doc:`Installing <../installation/>`_ CodeIgniter is child's play so we -encourage you to do just that. In the mean time here's a list of +:doc:`Installing <../installation/index>` CodeIgniter is child's play so +we encourage you to do just that. In the mean time here's a list of CodeIgniter's main features. - Model-View-Controller Based System -- cgit v1.2.3-24-g4f1b From 8cb6f3676ccf84c9c12e056cc93caa767cd16ccd Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 2 May 2015 16:35:51 +0300 Subject: [ci skip] Fix timezones list in date helper docs Close #3818 --- user_guide_src/source/helpers/date_helper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst index e0f9f0033..a85da26a4 100644 --- a/user_guide_src/source/helpers/date_helper.rst +++ b/user_guide_src/source/helpers/date_helper.rst @@ -400,7 +400,7 @@ UM10 (UTC - 10:00) Hawaii-Aleutian Standard Time, Cook Islands UM95 (UTC - 09:30) Marquesas Islands UM9 (UTC - 09:00) Alaska Standard Time, Gambier Islands UM8 (UTC - 08:00) Pacific Standard Time, Clipperton Island -UM7 (UTC - 11:00) Mountain Standard Time +UM7 (UTC - 07:00) Mountain Standard Time UM6 (UTC - 06:00) Central Standard Time UM5 (UTC - 05:00) Eastern Standard Time, Western Caribbean UM45 (UTC - 04:30) Venezuelan Standard Time -- cgit v1.2.3-24-g4f1b From 326141a75814bac389acee26fe59eb1c4b0e68e9 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Sun, 3 May 2015 23:46:12 -0500 Subject: Fleshing out the composer.json file with more basic info. --- composer.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/composer.json b/composer.json index 4ff60c57e..c5f2f5aca 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,17 @@ { "description" : "The CodeIgniter framework", "name" : "codeigniter/framework", + "description": "CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.", + "type": "project", + "homepage": "http://codeigniter.com", "license": "MIT", + "support": { + "issues": "https://github.com/bcit-ci/CodeIgniter/issues", + "forum": "http://forum.codeigniter.com/", + "wiki": "https://github.com/bcit-ci/CodeIgniter/wiki", + "irc": "http://www.codeigniter.com/irc", + "source": "https://github.com/bcit-ci/CodeIgniter" + }, "require": { "php": ">=5.2.4" }, -- cgit v1.2.3-24-g4f1b From 080dffadd820312e97e8dcf964e90bf745e256b1 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Sun, 3 May 2015 23:50:09 -0500 Subject: Should ignore PHPStorm and Sublime Text project files. --- .gitignore | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9edcfca6d..5982f9bad 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,15 @@ user_guide_src/cilexer/build/* user_guide_src/cilexer/dist/* user_guide_src/cilexer/pycilexer.egg-info/* /vendor/ -/nbproject/ \ No newline at end of file + +# IDE Files +#------------------------- +/nbproject/ +.idea/* + +## Sublime Text cache files +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project -- cgit v1.2.3-24-g4f1b From 8e9b93d83a95141bfca2268113a0465a66a32d1f Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Mon, 4 May 2015 00:15:48 -0500 Subject: Ignore a number of files when using composer with --prefer-dist --- .gitattributes | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..c77437bd8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,20 @@ +# This file tells which files and folders should be ignored and +# NOT downloaded when using composer to pull down a project with +# the --prefer-dist option selected. Used to remove development +# specific files so user has a clean download. + +# git files +.gitattributes export-ignore +# .gitignore + +# helper config files +.travis.yml export-ignore +phpdoc.dist.xml export-ignore + +# Misc other files +readme.rst + +# They don't want all of our tests... +tests/codeigniter/ export-ignore +tests/travis/ export-ignore + -- cgit v1.2.3-24-g4f1b From 52fc5b0da856022261539854311533adb770873f Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Mon, 4 May 2015 07:47:15 -0500 Subject: Converting whitespace to tabs and removing issues link --- composer.json | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index c5f2f5aca..4fee20441 100644 --- a/composer.json +++ b/composer.json @@ -1,17 +1,16 @@ { - "description" : "The CodeIgniter framework", - "name" : "codeigniter/framework", - "description": "CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.", - "type": "project", - "homepage": "http://codeigniter.com", + "description": "The CodeIgniter framework", + "name": "codeigniter/framework", + "description": "CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.", + "type": "project", + "homepage": "http://codeigniter.com", "license": "MIT", - "support": { - "issues": "https://github.com/bcit-ci/CodeIgniter/issues", - "forum": "http://forum.codeigniter.com/", - "wiki": "https://github.com/bcit-ci/CodeIgniter/wiki", - "irc": "http://www.codeigniter.com/irc", - "source": "https://github.com/bcit-ci/CodeIgniter" - }, + "support": { + "forum": "http://forum.codeigniter.com/", + "wiki": "https://github.com/bcit-ci/CodeIgniter/wiki", + "irc": "http://www.codeigniter.com/irc", + "source": "https://github.com/bcit-ci/CodeIgniter" + }, "require": { "php": ">=5.2.4" }, -- cgit v1.2.3-24-g4f1b From baa6a677b21284fd0f3754a3c39f85212bb6c669 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Mon, 4 May 2015 08:03:52 -0500 Subject: Keeping the user guide source out of the dist files. --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitattributes b/.gitattributes index c77437bd8..68d6b5b38 100644 --- a/.gitattributes +++ b/.gitattributes @@ -18,3 +18,5 @@ readme.rst tests/codeigniter/ export-ignore tests/travis/ export-ignore +# User Guide Source Files +user_guide_src -- cgit v1.2.3-24-g4f1b From ca2d5f9e4785395c02133a12fc8d436f697ccfc2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 4 May 2015 16:03:53 +0300 Subject: [ci skip] Fix IRC link in composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4fee20441..76bd21787 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "support": { "forum": "http://forum.codeigniter.com/", "wiki": "https://github.com/bcit-ci/CodeIgniter/wiki", - "irc": "http://www.codeigniter.com/irc", + "irc": "irc://irc.freenode.net/codeigniter", "source": "https://github.com/bcit-ci/CodeIgniter" }, "require": { -- cgit v1.2.3-24-g4f1b From cc9b09b24029df673e1b0eb6e03eae9dfab87b11 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Mon, 4 May 2015 08:15:55 -0500 Subject: Renaming folders to directories :) --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 68d6b5b38..51fea4174 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ -# This file tells which files and folders should be ignored and +# This file tells which files and directories should be ignored and # NOT downloaded when using composer to pull down a project with # the --prefer-dist option selected. Used to remove development # specific files so user has a clean download. -- cgit v1.2.3-24-g4f1b From 7cf0cc1ffe3fc1722ccf00ddf9f4c18337b4d611 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 5 May 2015 14:29:04 +0300 Subject: [ci skip] Remove double description from composer.json --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 76bd21787..0653a7885 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,6 @@ { "description": "The CodeIgniter framework", "name": "codeigniter/framework", - "description": "CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.", "type": "project", "homepage": "http://codeigniter.com", "license": "MIT", -- cgit v1.2.3-24-g4f1b From f5327360296980a4396b69d3deaa9f330fba75f8 Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Wed, 6 May 2015 19:34:57 +0800 Subject: update apc link --- user_guide_src/source/libraries/caching.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index f54de5faf..1fc1b5bfb 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -18,7 +18,7 @@ requirements are not met. Example Usage ************* -The following example will load the cache driver, specify `APC <#apc>`_ +The following example will load the cache driver, specify `APC <#alternative-php-cache-apc-caching>`_ as the driver to use, and fall back to file-based caching if APC is not available in the hosting environment. -- cgit v1.2.3-24-g4f1b From a5e58eb5b246fcf9dd323527c57d02f4219479c8 Mon Sep 17 00:00:00 2001 From: Oleg Filippov Date: Wed, 6 May 2015 18:09:03 +0300 Subject: Update user_agents.php added new browser Spartan --- application/config/user_agents.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/config/user_agents.php b/application/config/user_agents.php index 6f3295a70..2fd955435 100644 --- a/application/config/user_agents.php +++ b/application/config/user_agents.php @@ -62,6 +62,7 @@ $platforms = array( $browsers = array( 'OPR' => 'Opera', 'Flock' => 'Flock', + 'Edge' => 'Spartan', 'Chrome' => 'Chrome', // Opera 10+ always reports Opera/9.80 and appends Version/ to the user agent string 'Opera.*?Version' => 'Opera', -- cgit v1.2.3-24-g4f1b From 170ae282338584ebe257d2fb21101ccf84a3f800 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 7 May 2015 10:43:28 +0300 Subject: Issue/PR #3836 --- system/libraries/Cache/drivers/Cache_redis.php | 8 ++++++-- user_guide_src/source/changelog.rst | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index b940b76cb..773d20c43 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -165,7 +165,9 @@ class CI_Cache_redis extends CI_Driver */ public function increment($id, $offset = 1) { - return $this->_redis->incr($id, $offset); + return ($offset == 1) + ? $this->_redis->incr($id) + : $this->_redis->incrBy($id, $offset); } // ------------------------------------------------------------------------ @@ -179,7 +181,9 @@ class CI_Cache_redis extends CI_Driver */ public function decrement($id, $offset = 1) { - return $this->_redis->decr($id, $offset); + return ($offset == 1) + ? $this->_redis->decr($id) + : $this->_redis->decrBy($id, $offset); } // ------------------------------------------------------------------------ diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 2d10f8f96..c5010b61a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -27,6 +27,7 @@ Bug fixes for 3.0.1 - Fixed a bug (#3801) - :doc:`Output Library ` method ``_display_cache()`` incorrectly looked for the last modified time of a directory instead of the cache file. - Fixed a bug (#3816) - :doc:`Form Validation Library ` treated empty string values as non-existing ones. - Fixed a bug (#3823) - :doc:`Session Library ` drivers Redis and Memcached didn't properly handle locks that are blocking the request for more than 30 seconds. +- Fixed a bug (#3836) - :doc:`Cache Library ` methods ``increment()``, ``decrement()`` didn't work with an offset other than 1 for the Redis driver. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b From 70f738a14b0f6f70d9292c0f488ea423a76f438e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 7 May 2015 12:16:33 +0300 Subject: Revert "Issue/PR #3836" This reverts commit 170ae282338584ebe257d2fb21101ccf84a3f800. --- system/libraries/Cache/drivers/Cache_redis.php | 8 ++------ user_guide_src/source/changelog.rst | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index 773d20c43..b940b76cb 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -165,9 +165,7 @@ class CI_Cache_redis extends CI_Driver */ public function increment($id, $offset = 1) { - return ($offset == 1) - ? $this->_redis->incr($id) - : $this->_redis->incrBy($id, $offset); + return $this->_redis->incr($id, $offset); } // ------------------------------------------------------------------------ @@ -181,9 +179,7 @@ class CI_Cache_redis extends CI_Driver */ public function decrement($id, $offset = 1) { - return ($offset == 1) - ? $this->_redis->decr($id) - : $this->_redis->decrBy($id, $offset); + return $this->_redis->decr($id, $offset); } // ------------------------------------------------------------------------ diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index c5010b61a..2d10f8f96 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -27,7 +27,6 @@ Bug fixes for 3.0.1 - Fixed a bug (#3801) - :doc:`Output Library ` method ``_display_cache()`` incorrectly looked for the last modified time of a directory instead of the cache file. - Fixed a bug (#3816) - :doc:`Form Validation Library ` treated empty string values as non-existing ones. - Fixed a bug (#3823) - :doc:`Session Library ` drivers Redis and Memcached didn't properly handle locks that are blocking the request for more than 30 seconds. -- Fixed a bug (#3836) - :doc:`Cache Library ` methods ``increment()``, ``decrement()`` didn't work with an offset other than 1 for the Redis driver. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b From c836f2af72536733fa1cc990b46522b9ef16153e Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Thu, 7 May 2015 18:05:33 +0800 Subject: update userguide --- user_guide_src/source/database/utilities.rst | 4 ++-- user_guide_src/source/general/reserved_names.rst | 1 + user_guide_src/source/libraries/caching.rst | 2 +- user_guide_src/source/libraries/config.rst | 4 ++-- user_guide_src/source/tutorial/create_news_items.rst | 4 ++-- user_guide_src/source/tutorial/news_section.rst | 10 +++++----- user_guide_src/source/tutorial/static_pages.rst | 2 +- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/user_guide_src/source/database/utilities.rst b/user_guide_src/source/database/utilities.rst index cc4aeb018..81b949dd7 100644 --- a/user_guide_src/source/database/utilities.rst +++ b/user_guide_src/source/database/utilities.rst @@ -18,7 +18,7 @@ Initializing the Utility Class Load the Utility Class as follows:: - $this->load->dbutil() + $this->load->dbutil(); You can also pass another database object to the DB Utility loader, in case the database you want to manage isn't the default one:: @@ -35,7 +35,7 @@ assigning it directly to ``$this->dbutil``. Once initialized you will access the methods using the ``$this->dbutil`` object:: - $this->dbutil->some_method() + $this->dbutil->some_method(); **************************** Using the Database Utilities diff --git a/user_guide_src/source/general/reserved_names.rst b/user_guide_src/source/general/reserved_names.rst index a7b0c3465..5d745cba6 100644 --- a/user_guide_src/source/general/reserved_names.rst +++ b/user_guide_src/source/general/reserved_names.rst @@ -75,6 +75,7 @@ Constants - FOPEN_READ_WRITE_CREATE - FOPEN_WRITE_CREATE_STRICT - FOPEN_READ_WRITE_CREATE_STRICT +- SHOW_DEBUG_BACKTRACE - EXIT_SUCCESS - EXIT_ERROR - EXIT_CONFIG diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index 1fc1b5bfb..a7081ec6b 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -66,7 +66,7 @@ Class Reference hosting environment. :: - if ($this->cache->apc->is_supported() + if ($this->cache->apc->is_supported()) { if ($data = $this->cache->apc->get('my_cache')) { diff --git a/user_guide_src/source/libraries/config.rst b/user_guide_src/source/libraries/config.rst index 3138e3403..a45cacdf5 100644 --- a/user_guide_src/source/libraries/config.rst +++ b/user_guide_src/source/libraries/config.rst @@ -92,9 +92,9 @@ Fetching Config Items To retrieve an item from your config file, use the following function:: - $this->config->item('item name'); + $this->config->item('item_name'); -Where item name is the $config array index you want to retrieve. For +Where item_name is the $config array index you want to retrieve. For example, to fetch your language choice you'll do this:: $lang = $this->config->item('language'); diff --git a/user_guide_src/source/tutorial/create_news_items.rst b/user_guide_src/source/tutorial/create_news_items.rst index 71d2080af..5c5270472 100644 --- a/user_guide_src/source/tutorial/create_news_items.rst +++ b/user_guide_src/source/tutorial/create_news_items.rst @@ -18,11 +18,11 @@ application/views/news/create.php. :: -

+

- +
diff --git a/user_guide_src/source/tutorial/news_section.rst b/user_guide_src/source/tutorial/news_section.rst index d8ebac4a3..688f2cb19 100644 --- a/user_guide_src/source/tutorial/news_section.rst +++ b/user_guide_src/source/tutorial/news_section.rst @@ -143,17 +143,17 @@ and add the next piece of code. :: -

+

-

+

- +
-

View article

+

View article

- + Here, each news item is looped and displayed to the user. You can see we wrote our template in PHP mixed with HTML. If you prefer to use a diff --git a/user_guide_src/source/tutorial/static_pages.rst b/user_guide_src/source/tutorial/static_pages.rst index 62b3469ad..e948d3011 100644 --- a/user_guide_src/source/tutorial/static_pages.rst +++ b/user_guide_src/source/tutorial/static_pages.rst @@ -64,7 +64,7 @@ following code. -

+

The header contains the basic HTML code that you'll want to display before loading the main view, together with a heading. It will also -- cgit v1.2.3-24-g4f1b From fbde2798688ab99cfe3fdd22746d60f0877b2c27 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 May 2015 11:03:06 +0300 Subject: Fix #3846 --- system/libraries/Image_lib.php | 18 ++++++++++++------ user_guide_src/source/changelog.rst | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index e056654bb..6374aacdd 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1055,8 +1055,11 @@ class CI_Image_lib { if ($this->rotation_angle === 'hor') { - for ($i = 0; $i < $height; $i++, $left = 0, $right = $width-1) + for ($i = 0; $i < $height; $i++) { + $left = 0; + $right = $width - 1; + while ($left < $right) { $cl = imagecolorat($src_img, $left, $i); @@ -1072,18 +1075,21 @@ class CI_Image_lib { } else { - for ($i = 0; $i < $width; $i++, $top = 0, $bot = $height-1) + for ($i = 0; $i < $width; $i++) { - while ($top < $bot) + $top = 0; + $bottom = $height - 1; + + while ($top < $botttom) { $ct = imagecolorat($src_img, $i, $top); - $cb = imagecolorat($src_img, $i, $bot); + $cb = imagecolorat($src_img, $i, $bottom); imagesetpixel($src_img, $i, $top, $cb); - imagesetpixel($src_img, $i, $bot, $ct); + imagesetpixel($src_img, $i, $bottom, $ct); $top++; - $bot--; + $bottom--; } } } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 2d10f8f96..185a17af4 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -27,6 +27,7 @@ Bug fixes for 3.0.1 - Fixed a bug (#3801) - :doc:`Output Library ` method ``_display_cache()`` incorrectly looked for the last modified time of a directory instead of the cache file. - Fixed a bug (#3816) - :doc:`Form Validation Library ` treated empty string values as non-existing ones. - Fixed a bug (#3823) - :doc:`Session Library ` drivers Redis and Memcached didn't properly handle locks that are blocking the request for more than 30 seconds. +- Fixed a bug (#3846) - :doc:`Image Manipulation Library ` method `image_mirror_gd()` didn't properly initialize its variables. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b From 60b69669e19304759e36121b1261473fc560f243 Mon Sep 17 00:00:00 2001 From: Rodolfo Silva Date: Mon, 11 May 2015 11:39:18 -0300 Subject: Adding validation not documented. --- user_guide_src/source/libraries/form_validation.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst index da43a4bec..dbf1e8a63 100644 --- a/user_guide_src/source/libraries/form_validation.rst +++ b/user_guide_src/source/libraries/form_validation.rst @@ -946,6 +946,7 @@ Rule Parameter Description ========================= ========== ============================================================================================= ======================= **required** No Returns FALSE if the form element is empty. **matches** Yes Returns FALSE if the form element does not match the one in the parameter. matches[form_item] +**regex_match** Yes Returns FALSE if the form element does not match the regular expression. regex_match[/regex/] **differs** Yes Returns FALSE if the form element does not differ from the one in the parameter. differs[form_item] **is_unique** Yes Returns FALSE if the form element is not unique to the table and field name in the is_unique[table.field] parameter. Note: This rule requires :doc:`Query Builder <../database/query_builder>` to be -- cgit v1.2.3-24-g4f1b From 5d78fd839120419ba7c0642f120313543af99b99 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 May 2015 18:19:01 +0300 Subject: Fix an undefined variable error from fbde2798688ab99cfe3fdd22746d60f0877b2c27 --- system/libraries/Image_lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 6374aacdd..ce6c42b02 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -1080,7 +1080,7 @@ class CI_Image_lib { $top = 0; $bottom = $height - 1; - while ($top < $botttom) + while ($top < $bottom) { $ct = imagecolorat($src_img, $i, $top); $cb = imagecolorat($src_img, $i, $bottom); -- cgit v1.2.3-24-g4f1b From 7d19161c1d596c379e72c40daec290ce6f5f16b6 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 13 May 2015 11:20:44 +0300 Subject: [ci skip] Fix an erroneous doc link Close #3851 --- user_guide_src/source/general/environments.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/general/environments.rst b/user_guide_src/source/general/environments.rst index f5a4f617e..7f030b6ef 100644 --- a/user_guide_src/source/general/environments.rst +++ b/user_guide_src/source/general/environments.rst @@ -48,5 +48,5 @@ Configuration Files Optionally, you can have CodeIgniter load environment-specific configuration files. This may be useful for managing things like differing API keys across multiple environments. This is described in -more detail in the environment section of the :doc:`Config -Class <../libraries/config#environments>`_ documentation. \ No newline at end of file +more detail in the environment section of the :doc:`Config Class +<../libraries/config>`_ documentation. \ No newline at end of file -- cgit v1.2.3-24-g4f1b From b4f3630ae5240d085cf4283b82546005002e59e4 Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Wed, 13 May 2015 17:47:41 +0800 Subject: [Cache]minor adjustments for save function --- system/libraries/Cache/drivers/Cache_redis.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index b940b76cb..66966ba16 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -125,9 +125,7 @@ class CI_Cache_redis extends CI_Driver $this->_redis->sRemove('_ci_redis_serialized', $id); } - return ($ttl) - ? $this->_redis->setex($id, $ttl, $data) - : $this->_redis->set($id, $data); + return $this->_redis->set($id, $data, $ttl); } // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b From 4c08ea9c69aeb4acc1fbe47e873a11e82a6d5b79 Mon Sep 17 00:00:00 2001 From: Leandro Mangini Antunes Date: Wed, 13 May 2015 11:15:01 -0300 Subject: Fixed bug - using field_data() on Oracle databases When you're using oracle databases and want to retrieve column information through the function field_data($table) you get the following notice: - Notice: Undefined property: stdClass::$COLUMN_DEFAULT in system/database/drivers/oci8/oci8_driver.php on line 576; This happens because the oci8 driver tries to access a property that does not exist on query used to get field information. Checking the code we see a small validation to set default value, but the variable $default is not used. So we fix this bug by simply changing: $retval[$i]->default = $query[$i]->COLUMN_DEFAULT; to $retval[$i]->default = $default; Bug fixed. No more notices and the properly value is set. --- system/database/drivers/oci8/oci8_driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index 4010995a1..b5cf26536 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -573,7 +573,7 @@ class CI_DB_oci8_driver extends CI_DB { { $default = ''; } - $retval[$i]->default = $query[$i]->COLUMN_DEFAULT; + $retval[$i]->default = $default; } return $retval; -- cgit v1.2.3-24-g4f1b From dee92a039aca627b55a8c0ed131f4d97dcc7223e Mon Sep 17 00:00:00 2001 From: Leandro Mangini Antunes Date: Wed, 13 May 2015 11:55:13 -0300 Subject: Update changelog.rst --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 185a17af4..f9fe93903 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -18,6 +18,7 @@ Release Date: Not Released Bug fixes for 3.0.1 ------------------- +- Fixed a bug (#3854) - Using field_data() on Oracle databases - Fixed a bug (#3733) - Autoloading of libraries with aliases didn't work, although it was advertised to. - Fixed a bug (#3744) - Redis :doc:`Caching ` driver didn't handle authentication failures properly. - Fixed a bug (#3761) - :doc:`URL Helper ` function :php:func:`anchor()` didn't work with array inputs. -- cgit v1.2.3-24-g4f1b From 56514f1de740ff72198228a10deab8f9da2dfe13 Mon Sep 17 00:00:00 2001 From: Leandro Mangini Antunes Date: Wed, 13 May 2015 12:53:21 -0300 Subject: Update changelog.rst --- user_guide_src/source/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index f9fe93903..15be738d6 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -18,7 +18,6 @@ Release Date: Not Released Bug fixes for 3.0.1 ------------------- -- Fixed a bug (#3854) - Using field_data() on Oracle databases - Fixed a bug (#3733) - Autoloading of libraries with aliases didn't work, although it was advertised to. - Fixed a bug (#3744) - Redis :doc:`Caching ` driver didn't handle authentication failures properly. - Fixed a bug (#3761) - :doc:`URL Helper ` function :php:func:`anchor()` didn't work with array inputs. @@ -29,6 +28,7 @@ Bug fixes for 3.0.1 - Fixed a bug (#3816) - :doc:`Form Validation Library ` treated empty string values as non-existing ones. - Fixed a bug (#3823) - :doc:`Session Library ` drivers Redis and Memcached didn't properly handle locks that are blocking the request for more than 30 seconds. - Fixed a bug (#3846) - :doc:`Image Manipulation Library ` method `image_mirror_gd()` didn't properly initialize its variables. +- Fixed a bug (#3854) - `field_data()` didn't work properly with the Oracle (OCI8) database driver. Version 3.0.0 ============= -- cgit v1.2.3-24-g4f1b