summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.php2
-rw-r--r--system/database/DB_query_builder.php12
-rw-r--r--user_guide_src/source/changelog.rst1
-rw-r--r--user_guide_src/source/general/environments.rst10
4 files changed, 16 insertions, 9 deletions
diff --git a/index.php b/index.php
index 5a1190112..3b00dd360 100644
--- a/index.php
+++ b/index.php
@@ -42,7 +42,7 @@
*
* NOTE: If you change these, also change the error_reporting() code below
*/
- define('ENVIRONMENT', 'development');
+ define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
/*
*---------------------------------------------------------------
* ERROR REPORTING
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 45d68cd39..ccfd9bfc6 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -672,22 +672,22 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$k = $this->protect_identifiers($k);
$prefix = (count($this->qb_like) === 0) ? '' : $type;
$v = $this->escape_like_str($v);
-
+
if ($side === 'none')
{
- $like_statement = $prefix." $k $not LIKE '{$v}'";
+ $like_statement = "{$prefix} $k $not LIKE '{$v}'";
}
elseif ($side === 'before')
{
- $like_statement = $prefix." $k $not LIKE '%{$v}'";
+ $like_statement = "{$prefix} $k $not LIKE '%{$v}'";
}
elseif ($side === 'after')
{
- $like_statement = $prefix." $k $not LIKE '{$v}%'";
+ $like_statement = "{$prefix} $k $not LIKE '{$v}%'";
}
else
{
- $like_statement = $prefix." $k $not LIKE '%{$v}%'";
+ $like_statement = "{$prefix} $k $not LIKE '%{$v}%'";
}
// some platforms require an escape sequence definition for LIKE wildcards
@@ -2336,4 +2336,4 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
}
/* End of file DB_query_builder.php */
-/* Location: ./system/database/DB_query_builder.php */ \ No newline at end of file
+/* Location: ./system/database/DB_query_builder.php */
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 3989b52d2..de4af7efe 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -19,6 +19,7 @@ Release Date: Not Released
- General Changes
- PHP 5.1.6 is no longer supported. CodeIgniter now requires PHP 5.2.4.
+ - ``$_SERVER['CI_ENV']`` can now be set to control the ``ENVIRONMENT`` constant.
- Added an optional backtrace to php-error template.
- Added Android to the list of user agents.
- Added Windows 7, Android, Blackberry and iOS to the list of user platforms.
diff --git a/user_guide_src/source/general/environments.rst b/user_guide_src/source/general/environments.rst
index 40725feba..fa1b096e2 100644
--- a/user_guide_src/source/general/environments.rst
+++ b/user_guide_src/source/general/environments.rst
@@ -11,10 +11,16 @@ when "live".
The ENVIRONMENT Constant
========================
-By default, CodeIgniter comes with the environment constant set to
+By default, CodeIgniter comes with the environment constant set to use
+the value provided in ``$_SERVER['CI_ENV']``, otherwise defaults to
'development'. At the top of index.php, you will see::
- define('ENVIRONMENT', 'development');
+ define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
+
+This server variable can be set in your .htaccess file, or Apache
+config using `SetEnv <https://httpd.apache.org/docs/2.2/mod/mod_env.html#setenv>`_.
+Alternative methods are available for nginx and other servers, or you can
+remove this logic entirely and set the constant based on the HTTP_HOST or IP.
In addition to affecting some basic framework behavior (see the next
section), you may use this constant in your own development to