Skip to content
Snippets Groups Projects
Verified Commit f7869f9f authored by Tim Otten's avatar Tim Otten Committed by Kevin Cristiano
Browse files

Do not call session_start() on CLI processes

This is a refinement of the idea in https://github.com/civicrm/civicrm-wordpress/pull/135

 to address other CLI use-cases.

Before
-------

If I have a `wpmaster` site on on `bknix-max` (php73), and if I run `cv upgrade:db -vv`, then there are several warnings like this:

After
-----

It doesn't try to start session in CLI (where sessions don't make sense).

Signed-off-by: default avatarKevin Cristiano <kcristiano@kcristiano.com>
parent 630e746e
No related branches found
No related tags found
No related merge requests found
......@@ -367,7 +367,7 @@ class CiviCRM_For_WordPress {
* There is no session handling in WP - hence we start it for CiviCRM pages
* except when running via WP-CLI which does not require sessions.
*/
if ( empty( $session_id ) && ! ( defined( 'WP_CLI' ) && WP_CLI ) ) {
if ( empty( $session_id ) && ! ( defined( 'WP_CLI' ) && WP_CLI ) && ( PHP_SAPI !== 'cli' ) ) {
session_start();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment