Skip to content

Commit e822eba

Browse files
author
Igor Vitol
committed
Blackfire is enabled by default as it was before. Added option to disable it. Keeping switcher in PHP_EXTENSIONS env variable
1 parent 29bc152 commit e822eba

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

src/Command/BuildCompose.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ protected function configure(): void
240240
null,
241241
InputOption::VALUE_NONE,
242242
'Enables XDebug'
243+
)->addOption(
244+
Source\CliSource::OPTION_WITHOUT_BLACKFIRE,
245+
null,
246+
InputOption::VALUE_NONE,
247+
'Do not load blackfire php extension by default'
243248
)->addOption(
244249
Source\CliSource::OPTION_ENV_VARIABLES,
245250
null,

src/Compose/Php/ExtensionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class ExtensionResolver
4747
'sysvshm',
4848
'opcache',
4949
'zip',
50+
'blackfire'
5051
];
5152

5253
/**
@@ -172,8 +173,7 @@ public static function getConfig(): array
172173
mkdir -p /tmp/blackfire
173174
tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire
174175
mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so
175-
( echo extension=blackfire.so
176-
echo blackfire.agent_socket=tcp://blackfire:8707 ) > $(php -i | grep "additional .ini" | awk '{print $9}')/blackfire.ini
176+
echo blackfire.agent_socket=tcp://blackfire:8707 > $(php -i | grep "additional .ini" | awk '{print $9}')/blackfire.ini
177177
rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
178178
BASH
179179
// phpcs:enable

src/Config/Source/CliSource.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class CliSource implements SourceInterface
5252
public const OPTION_NO_TMP_MOUNTS = 'no-tmp-mounts';
5353
public const OPTION_SYNC_ENGINE = 'sync-engine';
5454
public const OPTION_WITH_XDEBUG = 'with-xdebug';
55+
public const OPTION_WITHOUT_BLACKFIRE = 'without-blackfire';
5556
public const OPTION_SET_DOCKER_HOST_XDEBUG = 'set-docker-host';
5657
public const OPTION_WITH_ENTRYPOINT = 'with-entrypoint';
5758
public const OPTION_WITH_MARIADB_CONF = 'with-mariadb-conf';
@@ -234,6 +235,12 @@ public function read(): Repository
234235
]);
235236
}
236237

238+
if ($this->input->getOption(self::OPTION_WITHOUT_BLACKFIRE)) {
239+
$repository->set([
240+
self::PHP_DISABLED_EXTENSIONS => ['blackfire']
241+
]);
242+
}
243+
237244
if ($this->input->getOption(self::OPTION_SET_DOCKER_HOST_XDEBUG)) {
238245
$repository->set(self::SYSTEM_SET_DOCKER_HOST, true);
239246
}

src/Test/Integration/BuildComposeTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public function buildDataProvider(): array
8787
[CliSource::OPTION_WITH_TEST, true],
8888
[CliSource::OPTION_WITH_CRON, true],
8989
[CliSource::OPTION_WITH_XDEBUG, true],
90+
[CliSource::OPTION_WITHOUT_BLACKFIRE, true],
9091
[CliSource::OPTION_ES, '5.2'],
9192
[CliSource::OPTION_NO_ES, true],
9293
[CliSource::OPTION_DB_INCREMENT_INCREMENT, 3],
@@ -104,6 +105,7 @@ public function buildDataProvider(): array
104105
[CliSource::OPTION_WITH_TEST, true],
105106
[CliSource::OPTION_WITH_CRON, true],
106107
[CliSource::OPTION_WITH_XDEBUG, true],
108+
[CliSource::OPTION_WITHOUT_BLACKFIRE, true],
107109
[CliSource::OPTION_ES, '5.2'],
108110
[CliSource::OPTION_NO_ES, true],
109111
[CliSource::OPTION_DB_INCREMENT_INCREMENT, 3],

0 commit comments

Comments
 (0)