Skip to content

Commit 5f55c0d

Browse files
committed
Merge branch '4.x' into 4.next
2 parents 8d9a26e + af4f113 commit 5f55c0d

File tree

7 files changed

+30
-4
lines changed

7 files changed

+30
-4
lines changed

.github/workflows/deploy_docs_4x.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ jobs:
1919
uses: dokku/github-action@master
2020
with:
2121
git_remote_url: 'ssh://[email protected]:22/debugkit-docs-4'
22+
git_push_flags: '-f'
2223
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}

docs/en/index.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,20 @@ to include the panel::
291291
The above would load all the default panels as well as the ``AppPanel``, and
292292
``MyCustomPanel`` panel from ``MyPlugin``.
293293

294+
Accessing Toolbar without a frontend
295+
====================================
296+
297+
If you have an application which only provides an API (and therefore no frontend)
298+
the usual way of accessing the toolbar can't be used.
299+
300+
Instead you have to call http://localhost/debug-kit/toolbar/``<debugkit-id>``
301+
302+
The ``<debugkit-id>`` can be found inside the HTTP headers of your API response. It should look something like that::
303+
304+
X-DEBUGKIT-ID: 5ef39604-ad5d-4ca4-85d8-8595e52373bb
305+
306+
So you would have to call http://localhost/debug-kit/toolbar/5ef39604-ad5d-4ca4-85d8-8595e52373bb
307+
294308
Helper Functions
295309
================
296310

src/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function bootstrap(PluginApplicationInterface $app): void
4747
{
4848
$service = new ToolbarService(EventManager::instance(), (array)Configure::read('DebugKit'));
4949

50-
if (!$service->isEnabled() || php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg') {
50+
if (!$service->isEnabled()) {
5151
return;
5252
}
5353

src/ToolbarService.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,14 @@ public function registry()
100100
*/
101101
public function isEnabled()
102102
{
103-
$enabled = (bool)Configure::read('debug');
103+
if (isset($GLOBALS['__PHPUNIT_BOOTSTRAP'])) {
104+
return false;
105+
}
106+
$enabled = (bool)Configure::read('debug')
107+
&& !$this->isSuspiciouslyProduction()
108+
&& php_sapi_name() !== 'phpdbg';
104109

105-
if ($enabled && !$this->isSuspiciouslyProduction()) {
110+
if ($enabled) {
106111
return true;
107112
}
108113
$force = $this->getConfig('forceEnable');

tests/TestCase/Middleware/DebugKitMiddlewareTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public function setUp(): void
5252
$connection = ConnectionManager::get('test');
5353
$this->skipIf($connection->getDriver() instanceof Sqlite, 'Schema insertion/removal breaks SQLite');
5454
$this->oldConfig = Configure::read('DebugKit');
55+
$this->restore = $GLOBALS['__PHPUNIT_BOOTSTRAP'];
56+
unset($GLOBALS['__PHPUNIT_BOOTSTRAP']);
5557
}
5658

5759
/**
@@ -64,6 +66,7 @@ public function tearDown(): void
6466
parent::tearDown();
6567

6668
Configure::write('DebugKit', $this->oldConfig);
69+
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $this->restore;
6770
}
6871

6972
protected function handler()

tests/TestCase/ToolbarServiceTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public function setUp(): void
5858

5959
$connection = ConnectionManager::get('test');
6060
$this->skipIf($connection->getDriver() instanceof Sqlite, 'Schema insertion/removal breaks SQLite');
61+
$this->restore = $GLOBALS['__PHPUNIT_BOOTSTRAP'];
62+
unset($GLOBALS['__PHPUNIT_BOOTSTRAP']);
6163
}
6264

6365
/**
@@ -69,6 +71,7 @@ public function tearDown(): void
6971
{
7072
parent::tearDown();
7173
putenv('HTTP_HOST=');
74+
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $this->restore;
7275
}
7376

7477
/**

webroot/css/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ strong {
605605
.is-active .c-toolbar {
606606
width: 100%;
607607
border-radius: 0;
608-
overflow: auto;
608+
overflow: hidden;
609609
padding-right: 40px;
610610
}
611611

0 commit comments

Comments
 (0)