Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
db81ff52
Commit
db81ff52
authored
Sep 19, 2009
by
Dries
Browse files
- Patch
#581286
by David Strauss | moshe weitzman: fixed detection of CLI environments properly.
parent
2bc3de6a
Changes
3
Hide whitespace changes
Inline
Side-by-side
includes/bootstrap.inc
View file @
db81ff52
...
...
@@ -431,7 +431,7 @@ function drupal_override_server_variables($variables = array()) {
'REMOTE_ADDR'
=>
'127.0.0.1'
,
'REQUEST_METHOD'
=>
'GET'
,
'SERVER_NAME'
=>
NULL
,
'SERVER_SOFTWARE'
=>
'PHP CLI'
,
'SERVER_SOFTWARE'
=>
NULL
,
'HTTP_USER_AGENT'
=>
NULL
,
);
// Replace elements of the $_SERVER array, as appropriate.
...
...
@@ -787,7 +787,7 @@ function drupal_page_is_cacheable($allow_caching = NULL) {
}
return
$allow_caching_static
&&
(
$_SERVER
[
'REQUEST_METHOD'
]
==
'GET'
||
$_SERVER
[
'REQUEST_METHOD'
]
==
'HEAD'
)
&&
$_SERVER
[
'SERVER_SOFTWARE'
]
!==
'PHP CLI'
;
&&
!
drupal_is_cli
()
;
}
/**
...
...
@@ -1546,7 +1546,7 @@ function _drupal_bootstrap($phase) {
require_once
DRUPAL_ROOT
.
'/'
.
variable_get
(
'lock_inc'
,
'includes/lock.inc'
);
lock_initialize
();
if
(
$_SERVER
[
'SERVER_SOFTWARE'
]
!==
'PHP CLI'
)
{
if
(
!
drupal_is_cli
()
)
{
ob_start
();
drupal_page_header
();
}
...
...
@@ -1999,3 +1999,10 @@ function &drupal_static($name, $default_value = NULL, $reset = FALSE) {
function
drupal_static_reset
(
$name
=
NULL
)
{
drupal_static
(
$name
,
NULL
,
TRUE
);
}
/**
* Detect whether the current script is running in a command-line environment.
*/
function
drupal_is_cli
()
{
return
(
!
isset
(
$_SERVER
[
'SERVER_SOFTWARE'
])
&&
(
php_sapi_name
()
==
'cli'
||
(
is_numeric
(
$_SERVER
[
'argc'
])
&&
$_SERVER
[
'argc'
]
>
0
)));
}
scripts/drupal.sh
View file @
db81ff52
...
...
@@ -62,7 +62,7 @@
$_SERVER
[
'HTTP_HOST'
]
=
'default'
;
$_SERVER
[
'PHP_SELF'
]
=
'/index.php'
;
$_SERVER
[
'REMOTE_ADDR'
]
=
'127.0.0.1'
;
$_SERVER
[
'SERVER_SOFTWARE'
]
=
'PHP CLI'
;
$_SERVER
[
'SERVER_SOFTWARE'
]
=
NULL
;
$_SERVER
[
'REQUEST_METHOD'
]
=
'GET'
;
$_SERVER
[
'QUERY_STRING'
]
=
''
;
$_SERVER
[
'PHP_SELF'
]
=
$_SERVER
[
'REQUEST_URI'
]
=
'/'
;
...
...
scripts/run-tests.sh
View file @
db81ff52
...
...
@@ -24,7 +24,7 @@
}
else
{
// Run administrative functions as CLI.
simpletest_script_init
(
"PHP CLI"
)
;
simpletest_script_init
(
NULL
)
;
}
// Bootstrap to perform initial validation or other operations.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment