Skip to content

Commit

Permalink
馃懡 Enable $_SERVER['HTTPS'] in console (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
QWp6t committed Mar 27, 2022
1 parent 62bcf0a commit 4279d27
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Roots/Acorn/Bootloader.php
Expand Up @@ -111,6 +111,7 @@ public function boot($callback = null)
}

if ($app->runningInConsole()) {
$this->enableHttpsInConsole();
return class_exists('WP_CLI') ? $this->bootWpCli($app) : $this->bootConsole($app);
}

Expand All @@ -125,6 +126,20 @@ public function boot($callback = null)
return $this->bootWordPress($app);
}

/**
* Enable $_SERVER[HTTPS] in a console environment.
*
* @return void
*/
protected function enableHttpsInConsole()
{
$enable = apply_filters('acorn/enable_https_in_console', parse_url(get_option('home'), PHP_URL_SCHEME) === 'https');

if ($enable) {
$_SERVER['HTTPS'] = 'on';
}
}

/**
* Boot the Application for console.
*
Expand Down

0 comments on commit 4279d27

Please sign in to comment.