Skip to content

Commit

Permalink
Added support for Slim apps running in subdirs. (Fixes #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
itsgoingd committed Oct 15, 2013
1 parent 20df69a commit 7597ef2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Clockwork/Support/Slim/ClockworkMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@ public function call()

$this->app->config('clockwork', $this->clockwork);

if ($this->app->config('debug')) {
if (preg_match('#/__clockwork(/(?<id>[0-9\.]+))?#', $this->app->request()->getPathInfo(), $matches)) {
return $this->retrieveRequest($matches['id']);
}

$this->app->response()->header('X-Clockwork-Version', Clockwork::VERSION);
if ($this->app->config('debug') && preg_match('#/__clockwork(/(?<id>[0-9\.]+))?#', $this->app->request()->getPathInfo(), $matches)) {
return $this->retrieveRequest($matches['id']);
}

try {
Expand All @@ -63,6 +59,12 @@ protected function logRequest()

if ($this->app->config('debug')) {
$this->app->response()->header('X-Clockwork-Id', $this->clockwork->getRequest()->id);
$this->app->response()->header('X-Clockwork-Version', Clockwork::VERSION);

$env = $this->app->environment();
if ($env['SCRIPT_NAME']) {
$this->app->response()->header('X-Clockwork-Path', $env['SCRIPT_NAME'] . '/__clockwork/');
}
}
}
}

0 comments on commit 7597ef2

Please sign in to comment.