summaryrefslogtreecommitdiffstats
path: root/system/core/Common.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2013-11-12 16:04:55 +0100
committerAndrey Andreev <narf@devilix.net>2013-11-12 16:04:55 +0100
commitf964b16f3db95d655420dfae2012ee9fbb98a1a8 (patch)
treea3a2acf87bf15604da653c67e1a348097225f817 /system/core/Common.php
parent35e3b0bc4f723b938160da87aeb5ad9e054507c4 (diff)
Deprecate CI_Input::is_cli_request() and add common function is_cli() to replace it
Calls to this function are often needed before the Input library is available
Diffstat (limited to 'system/core/Common.php')
-rw-r--r--system/core/Common.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/system/core/Common.php b/system/core/Common.php
index 56008efe8..c008bd571 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -355,6 +355,24 @@ if ( ! function_exists('is_https'))
// ------------------------------------------------------------------------
+if ( ! function_exists('is_cli'))
+{
+
+ /**
+ * Is CLI?
+ *
+ * Test to see if a request was made from the command line.
+ *
+ * @return bool
+ */
+ function is_cli()
+ {
+ return (PHP_SAPI === 'cli' OR defined('STDIN'));
+ }
+}
+
+// ------------------------------------------------------------------------
+
if ( ! function_exists('show_error'))
{
/**