Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust so telemetry not sent for GitHub workflows #407

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .lando/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ set_up() {
unzip -q backdrop.zip && mv backdrop-1.x backdrop
echo 'if (isset($_SERVER["BACKDROP_SETTINGS"])) unset($_SERVER["BACKDROP_SETTINGS"]);' >> backdrop/settings.php

# Disable sending of telemetry data from GitHub Action runners. Override if
# testing telemetry locally.
echo '$settings["telemetry_enabled"] = FALSE;' >> backdrop/settings.php

# Configure multisite installation.
cp -r backdrop multisite
cd multisite
Expand Down
4 changes: 3 additions & 1 deletion commands/status.bee.inc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ function status_bee_callback($arguments, $options) {
try {
// Check if telemetry is enabled.
$telemetry_query = "SELECT `status` FROM {system} WHERE `name` = 'telemetry'";
$telemetry_status = (bool) db_query($telemetry_query)->fetchField();
$telemetry_module = (bool) db_query($telemetry_query)->fetchField();
$telemetry_override = isset($settings['telemetry_enabled']) ? $settings['telemetry_enabled'] : TRUE;
$telemetry_status = $telemetry_module && $telemetry_override;

// States directly from database, as state_get() requires a higher
// bootstrap level with caching and locking.
Expand Down
8 changes: 7 additions & 1 deletion includes/telemetry.inc
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,14 @@ function bee_get_headers_from_curl_response($response_header_content) {
* TRUE if module is enabled, FALSE otherwise.
*/
function bee_telemetry_enabled() {
global $_bee_bootstrap_level;
global $_bee_bootstrap_level, $settings;
$status = FALSE;

$bee_telemetry_override_setting = isset($settings['telemetry_enabled']) ? $settings['telemetry_enabled'] : TRUE;
if (!$bee_telemetry_override_setting) {
return $status;
}

if ($_bee_bootstrap_level == BEE_BOOTSTRAP_FULL) {
// If full bootstrap we can use the Backdrop function.
$status = module_exists('telemetry');
Expand Down
Loading